[go: up one dir, main page]

CN105005766B - A kind of body color recognition methods - Google Patents

A kind of body color recognition methods Download PDF

Info

Publication number
CN105005766B
CN105005766B CN201510374911.5A CN201510374911A CN105005766B CN 105005766 B CN105005766 B CN 105005766B CN 201510374911 A CN201510374911 A CN 201510374911A CN 105005766 B CN105005766 B CN 105005766B
Authority
CN
China
Prior art keywords
color
vehicle
image
pixels
space
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201510374911.5A
Other languages
Chinese (zh)
Other versions
CN105005766A (en
Inventor
刘国文
曾子铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maikelong Electronics Co Ltd Shenzhen City
Original Assignee
Maikelong Electronics Co Ltd Shenzhen City
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Maikelong Electronics Co Ltd Shenzhen City filed Critical Maikelong Electronics Co Ltd Shenzhen City
Priority to CN201510374911.5A priority Critical patent/CN105005766B/en
Publication of CN105005766A publication Critical patent/CN105005766A/en
Application granted granted Critical
Publication of CN105005766B publication Critical patent/CN105005766B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/41Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
    • G06V20/42Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items of sport video content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/46Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)
  • Traffic Control Systems (AREA)

Abstract

本发明公开了一种车身颜色识别方法,包括下列步骤:检测单元对输入的视频数据进行运动检测,采用RGB空间最大值与最小值差值的方法去掉车窗玻璃和车辆阴影干扰区域;通过计算像素个数比值,区别彩色车辆和黑白灰色车辆;使用H空间直方图对红、橙、黄、绿、青、蓝、紫共计7种颜色进行识别,采用V空间直方图和基于扇形区域的颜色投票表决方法对黑、白、灰共计3种颜色进行识别。本发明采用基于RGB颜色空间通道差值的车身颜色识别策略识别车身颜色,可以有效的去除车身颜色识别的干扰区域,提高了车身颜色识别的正确率。

The invention discloses a method for identifying the color of a vehicle body, which comprises the following steps: a detection unit performs motion detection on input video data, and removes window glass and vehicle shadow interference areas by using the method of the difference between the maximum value and the minimum value of RGB space; The ratio of the number of pixels to distinguish between colored vehicles and black, white and gray vehicles; use the H space histogram to identify 7 colors of red, orange, yellow, green, blue, blue, and purple, and use the V space histogram and the color based on the fan-shaped area The voting method identifies three colors: black, white and gray. The present invention adopts the vehicle body color recognition strategy based on RGB color space channel difference to identify the vehicle body color, can effectively remove the interference area of the vehicle body color recognition, and improves the correct rate of vehicle body color recognition.

Description

一种车身颜色识别方法A car body color recognition method

技术领域technical field

本发明涉及图像处理技术,具体涉及一种车身颜色识别方法。The invention relates to image processing technology, in particular to a vehicle body color recognition method.

背景技术Background technique

目前的智能交通系统中,随着车辆数量增多,交通环境变得日益复杂,仅靠车牌对车辆进行识别已经不能满足人们的需要。车辆颜色信息更容易引起人们的兴趣,从而弥补因车辆套牌、一车多牌现象造成车牌识别的不足,并对车辆的识别与搜索、完善和增强智能交通系统功能具有重要意义。In the current intelligent transportation system, with the increase of the number of vehicles, the traffic environment becomes more and more complex, and the identification of vehicles only by the license plate can no longer meet people's needs. Vehicle color information is more likely to arouse people's interest, so as to make up for the lack of license plate recognition caused by the phenomenon of multiple license plates for one vehicle, and it is of great significance to the identification and search of vehicles, and to improve and enhance the functions of intelligent transportation systems.

目前,对车辆颜色的识别主要有两种途径:第一种是对车辆整体颜色进行识别,提取车辆感兴趣区域的颜色特征进行识别。首先通过目标分割获取车辆前景图像,然后进行联通区域分析删除车轮、反光镜等干扰区域得到车辆颜色明显的区域。在分类阶段,采用基于支持向量机的两层分类器将颜色分为黑、白、灰、红、黄、绿、蓝等类型,但是该方法容易受到车辆影子颜色和车窗玻璃颜色造成的干扰,对车身颜色的分类正确率较低。此外,车辆整体颜色识别可通过利用HSI色彩空间(即由色相(Hue)、饱和度(Saturation)和强度(Intensity)组成的色彩模型)的三个通道提取车身颜色每个像素的微观特性值,定义颜色的阈值范围与相互关系,最后借助K最邻近法、人工神经网络和支持向量机等方法将颜色分类。第二种车身颜色识别算法是先定位车牌位置,然后提取车牌上方对应区域作为车身颜色识别区域并进行车身颜色识别。然而,当处理车牌无法识别的视频时,该类方法无法处理的车身颜色,很难满足用户需求。总之,目前大部分识别方法仍无法较好的克服车辆影子颜色、车窗玻璃颜色对车辆颜色识别结果造成的影响。At present, there are mainly two ways to identify the vehicle color: the first is to identify the overall color of the vehicle, and extract the color features of the vehicle's region of interest for identification. Firstly, the foreground image of the vehicle is obtained through target segmentation, and then the connected area is analyzed to delete the interference areas such as wheels and mirrors to obtain the area with obvious color of the vehicle. In the classification stage, a two-layer classifier based on support vector machines is used to classify colors into black, white, gray, red, yellow, green, blue and other types, but this method is susceptible to interference caused by vehicle shadow color and window glass color , the classification accuracy of the body color is low. In addition, the vehicle's overall color recognition can extract the microscopic characteristic value of each pixel of the vehicle body color by using three channels of the HSI color space (that is, a color model composed of Hue, Saturation, and Intensity), Define the threshold range and relationship of colors, and finally classify the colors with the help of K-nearest neighbor method, artificial neural network and support vector machine. The second body color recognition algorithm is to locate the position of the license plate first, and then extract the corresponding area above the license plate as the body color recognition area and perform body color recognition. However, when dealing with unrecognizable license plate videos, this type of method cannot handle the body color, which is difficult to meet user needs. In short, most of the current recognition methods are still unable to overcome the influence of vehicle shadow color and window glass color on the vehicle color recognition results.

因此,如何开发设计一种可以克服车辆影子颜色、车窗玻璃颜色的车身颜色识别方法,已成为目前急需解决的技术难题之一。Therefore, how to develop and design a body color recognition method that can overcome the vehicle shadow color and the color of the window glass has become one of the technical problems that need to be solved urgently.

发明内容Contents of the invention

本发明的目的是提供一种车身颜色识别方法,以解决目前现有技术用于颜色识别存在较大干扰的问题,以便更准确的识别车身的颜色。The purpose of the present invention is to provide a vehicle body color recognition method to solve the problem of large interference in color recognition in the prior art so as to more accurately recognize the color of the vehicle body.

本发明提出的车身颜色识别方法,包括下列步骤:The vehicle body color identification method that the present invention proposes, comprises the following steps:

获取车辆的视频图像并设定绊线,对输入的视频图像数据进行运动目标检测,得到二值化的前景运动目标图像,截取该前景运动目标外接矩形区域,并提取出该矩形图像中的前景运动目标区域在原视频帧中所对应的彩色像素值,然后计算该外接矩形图像中所有像素的RGB彩色通道中最大值与最小值的差值,通过阈值分割方法去掉车窗玻璃和车辆阴影干扰区域;计算像素个数比值,区别彩色车辆和黑白灰色车辆,所述的像素个数比值为前景运动目标经过RGB彩色通道最大值与最小值差值处理和二值化处理后得到的车身区域的像素个数和前景运动目标的外接矩形图像中所包含的像素个数之比;Acquire the video image of the vehicle and set the trip wire, perform moving target detection on the input video image data, obtain a binarized foreground moving target image, intercept the circumscribed rectangular area of the foreground moving target, and extract the foreground in the rectangular image The color pixel value corresponding to the moving target area in the original video frame, and then calculate the difference between the maximum value and the minimum value in the RGB color channel of all pixels in the circumscribed rectangular image, and remove the window glass and vehicle shadow interference area by threshold segmentation method ; Calculate the ratio of the number of pixels to distinguish between colored vehicles and black-and-white and gray vehicles. The ratio of the number of pixels is the pixel in the body area of the foreground moving target after the RGB color channel maximum value and minimum value difference processing and binarization processing The ratio of the number of pixels to the number of pixels contained in the circumscribed rectangular image of the foreground moving target;

使用H空间直方图对红、橙、黄、绿、青、蓝、紫共计七种颜色进行识别;采用V空间直方图和基于扇形区域的颜色投票表决方法对黑、白、灰共计三种颜色进行识别;Use the H space histogram to identify seven colors of red, orange, yellow, green, cyan, blue, and purple; use the V space histogram and the color voting method based on the fan-shaped area to identify the three colors of black, white, and gray identify;

输出识别出的车身颜色。Output the recognized body color.

所述的RGB彩色通道最大值与最小值之差为用于车身颜色识别图像中每个像素点在RGB色彩空间中的R通道、G通道和B通道的最大值Max(R,G,B)和最小值Min(R,G,B)之差(即Max(R,G,B)-Min(R,G,B))。The difference between the maximum value and the minimum value of the RGB color channel is the maximum value Max(R, G, B) of the R channel, G channel and B channel in the RGB color space for each pixel in the body color recognition image and the minimum value Min(R,G,B) (ie Max(R,G,B)-Min(R,G,B)).

所述前景目标的外接矩形所包含的像素个数为采用基于VIBE(可视化背景提取)算法检测获取前景区域中的运动目标,当检测到有运动目标跨越绊线时,即图像前景目标像素点集和图像上的绊线像素点集有第一次交集,则计算出该前景运动目标像素点集的外接矩形图像中所包含的像素个数。The number of pixels contained in the circumscribed rectangle of the foreground object is based on the VIBE (Visual Background Extraction) algorithm to detect and obtain the moving object in the foreground area. If there is the first intersection with the tripwire pixel point set on the image, the number of pixels contained in the circumscribed rectangular image of the foreground moving target pixel point set is calculated.

所述的H空间直方图为车辆图像经过RGB彩色通道中最大值与最小值相减并进行二值化处理后,得到的车身区域在原视频帧中对应颜色区域的H空间直方图。The H-space histogram is the H-space histogram of the vehicle body area corresponding to the color area in the original video frame obtained after the vehicle image is subtracted from the maximum value and the minimum value in the RGB color channels and subjected to binarization processing.

所述的基于扇形区域的颜色投票表决方法为将通过绊线的前景运动目标外接矩形图像中所有像素的RGB颜色空间转换为HSV颜色空间,寻找该前景运动目标的质心,然后以质心为圆心,以该质心到车辆外接矩形框边缘的最短距离为半径画圆,将圆盘区域按72度等分为5个扇形,并计算每个扇形区域内像素(不含背景区域像素)在V空间的直方图,检测直方图中最高峰所在的位置在V空间中对应的颜色,该颜色即为扇形区域的颜色,最后拥有扇形区域数量最多的颜色为该车辆的车身颜色。The color voting method based on the fan-shaped area is to convert the RGB color space of all pixels in the circumscribed rectangular image of the foreground moving target passing the tripwire to the HSV color space, find the centroid of the foreground moving target, and then take the centroid as the center of the circle, Draw a circle with the shortest distance from the center of mass to the edge of the vehicle’s circumscribed rectangular frame as the radius, divide the disk area into 5 sectors at 72 degrees, and calculate the pixels in each sector area (excluding background area pixels) in V space Histogram, detect the color corresponding to the position of the highest peak in the histogram in the V space, this color is the color of the fan-shaped area, and finally the color with the largest number of fan-shaped areas is the body color of the vehicle.

在本发明的一个具体实施例中,所述的车身颜色识别方法包括下列步骤:In a specific embodiment of the present invention, described vehicle body color recognition method comprises the following steps:

步骤S110.获取待检测道路上的车辆视频;Step S110. Obtain the vehicle video on the road to be detected;

步骤S120.采用VIBE(可视化背景提取)算法对视频数据进行运动目标检测,得到二值化的前景运动目标图像,提取通过绊线的前景运动目标,遍历前景运动目标的边缘,分别记录垂直和水平方向上最大值和最小值对应的点坐标,根据得到的点坐标确定前景运动目标的外接矩形,并截取外接矩形图像P1,然后提取出该矩形图像P1中的前景运动目标区域在原视频帧中所对应的彩色像素值并得到图像P2;Step S120. Use the VIBE (Visual Background Extraction) algorithm to detect moving objects on the video data to obtain a binarized foreground moving object image, extract the foreground moving objects passing through the tripwire, traverse the edges of the foreground moving objects, and record vertically and horizontally respectively. According to the point coordinates corresponding to the maximum and minimum values in the direction, determine the circumscribed rectangle of the foreground moving target according to the obtained point coordinates, and intercept the circumscribed rectangular image P1, and then extract the foreground moving target area in the rectangular image P1 in the original video frame. Corresponding color pixel value and get image P2;

步骤S130.计算外接矩形图像P2中每个像素在RGB彩色通道中的最大值Max(R,G,B)和最小值Min(R,G,B),然后计算最大值与最小值之差得到RGB彩色差值图像P3;Step S130. Calculate the maximum value Max(R, G, B) and minimum value Min(R, G, B) of each pixel in the RGB color channel in the circumscribed rectangular image P2, and then calculate the difference between the maximum value and the minimum value to obtain RGB color difference image P3;

步骤S140.给定一个阈值M1,使用该阈值对RGB彩色差值图像P3进行阈值分割得到二值化的车身区域图像P4;Step S140. Given a threshold M1, use the threshold to perform threshold segmentation on the RGB color difference image P3 to obtain a binarized body area image P4;

步骤S150.统计图像P4中车身区域包含的像素个数NP4,统计前景运动目标的外接矩形图像P2中所有像素的个数NP2,计算像素个数比值R=NP4/NP2Step S150. Count the number of pixels N P4 included in the body area in the image P4, count the number N P2 of all pixels in the circumscribed rectangular image P2 of the foreground moving object, and calculate the ratio of the number of pixels R=N P4 /N P2 ;

步骤S160.通过对像素个数比值进行阈值判断,将车辆分为彩色车和黑白灰色车;Step S160. By performing threshold judgment on the ratio of the number of pixels, vehicles are divided into colored vehicles and black, white and gray vehicles;

步骤S170.当车辆为彩色车时,使用H空间直方图对红、橙、黄、绿、青、蓝、紫共计七种颜色进行识别;Step S170. When the vehicle is a colored vehicle, use the H-space histogram to identify seven colors including red, orange, yellow, green, blue, blue and purple;

步骤S180.当车辆为非彩色车时,采用V空间直方图和基于扇形区域的颜色投票表决方法对黑、白、灰共计三种颜色进行识别;Step S180. When the vehicle is a non-color vehicle, use the V space histogram and the color voting method based on the fan-shaped area to identify the three colors of black, white and gray;

步骤S190.存储或输出识别结果。Step S190. Store or output the recognition result.

本发明从视频中提取前景运动目标,并可以保存通过绊线的运动目标的外接矩形图像,通过计算RGB彩色通道中R通道、G通道和B通道的最大值和最小值差值和阈值分割,将车窗和阴影去除,然后将车辆分为彩色车辆和黑白灰车两种类型进行判断。若判定结果为彩色车,根据色相空间直方图进行识别;若判定为黑白灰车,根据V空间直方图和基于扇形区域的颜色投票表决方法进行识别。本发明通过RGB通道差值的方法解决了现有技术选取的用于颜色判断的候选区存在较大干扰的问题,提高了车身颜色识别的正确率。The present invention extracts the foreground moving target from the video, and can save the circumscribed rectangular image of the moving target passing through the trip wire, by calculating the maximum and minimum difference and threshold value segmentation of the R channel, the G channel and the B channel in the RGB color channel, Remove the windows and shadows, and then classify the vehicles into two types: colored vehicles and black-and-white gray vehicles for judgment. If the judgment result is a color car, it will be identified according to the hue space histogram; if it is judged as a black and white gray car, it will be identified according to the V space histogram and the color voting method based on the fan-shaped area. The invention solves the problem of relatively large interference in the candidate area selected for color judgment in the prior art through the RGB channel difference method, and improves the correct rate of body color recognition.

附图说明Description of drawings

图1是本发明一个较佳实施例的流程示意图;Fig. 1 is a schematic flow sheet of a preferred embodiment of the present invention;

图2是本发明一个待识别的车辆视频图像(白色虚线为绊线);Fig. 2 is a video image of a vehicle to be identified in the present invention (the white dotted line is a trip wire);

图3是本发明一个颜色空间直方图。Fig. 3 is a color space histogram of the present invention.

具体实施方式Detailed ways

本发明公开了一种车身颜色识别方法,包括下列步骤:首先读取视频的起始帧并设定绊线,然后对输入的视频数据进行运动目标检测,计算前景运动目标的外接矩形区域并截取得到外接矩形图像,然后计算该外接矩形图像中所有像素在RGB彩色通道中最大值与最小值的差值,并将该车辆颜色分为彩色车辆或黑白灰车辆,最后通过计算各种颜色的直方图分布识别车身颜色。本发明采用基于RGB颜色空间中R通道、G通道和B通道的最大值和最小值差值的车身颜色识别策略识别车身颜色,可以有效的去除车身颜色识别的干扰区域,提高了车身颜色识别的正确率。The invention discloses a vehicle body color recognition method, which comprises the following steps: firstly read the initial frame of the video and set the trip line, then detect the moving target on the input video data, calculate the circumscribed rectangular area of the foreground moving target and intercept the Get the circumscribed rectangle image, then calculate the difference between the maximum value and the minimum value of all pixels in the RGB color channel in the circumscribed rectangle image, and divide the vehicle color into color vehicles or black, white and gray vehicles, and finally calculate the histogram of each color Graph distribution to identify body color. The present invention adopts the vehicle body color identification strategy based on the difference between the maximum value and the minimum value of the R channel, the G channel and the B channel in the RGB color space to identify the vehicle body color, which can effectively remove the interference area of the vehicle body color identification and improve the accuracy of the vehicle body color identification. Correct rate.

下面结合附图和实施例对发明进行详细的说明。The invention will be described in detail below in conjunction with the accompanying drawings and embodiments.

如图1所示,本发明公开的车身颜色识别方法包括以下步骤:As shown in Figure 1, the vehicle body color recognition method disclosed by the present invention comprises the following steps:

步骤S110、获取待检测道路上的车辆视频。Step S110, acquiring the video of the vehicle on the road to be detected.

通过摄像头拍摄静态场景下的道路监控视频,获取所抓取的视频帧在视频序列中的位置,从首帧开始按毫秒读取视频;或直接导入已有的道路监控视频,从导入视频的首帧开始,按照视频帧播放的时间顺序逐帧导入视频。Shoot the road surveillance video in a static scene through the camera, obtain the position of the captured video frame in the video sequence, and read the video in milliseconds from the first frame; or directly import the existing road surveillance video, start from the first frame of the imported video Frame start, import the video frame by frame according to the time sequence of video frame playback.

图2为待识别的车辆视频图像。白色虚线为用户标记的绊线,和绊线接触的蓝色车辆为待识别的车辆。Figure 2 is a video image of a vehicle to be identified. The white dotted line is the trip wire marked by the user, and the blue vehicle in contact with the trip wire is the vehicle to be recognized.

步骤S120、对视频数据进行运动目标检测,截取通过绊线的二值化的前景运动目标外接矩形图像P1,然后提取出该矩形图像中的前景运动目标区域在原视频帧中所对应的彩色像素值并得到图像P2。Step S120: Perform moving object detection on the video data, intercept the binarized foreground moving object circumscribed rectangular image P1 passing the tripwire, and then extract the color pixel value corresponding to the foreground moving object area in the rectangular image in the original video frame And get image P2.

用户根据自身需要,在车辆视频起始帧,人为描绘虚线作为绊线(见图2)。采用基于VIBE(可视化背景提取,Visual Background Extractor)算法检测获取前景区域中的运动目标,得到二值化的运动目标图像P1(即图像中运动目标像素值为1,背景像素值为0)。具体操作是当检测到有运动目标跨越绊线时,即图像前景目标像素点集和图像上的绊线像素点集有第一次交集,则计算出该前景运动目标像素点集的外接矩形(即遍历前景运动目标的边缘,分别记录垂直和水平方向上最大值和最小值对应的像素点坐标,根据计算出的坐标确定前景运动目标的外接矩形),然后截取外接矩形图像,得到二值化的车辆图像P1,然后提取出该矩形中的前景运动目标区域(即像素值大于0的像素区域)在原视频帧中所对应的彩色像素值,得到车辆图像P2。According to their own needs, the user artificially draws a dotted line as a trip line at the start frame of the vehicle video (see Figure 2). Based on the VIBE (Visual Background Extractor) algorithm, the moving target in the foreground area is detected and obtained, and the binarized moving target image P1 is obtained (that is, the moving target pixel value in the image is 1, and the background pixel value is 0). The specific operation is that when it is detected that there is a moving target crossing the tripwire, that is, there is an intersection for the first time between the image foreground target pixel point set and the tripwire pixel point set on the image, then the circumscribed rectangle of the foreground moving target pixel point set ( That is, traverse the edge of the foreground moving object, record the pixel coordinates corresponding to the maximum value and the minimum value in the vertical and horizontal directions respectively, determine the circumscribed rectangle of the foreground moving object according to the calculated coordinates), and then intercept the circumscribed rectangle image to obtain binarization The vehicle image P1 of the rectangle, and then extract the color pixel value corresponding to the foreground moving target area in the rectangle (that is, the pixel area with a pixel value greater than 0) in the original video frame to obtain the vehicle image P2.

步骤S130、计算图像P2中每个像素的RGB的最大值Max(R,G,B)和最小值Min(R,G,B),然后计算最大值与最小值之差得到RGB彩色通道差值图像P3(即P3=Max(R,G,B)-Min(R,G,B))。Step S130, calculate the maximum value Max(R, G, B) and the minimum value Min(R, G, B) of the RGB of each pixel in the image P2, and then calculate the difference between the maximum value and the minimum value to obtain the RGB color channel difference Image P3 (ie P3=Max(R,G,B)-Min(R,G,B)).

步骤S140、给定一个阈值M1,使用该阈值对图像P3进行阈值分割得到二值化图像P4(即车身区域像素值为1,背景区域像素值为0)。像素值大于M1的像素为1,反之为0。Step S140 , a threshold M1 is given, and the image P3 is thresholded to obtain a binarized image P4 (that is, the pixel value of the body area is 1, and the pixel value of the background area is 0). A pixel with a pixel value greater than M1 is 1, otherwise it is 0.

步骤S150、统计图像P4中的车身区域(即像素值大于0的区域)包含的像素个数NP4,统计前景运动目标的外接矩形图像P2中所有像素的个数NP2(即矩形框长度与矩形框宽度的像素个数的乘积),计算像素个数比值R=NP4/NP2Step S150, counting the number of pixels N P4 contained in the body area in the image P4 (that is, the area with a pixel value greater than 0), and counting the number N P2 of all pixels in the circumscribed rectangular image P2 of the moving target in the foreground (that is, the length of the rectangular frame and The product of the number of pixels of the width of the rectangular frame), calculate the ratio of the number of pixels R=N P4 /N P2 .

步骤S160、通过判断像素个数比值R的大小,将车辆分为彩色车和黑白灰色车。给定一个阈值M2,若R大于阈值M2,则转入步骤S170进行彩色识别;若R小于阈值M2,则转入步骤S180进行黑、白、灰色识别。Step S160, by judging the ratio R of the number of pixels, classify the vehicles into colored vehicles and black, white and gray vehicles. Given a threshold M2, if R is greater than the threshold M2, proceed to step S170 for color recognition; if R is smaller than the threshold M2, proceed to step S180 for black, white and gray recognition.

步骤S170、在H(色相)空间中定义颜色取值范围(见表1),分别定义为红、橙、黄、绿、青、蓝、紫共计7种颜色。提取二值化图像P4中像素值大于0的区域在图像P2中所对应的颜色值,然后将RGB转为HSV颜色空间(即由色相(Hue)、饱和度(Saturation)和亮度(Value)组成的色彩模型)。计算H空间的直方图,检测直方图中最高峰所落入的H空间的颜色范围,该范围对应的颜色为该车身的颜色。Step S170, define color value ranges in H (hue) space (see Table 1), which are defined as red, orange, yellow, green, cyan, blue, and purple, a total of 7 colors. Extract the color value corresponding to the area in the image P2 where the pixel value in the binarized image P4 is greater than 0, and then convert the RGB to the HSV color space (that is, composed of hue (Hue), saturation (Saturation) and brightness (Value) color model). Calculate the histogram of the H space, detect the color range of the H space where the highest peak in the histogram falls, and the color corresponding to the range is the color of the vehicle body.

表1:H(色相)空间中定义颜色取值范围Table 1: Define color value range in H (hue) space

步骤S180、在V(亮度)空间中定义颜色取值范围(见表2),分别定义为黑、白、灰共计3种颜色。将前景运动目标P2的RGB颜色空间转换为HSV颜色空间,寻找P2的质心,然后以质心为圆心,以该质心到车辆外接矩形框边缘的最短距离为半径画圆。将圆盘区域按72度等分为5个扇形,并计算每个扇形区域内像素(不含背景区域像素)在V空间的直方图,检测直方图中最高峰所在的位置在V空间中对应的颜色,该颜色即为扇形区域的颜色,最后通过投票表决的方式对车身颜色投票,确定拥有扇形区域数量最多的颜色为该车辆的车身颜色。Step S180, define color value ranges in the V (brightness) space (see Table 2), which are respectively defined as black, white, and gray in total. Convert the RGB color space of the foreground moving target P2 to the HSV color space, find the centroid of P2, and then draw a circle with the centroid as the center and the shortest distance from the centroid to the edge of the vehicle’s circumscribed rectangle as the radius. Divide the disk area into 5 sectors at 72 degrees, and calculate the histogram of the pixels in each sector area (excluding the pixels in the background area) in the V space, and detect the position of the highest peak in the histogram corresponding to the V space The color of the fan-shaped area is the color of the fan-shaped area. Finally, the color of the vehicle body is voted by voting, and the color with the largest number of fan-shaped areas is determined to be the body color of the vehicle.

表2:V(亮度)空间中定义颜色取值范围Table 2: Define the color value range in V (brightness) space

亮度空间(0~255)Brightness space (0~255) black Ash White 最大值maximum value 00 4747 221221 最小值minimum value 4646 220220 255255

步骤S190、存储车身颜色识别结果。Step S190, storing the body color recognition result.

步骤S200、判断是否是最后一帧视频,如果不是,转入步骤S120,继续分割前景运动目标并判断颜色;如果不是,转入步骤S210。Step S200, judge whether it is the last frame of video, if not, go to step S120, continue to segment the foreground moving object and judge the color; if not, go to step S210.

步骤S210、返回所有车身颜色。结束车身颜色识别流程。Step S210, return all vehicle body colors. End the body color recognition process.

图3为图像P3中二值化的车身区域所对应的颜色在H空间中的直方图分布,该直方图呈现明显的单峰特性,因此本发明可以较好的识别出车身颜色。Fig. 3 is the histogram distribution of the color corresponding to the binarized body area in the image P3 in the H space. The histogram presents an obvious unimodal characteristic, so the present invention can better identify the color of the body.

以上显示和描述了本发明的基本原理、主要特征和本发明的特点。由于使用了颜色空间的最大值与最小值差分算法,降低了车辆影子颜色、车窗玻璃颜色对车身彩色识别的影响,提高了车身颜色识别的正确率。其次,本发明可以从任何角度识别出车身颜色,无需提取其它特征(如用车牌定位颜色区域)来进行车身颜色识别。The basic principles, main features and characteristics of the present invention have been shown and described above. Due to the use of the maximum value and minimum value difference algorithm of the color space, the influence of the vehicle shadow color and the window glass color on the body color recognition is reduced, and the accuracy of the body color recognition is improved. Secondly, the present invention can identify the color of the vehicle body from any angle, without extracting other features (such as using the license plate to locate the color region) to identify the color of the vehicle body.

Claims (8)

1. a kind of body color recognition methods, which is characterized in that comprise the following steps:
The video image and setting for obtaining vehicle are stumbled line, moving object detection are carried out to the vedio data of input, before interception The boundary rectangle of scape moving target;Then calculate in the boundary rectangle image in the RGB color passage of all pixels maximum with The difference of minimum value passes through a threshold value M1 so that the threshold value obtains binaryzation to RGB color error image into row threshold division Vehicle body image, to remove glass for vehicle window and vehicle shadow interference region;
Number of pixels ratio is calculated, distinguishes colored vehicle and black and white grey vehicle, the number of pixels ratio is foreground moving Target is by maxima and minima difference processing in RGB color passage and the number of pixels in the vehicle body region after binary conversion treatment The ratio between number of pixels included with the boundary rectangle of foreground moving object;
Using H spatial histograms red, orange, yellow, green, blue, blue, purple are amounted to seven kinds of colors to be identified;Using V spatial histograms Method is voted with the color based on sector region black, white, grey three kinds of colors altogether are identified;
Export the body color identified.
2. the method as described in claim 1, it is characterised in that:Maxima and minima difference in the RGB color passage Maximum Max (R, G, B) and minimum value of each pixel in rgb color space in image are identified to be used for body color The difference of Min (R, G, B), i.e. Max (R, G, B)-Min (R, G, B).
3. the method as described in claim 1, it is characterised in that:The number of pixels that the boundary rectangle of foreground target is included is to adopt With the moving target obtained in foreground area is detected based on VIBE (visualization background extracting) algorithm, when having detected moving target Across stumble line when, i.e., the line pixel point set of stumbling on display foreground object pixel point set and image has first time intersection, then calculates The number of pixels that the boundary rectangle of the foreground moving object pixel point set is included.
4. the method as described in claim 1, it is characterised in that:The H spatial histograms pass through rgb space for vehicle image After the maximum and minimum value of middle R, G and B triple channel subtract each other and carry out binary conversion treatment, obtained vehicle body region, i.e. pixel value Region more than 0, the H spatial histograms in corresponding color region in former video frame.
5. the method as described in claim 1, it is characterised in that:The color method of voting based on sector region is The RGB color of moving target external world rectangular image is converted into hsv color space, finds the barycenter of foreground moving object, Then using barycenter as the center of circle, drawn and justified as radius using the beeline of the barycenter to vehicle boundary rectangle frame edge, by disc area 5 sectors are divided by 72 degree, and calculate pixel in each sector region, the pixel without background area, the Nogata in V spaces Figure, it is the color of sector region to detect the position in histogram where top corresponding color, the color in V spaces, Finally possess the body color that the most color of sector region quantity is the vehicle.
6. a kind of body color recognition methods, which is characterized in that comprise the following steps:
Step S110. obtains road vehicle video to be detected;
Step S120. carries out moving object detection to video data, extracts the foreground moving object by line of stumbling, interception prospect fortune The boundary rectangle of moving-target;
Step S130. calculates the maximum Max (R, G, B) and minimum of the RGB color passage of each pixel in boundary rectangle image Value Min (R, G, B), the difference for then calculating maxima and minima obtain RGB color error image;
Step S140. gives a threshold value M1, and binaryzation is obtained into row threshold division to RGB color error image using the threshold value Image;
The number of pixels N in vehicle body region in step S150. statistics binary images P4P4, count the external square of foreground moving object The number N of all pixels in image P2 corresponding to shapeP2, calculate number of pixels ratio R=NP2/ NP4
Vehicle is divided into colored vehicle and black and white grey vehicle by step S160. by number of pixels fractional threshold determination methods;
Step S170. amounts to red, orange, yellow, green, blue, blue, purple using H spatial histograms seven kinds of face when vehicle is colored vehicle Color is identified;
Step S180. is when vehicle is achromaticity vehicle, using V spatial histograms and the color side of voting based on sector region Black, white, grey three kinds of colors altogether are identified in method;
Step S190. is stored or output recognition result.
7. body color recognition methods as claimed in claim 6, which is characterized in that H(Form and aspect)Color value defined in space Scope such as following table:
8. body color recognition methods as claimed in claim 6, which is characterized in that the V(Brightness)Color defined in space Value range such as following table:
Brightness space(0~255) It is black Ash In vain Maximum 0 47 221 Minimum value 46 220 255
CN201510374911.5A 2015-07-01 2015-07-01 A kind of body color recognition methods Expired - Fee Related CN105005766B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510374911.5A CN105005766B (en) 2015-07-01 2015-07-01 A kind of body color recognition methods

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510374911.5A CN105005766B (en) 2015-07-01 2015-07-01 A kind of body color recognition methods

Publications (2)

Publication Number Publication Date
CN105005766A CN105005766A (en) 2015-10-28
CN105005766B true CN105005766B (en) 2018-06-01

Family

ID=54378431

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510374911.5A Expired - Fee Related CN105005766B (en) 2015-07-01 2015-07-01 A kind of body color recognition methods

Country Status (1)

Country Link
CN (1) CN105005766B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503638B (en) * 2016-10-13 2019-09-13 金鹏电子信息机器有限公司 Image procossing, vehicle color identification method and system for color identification
CN107563374B (en) * 2017-08-14 2020-07-10 华中科技大学 Digital display instrument nixie tube positioning method
CN109190639A (en) * 2018-08-16 2019-01-11 新智数字科技有限公司 A kind of vehicle color identification method, apparatus and system
CN109508720B (en) * 2018-10-23 2021-04-23 高新兴科技集团股份有限公司 Vehicle color identification method and device
CN109635825A (en) * 2018-12-19 2019-04-16 苏州市科远软件技术开发有限公司 Vehicle attribute detection method, device and storage medium
CN109584317B (en) * 2018-12-24 2023-07-25 天津天地伟业信息系统集成有限公司 Vehicle body color identification method based on HSV color space histogram
CN110502986B (en) * 2019-07-12 2024-09-17 平安科技(深圳)有限公司 Method, device, computer equipment and storage medium for identifying positions of persons in image
CN110751053B (en) * 2019-09-26 2022-02-22 高新兴科技集团股份有限公司 Vehicle color identification method, device, equipment and storage medium
CN112507801A (en) * 2020-11-14 2021-03-16 武汉中海庭数据技术有限公司 Lane road surface digital color recognition method, speed limit information recognition method and system
CN112907516B (en) * 2021-01-27 2022-08-02 山东省计算中心(国家超级计算济南中心) Sweet corn seed identification method and device for plug seedling
CN114170522A (en) * 2022-02-14 2022-03-11 北京中科慧眼科技有限公司 Color classification identification method and system based on chromatographic similarity measurement
CN115482474B (en) * 2022-08-24 2023-07-04 湖南科技大学 Bridge deck vehicle load identification method and system based on aerial image
CN115861917A (en) * 2022-11-11 2023-03-28 浙江大华技术股份有限公司 A color recognition method, device and storage medium
CN116563770B (en) * 2023-07-10 2023-09-29 四川弘和数智集团有限公司 Method, device, equipment and medium for detecting vehicle color
CN117152167B (en) * 2023-10-31 2024-03-01 海信集团控股股份有限公司 Target removing method and device based on segmentation large model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504717A (en) * 2008-07-28 2009-08-12 上海高德威智能交通系统有限公司 Characteristic area positioning method, car body color depth and color recognition method
US8340420B2 (en) * 2009-10-05 2012-12-25 National Taiwan University Method for recognizing objects in images
CN103425989A (en) * 2013-08-07 2013-12-04 中山大学 Vehicle color identification method based on significance analysis
CN103544480A (en) * 2013-10-17 2014-01-29 公安部第三研究所 Vehicle Color Recognition Method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504717A (en) * 2008-07-28 2009-08-12 上海高德威智能交通系统有限公司 Characteristic area positioning method, car body color depth and color recognition method
US8340420B2 (en) * 2009-10-05 2012-12-25 National Taiwan University Method for recognizing objects in images
CN103425989A (en) * 2013-08-07 2013-12-04 中山大学 Vehicle color identification method based on significance analysis
CN103544480A (en) * 2013-10-17 2014-01-29 公安部第三研究所 Vehicle Color Recognition Method

Also Published As

Publication number Publication date
CN105005766A (en) 2015-10-28

Similar Documents

Publication Publication Date Title
CN105005766B (en) A kind of body color recognition methods
CN109886896B (en) A blue license plate segmentation and correction method
CN106709436B (en) Track traffic panoramic monitoring-oriented cross-camera suspicious pedestrian target tracking system
CN103279736B (en) A kind of detection method of license plate based on multi-information neighborhood ballot
CN105205489B (en) Detection method of license plate based on color and vein analyzer and machine learning
TWI409718B (en) Method of locating license plate of moving vehicle
CN103035013B (en) An Accurate Moving Shadow Detection Method Based on Multi-feature Fusion
CN105160691A (en) Color histogram based vehicle body color identification method
CN105893925A (en) Human hand detection method based on complexion and device
CN103034852B (en) The detection method of particular color pedestrian under Still Camera scene
CN105469046B (en) Based on the cascade vehicle model recognizing method of PCA and SURF features
US20200250840A1 (en) Shadow detection method and system for surveillance video image, and shadow removing method
CN107895492A (en) A kind of express highway intelligent analysis method based on conventional video
CN103903018A (en) Method and system for positioning license plate in complex scene
CN103324935B (en) Vehicle is carried out the method and system of location and region segmentation by a kind of image
CN103971128A (en) Traffic sign recognition method for driverless car
CN111695373B (en) Zebra stripes positioning method, system, medium and equipment
CN106815587B (en) Image processing method and device
CN106056139A (en) Forest fire smoke/fog detection method based on image segmentation
CN111178359A (en) License plate number recognition method, device and device and computer storage medium
CN105046199A (en) Finger tip point extraction method based on pixel classifier and ellipse fitting
CN107146210A (en) A Method of Detecting and Removing Shadows Based on Image Processing
CN104299210A (en) Vehicle shadow eliminating method based on multi-feature fusion
Danescu et al. Detection and classification of painted road objects for intersection assistance applications
CN107507206A (en) A kind of depth map extracting method based on conspicuousness detection

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180601