CN108256521B - Effective area positioning method for vehicle body color identification - Google Patents
Effective area positioning method for vehicle body color identification Download PDFInfo
- Publication number
- CN108256521B CN108256521B CN201711498902.2A CN201711498902A CN108256521B CN 108256521 B CN108256521 B CN 108256521B CN 201711498902 A CN201711498902 A CN 201711498902A CN 108256521 B CN108256521 B CN 108256521B
- Authority
- CN
- China
- Prior art keywords
- image
- mask
- positioning
- block
- value
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/255—Detecting or recognising potential candidate objects based on visual cues, e.g. shapes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/62—Text, e.g. of license plates, overlay texts or captions on TV images
- G06V20/625—License plates
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses an effective area positioning method for vehicle body color identification, which comprises the following steps: (1) acquiring a vehicle body color identification primary positioning area; (2) carrying out image preprocessing on the image of the primary positioning area; (3) calculating a block characteristic mask image for the preprocessed image; (4) calculating brightness characteristics of the positioning image corresponding to the characteristic mask image, and updating the mask image; (5) carrying out information statistics on the obtained characteristic mask image; (6) and correcting the mask image value according to the mask image statistical information to obtain a final positioning image. The method and the device take the area which is relatively smooth and is easily divided into the positioning area due to the reflection or shadow interference of the vehicle body into consideration, so that the method and the device not only extract the texture information of the vehicle body, but also take the distribution of the brightness information into consideration to remove the interference, remove the interference to the maximum extent, and reserve the area which can represent the color of the vehicle body most as the identified positioning area.
Description
Technical Field
The invention relates to the technical field of application of an image processing technology in vehicle body color identification, in particular to an effective area positioning method for vehicle body color identification.
Background
Today, video monitoring is rapidly developed, and high-definition and intelligentization are gradually integrated into lives of people. The intelligent transportation system shows powerful effect in the aspects of charge bayonet, parking area and criminal tracking. With the rapid increase of the number of vehicles, the number of vehicle events is more and more complex, the monitoring of the motor vehicles is obviously insufficient only by means of license plate identification information, and the license plates are easily influenced by intentional shielding, fouling and the like, and the condition that one license plate has more vehicles, the number of license plates is overlapped and the like can cause the reduction of the vehicle identification capability. The vehicle information in the video image includes vehicle color, vehicle model and the like besides the license plate number, wherein the vehicle color recognition plays a significant role in vehicle road monitoring and is an indispensable part in the vehicle information.
The color of the car body is easily affected by environmental factors such as illumination, weather, pollution and shielding of a recognition area, so that color distortion is caused, especially, the reflection phenomenon of sunlight can change the color value of the car body to a great extent, and color recognition errors are caused. Moreover, vehicle information acquired by a monitoring camera has the problems of vehicle posture diversity and other regional texture interference, so that the color of a vehicle body cannot be accurately identified.
At present, methods for recognizing colors of a vehicle body mainly select a smooth region on the vehicle body as a color recognition region, and then recognize specific colors by using a color template or a machine learning method such as SVM. The positioning of the color area of the vehicle body is used as the first step of color identification, and the quality of the positioned area directly influences the accuracy of a color identification result. Most of the existing color recognition algorithms place main efforts on recognition methods, the positioning area is selected by only using texture information and selecting the vehicle body positioning area through edge density, and when a vehicle body is strongly reflected or shades are shielded, the positioning area is usually selected as the positioning area due to less texture of a reflection area, so that the recognition result is incorrect.
Disclosure of Invention
In order to make up for the defects of the prior art, the invention provides the effective area positioning method for vehicle body color identification, which has a simple structure and is convenient to use.
The invention is realized by the following technical scheme:
the invention discloses an effective area positioning method for vehicle body color identification, which is characterized by comprising the following steps: the method comprises the following steps:
(1) acquiring a vehicle body color identification primary positioning area;
(2) carrying out image preprocessing on the image of the primary positioning area;
(3) calculating a block characteristic mask image for the preprocessed image;
(4) calculating brightness characteristics of the positioning image corresponding to the characteristic mask image, and updating the mask image;
(5) carrying out information statistics on the obtained characteristic mask image;
(6) and correcting the mask image value according to the mask image statistical information to obtain a final positioning image.
In the step (1), acquiring a vehicle body color identification primary positioning area, including acquiring license plate positioning information and a positioning image;
firstly, acquiring position information of a license plate in a whole image, namely rectangular information, including coordinates (x) of the upper left corner of the license plate in the image according to a license plate positioning technology0,y0) Width w of license plate0And height h0;
The step of acquiring the preliminary positioning area specifically comprises the following steps: according to the position of the license plate, a rectangular region above the license plate is obtained and used as a primary positioning region, and the width and the height of the region are respectively set as w and h.
In the step (2), image preprocessing is carried out on the primary positioning area, wherein the image preprocessing comprises texture information extraction and morphological processing;
the texture information extraction specifically comprises the following steps: carrying out graying processing on the preliminary positioning image, calculating the edge characteristics of the preliminary positioning image, and carrying out binarization processing; wherein, the edge feature can adopt edge extraction operators such as a sobel operator, a canny operator or a prewitt operator;
the morphological treatment is to adopt a swelling operation to make the edge clearer.
Calculating a characteristic mask image of the processed positioning image in the step (3), namely performing block processing on the processed positioning image to obtain a texture characteristic mask image taking a block as a unit;
image masks are areas or processes that control image processing by occluding the image to be processed (in whole or in part) with a selected image, graphic or object; in digital image processing, a mask is a two-dimensional matrix array, sometimes a multi-valued image is used, and a mask image is a two-dimensional matrix and is treated as an image;
in digital image processing, image masks are mainly used for: extracting an interested region, and multiplying a pre-made interested region mask and an image to be processed to obtain an interested region image, wherein the image value in the interested region is kept unchanged, and the image value outside the region is 0; shielding, namely shielding certain areas on the image by using a mask, so that the certain areas do not participate in processing or calculation of processing parameters, or only processing or counting shielded areas; extracting structural features, namely detecting and extracting the structural features similar to the mask in the image by using a similarity variable or image matching method; fourthly, making images with special shapes;
the mask image has the main function of shielding, and certain areas on the mask image are used for shielding so as not to participate in subsequent calculation;
the blocking processing of the positioning image specifically comprises the following steps: partitioning the processed positioning image, and setting the size of the block as blk + blk, so that the positioning image can be partitioned into a plurality of blocks; processing by taking a block as a unit, calculating the proportion of texture pixels in each block in the block, and dividing the positioning image into texture blocks and smooth blocks according to the relation between the proportion and a threshold value;
creating a corresponding mask image, wherein the state of one block in the positioning image corresponds to one pixel value in the mask image, the size of the obtained mask image is (w/blk, h/blk), if the block in the positioning image is determined to be a smooth block, the corresponding pixel value in the mask image is set to 255 or other non-zero values, and if the texture block is positioned, the pixel value of the corresponding position in the mask image is set to 0, so that the mask image corresponding to the positioning image is obtained; and for the area corresponding to the pixel value of 0 in the mask image, the subsequent identification operation is not involved.
And (4) calculating brightness characteristics of the preliminary positioning image corresponding to the characteristic mask image, updating the mask image, calculating the average value of the brightness of the pixels in the block in the positioning image corresponding to the slider, and taking the value as the pixel value of the corresponding block in the mask image to obtain the updated mask image.
Step 5, counting the acquired mask image, including calculating a histogram of the mask image and processing the histogram; the processing of the histogram includes calculating the ratio of the number of pixels in each bin, and sorting the obtained bin ratios.
Step (6), correcting the pixel value of the mask image according to the statistical information of the mask image to obtain a final positioning image, wherein the final positioning image comprises a step of removing an interference area, such as a light reflection area, in the preliminary positioning area according to the statistical information; and determining the pixel value of the final mask image according to the statistical information so as to obtain whether the pixel value of the corresponding block in the positioning area image is reserved or not, finally obtaining the pixel value of the corresponding block only containing the condition, and taking the image as the final positioning image.
The method has the beneficial effect of solving the problem of color recognition error caused by inaccurate area positioning in the color recognition of the vehicle body. According to the method, the area is relatively smooth and is easily divided into the positioning area due to the reflection or shadow interference of the vehicle body, so that the texture information of the vehicle body is extracted, the interference removal effect of the distribution of the brightness information is also considered, the interference is removed to the maximum extent through statistical information, and the area which can represent the color of the vehicle body most is reserved as the identified positioning area. By means of blocking the mask image, influences of vehicle texture and brightness information distribution are fully considered, interference information possibly brought by the original image is shielded, only area information capable of reflecting vehicle body colors is reserved and stored in a block mode, and influences of interference areas in the rectangular positioning area on the recognition result are solved. Accurate pixel values can be provided for subsequent identification by adopting a color template matching or machine learning method.
Drawings
Fig. 1 shows a flow chart of the area location method of the present invention.
Fig. 2 shows an initial positioning area selection diagram.
Detailed Description
The attached drawing is an embodiment of the invention.
The invention provides an effective area positioning method for vehicle body color identification, which takes the positioned area as an identification area for color identification. This region needs to satisfy the influence of avoiding peripheral environment such as reflection of light, shadow interference to cause the color change, and the colour value of each pixel is unanimous in the region, and can the characteristics of the present vehicle body colour of true reaction.
The invention discloses an effective area positioning method for vehicle body color identification, which comprises the following steps:
(1) acquiring a vehicle body color identification primary positioning area;
(2) carrying out image preprocessing on the image of the primary positioning area;
(3) calculating a block characteristic mask image for the preprocessed image;
(4) calculating brightness characteristics of the positioning image corresponding to the characteristic mask image, and updating the mask image;
(5) carrying out information statistics on the obtained characteristic mask image;
(6) and correcting the mask image value according to the mask image statistical information to obtain a final positioning image.
The method comprises the following specific steps.
And (2) acquiring the vehicle body color identification primary positioning area in the step (1) comprises acquiring license plate positioning information and positioning images.
Firstly, acquiring position information of a license plate in a whole image, namely rectangular information, including coordinates (x) of the upper left corner of the license plate in the image according to a license plate positioning technology0,y0) Width w of license plate0And height h0。
The step of acquiring the preliminary positioning area specifically comprises the following steps: according to the position of the license plate, a rectangular region above the license plate is obtained and used as a primary positioning region, and the width and the height of the region are respectively set as w and h.
Step (2), image preprocessing including texture information extraction and morphological processing is carried out on the primary positioning area;
the texture information extraction specifically comprises the following steps: and carrying out gray processing on the preliminary positioning image, calculating the edge characteristics of the preliminary positioning image, and carrying out binarization processing. The edge feature can adopt an edge extraction operator such as a sobel operator, a canny operator or a prewitt operator.
The morphological treatment is to adopt a swelling operation to make the edge clearer.
And (3) calculating a characteristic mask image of the processed positioning image, namely performing block processing on the processed positioning image to obtain a texture characteristic mask image taking a block as a unit.
An image mask is a region or process that controls image processing by occluding the image to be processed (in whole or in part) with a selected image, graphic, or object. In digital image processing, a mask is a two-dimensional matrix array, and sometimes a multi-valued image is used, and a mask image is processed as a two-dimensional matrix as if it were one image.
In digital image processing, image masks are mainly used for: firstly, extracting an interested region, and multiplying a pre-made interested region mask and an image to be processed to obtain an interested region image, wherein the image value in the interested region is kept unchanged, and the image value outside the region is 0. Masking, masking certain areas of the image to be processed or not to be processed parameter calculation, or processing or counting only the masked areas. Extracting structural features, and detecting and extracting the structural features similar to the mask in the image by using a similarity variable or an image matching method. And fourthly, manufacturing the image with the special shape.
The mask image has the main function of shielding, and certain areas on the mask image are used for shielding so as not to participate in subsequent calculation.
The blocking processing of the positioning image specifically comprises the following steps: partitioning the processed positioning image, and setting the size of the block as blk + blk, so that the positioning image can be partitioned into a plurality of blocks; processing is carried out by taking the block as a unit, the proportion of the texture pixels in each block in the block is calculated, and the positioning image is divided into texture blocks and smooth blocks according to the relation between the proportion and a threshold value.
The corresponding mask image is created, the state of one block in the positioning image corresponds to one pixel value in the mask image, the obtained mask image size is (w/blk, h/blk), if the block in the positioning image is determined to be a flat sliding block, the corresponding pixel value in the mask image is set to 255 or other non-zero values, and if the texture block is positioned, the pixel value of the corresponding position in the mask image is set to 0, and the mask image corresponding to the positioning image is obtained. And for the area corresponding to the pixel value of 0 in the mask image, the subsequent identification operation is not involved.
And (4) calculating brightness characteristics of the preliminary positioning image corresponding to the characteristic mask image, and updating the mask image.
And (5) counting the acquired mask image, wherein the counting comprises calculating a histogram of the mask image and processing the histogram.
The processing of the histogram includes calculating the ratio of the number of pixels in each bin, and sorting the obtained bin ratios.
And (6) correcting the pixel value of the mask image according to the statistical information of the mask image to obtain a final positioning image, wherein the step of removing an interference area, such as a light reflection area, in the preliminary positioning area according to the statistical information is included.
And determining the pixel value of the final mask image according to the statistical information so as to obtain whether the pixel value of the corresponding block in the positioning area image is reserved or not, finally obtaining the pixel value of the corresponding block only containing the condition, and taking the image as the final positioning image.
The present invention has the following specific steps.
Step (1): and acquiring an image of a vehicle body initial positioning area.
And determining a primary positioning area according to the license plate position information and the license plate color information in the vehicle image.
The images can be captured by cameras at the entrance and exit of a parking lot, a toll station and other places where vehicles pass through.
The license plate position information and the license plate color information are obtained through a license plate recognition technology and are not repeated.
The area of the vehicle front end which can reflect the color of the vehicle body is located in the engine hood part of the vehicle, and the area has a large smooth area and is easier to obtain than other areas. Therefore, a rectangular area is selected as a candidate positioning area at the engine hood.
The outside of the engine hood is located right above the position of the license plate, and therefore, the region above the position of the license plate is selected as a candidate region for color recognition. And according to different application scenes, the position of the candidate region is properly adjusted. For example, for a parking lot scene, considering that most license plate recognition machines are located on the left side of the advancing direction of the entering and exiting vehicle, when the vehicle is facing the main view, more shooting parts are obtained on the right side of the head of the vehicle than on the left side of the head of the vehicle. Therefore, the rectangular area selected for the scene is shifted to the right side compared with the center position of the license plate.
Considering the situation that the colors of the vehicle bodies of the upper part and the lower part of the radiator grille of the medium-sized vehicle are different, the candidate positioning area does not comprise the position area where the license plate is located and the areas on the left side and the right side of the license plate, and the color of the upper half part of the vehicle body is taken as the main color of the vehicle body.
Meanwhile, the difference of the front end shapes of vehicles of different vehicle types is considered, and the rectangular area is properly adjusted according to the type of the license plate so as to adapt to different vehicle types as much as possible. According to the color information of the license plate, whether the vehicle is a large vehicle or a small vehicle can be simply judged, when the color of the license plate is yellow and is not the same as that of a coach vehicle, the vehicle is represented as the large vehicle, and when the color of the license plate is blue or other colors, the vehicle is represented as the small vehicle or the medium vehicle. The problem that the front end of a part of large trucks is too high can be solved by properly adjusting parameters according to the truck types, but the problem cannot be effectively solved for most medium trucks. Therefore, when the rectangular area is actually selected, the boundary area is enlarged as much as possible.
Specifically, assume that the current image containing the vehicle is f, and the license plate position information in the image is Rect (x)0,y0,w0,h0) Respectively representing the rectangular coordinates of the license plate in the original image f, (x)0,y0) Coordinate value, w, representing the top left corner of the license plate in image f0Indicates the width, h, of the license plate0Indicating the height of the license plate. The width and height of the selected positioning area are (w, h), the rectangular coordinates of the positioning area in the original image are represented as Rect (x, y, w, h), and the positioned area is represented as an image floc。
Where w and h denote width and height information of the positioning region, which may be denoted as w ═ m × w, respectively0,h=n*h0As can be seen from the above description, y ═ y0-h,x=x0-α(w-w0) Where α represents the offset of the location area with respect to the center of the license plate.
m is the ratio of the width of the positioning area to the width of the license plate in the positioning area image; n is the ratio of the height of the positioning area to the height of the license plate in the positioning area image; and m and n are obtained by measuring the positioning area images.
Step (2): and preprocessing the image of the preliminary positioning area. Further texture feature analysis is required for the preliminary color localization areas determined in step (1).
The preliminary positioning image is preprocessed by edge information extraction and morphological processing.
The specific process of extracting the edge information is that the positioning image f is firstly processedlocPerforming graying to obtain a grayscale image fgrayRendering a grayscale image f using an edge detection operatorgrayAnd binarizing the edge information.
The edge information extraction can select an edge extraction operator such as a sobel operator, a canny operator or a prewitt operator,
selecting sobel edge detection, selecting detection in two directions because the interference information is not fixed in direction, namely detecting vertical edge and horizontal edge, and recording the calculated edge image as fedge。
Then to the edge image fedgeBinarization processing is carried out to remove part of weak edge information, which is denoted as fbinary. The binary image is beneficial to further analysis and processing of the image, the data volume is reduced, and the outline information of the interested target can be highlighted.
In the image binarization processing, a fixed threshold method and an adaptive threshold method may be used. The fixed threshold method is to manually set a threshold or obtain the threshold through calculation, pixels in the image which are larger than the threshold are represented by 255, and otherwise, the gray value is represented by 0. The fixed threshold calculation method mainly comprises the steps of calculating the average value of image pixels as a threshold, and searching the lowest position of a peak valley between two peaks as the threshold by using a histogram method.
The adaptive threshold method can adopt methods such as a maximum inter-class variance method (OSTU), an iterative method, a local threshold method and the like in the field of image processing to obtain the threshold.
The morphological processing is to perform morphological dilation processing on the obtained binary image to obtain a clearer edge image, and the dilation operation comprises the following steps:
first, a structure element B is used to scan an image fbinaryEach pixel of (2)
Do with binary image of structural element rather than covering and operate
If one element is 0, the result image ftextureIs 0, otherwise is 255.
And (3) calculating a mask image for the preprocessed texture image. The method specifically comprises the steps of carrying out blocking processing on the texture image and obtaining a texture feature mask image taking a block as a unit.
The blocking treatment in the step (3) is specifically as follows: the preprocessed texture image ftextureAnd processing by taking a block as a unit, and calculating the proportion of edge pixels in the preprocessed image in each block. This ratio is compared to a set threshold to divide each block in the scout image into texture blocks and smooth blocks.
The specific blocking treatment process comprises the following steps:
1) texture image f is known from the above stepstextureLet the size of the partition be blk × blk. The image is divided into (w/blk) × (h/blk) blocks, and then each blk × blk block is processed in turn;
2) creating a mask image f corresponding to the texture imagemaskThe mask image has a size of (w/blk) × (h/blk), that is, the number of pixels is the number of mask image blocks. f. ofmaskOne pixel value corresponds to ftextureOne block of (1);
3) calculating texture images f in sequencetextureThe ratio of the number of edge pixel values in each block to the total pixel value blk × blk of the block;
4) judging the ratio to be larger than the set thresholdWhen the ratio is smaller than the set threshold, the texture pixel value in the block is larger, the block is determined as a texture block, and the mask image f is used for determining the texture blockmaskThe pixel value of the corresponding block is set to 0; on the contrary, when the ratio is smaller than the set threshold, the texture pixel value in the block is smaller, the block is judged as a smooth block, and the mask image f is used for maskingmaskThe pixel value of (a) corresponding to the block is set to 255 or other non-zero value to indicate differentiation.
5) When traversing the texture image ftextureWhen all blocks in (1) are in, the mask image f can be obtainedmaskAll pixel values of (a).
Specifically, in the step 4), the threshold value represents a ratio of the texel value in each block to the total number of pixels in the block, and is in a range of 0 to 1, and is selected according to the ratio for distinguishing the texel value in each block to judge whether the block is smooth.
Step (4) positioning image flocThe luminance features are calculated in blocks to update the pixel values in the mask image.
It is obviously not sufficient to consider texture information as a basis for region localization, because the reflection of the vehicle body, large-area shadows, etc., is also smooth on the vehicle body, and the texture is relatively small. However, these effects cause color value changes and distortions, and when these areas are located, the recognition result cannot represent the real body color values.
The influence of the reflection of the vehicle body is that the brightness of the corresponding area is increased, and the saturation of the color is reduced; the shadow mainly affects that the brightness value of the corresponding area is reduced, and the saturation of the color is changed correspondingly. Therefore, the luminance values of the scout image can be calculated to update the feature mask image.
The specific treatment process comprises the following steps:
1) selecting the gray level image f of the positioning image obtained by calculation in the step (2)gray;
2) Will locate the gray level image fgrayPartitioning, wherein the partitioning method is the same as that in the step (3), and the partitioning method is divided into blocks with the size of blk × blk;
3) from the calculated mask image fmaskSelecting a smooth block corresponding to a pixel value of 255 or other non-zero values for operation;
4) calculating the positioning gray image f corresponding to the sliding blockgrayAn average value of pixel values of each block in (a);
5) taking the calculated brightness average value as the block mask image fmaskThe new pixel value of (2).
Traversing all the smooth blocks in the mask image to obtain an updated mask image fmaskI.e. the texture block still has a corresponding pixel value of 0, while the pixel value of the smooth block is the average value of the luminance of the corresponding block.
The step (5) requires statistical calculation of the updated mask image, including calculation of its histogram and processing of the histogram.
The histogram of the mask image is calculated and the processing process is as follows:
1) let fhistAs histogram image, mask image fmaskThe range of the pixel values is 0-255, the pixel values are divided into equal t parts, namely the bin number of the histogram is t, the number of the pixel values falling into t intervals is calculated, fhistIs a vector with t dimension;
2) for the obtained histogram fhistMaking statistics, calculating the number of pixel values falling into each bin and the mask image fmaskThe ratio of the sum of the number of the medium non-zero pixels;
3) and sequencing the t calculated ratios from big to small.
And (6) removing the influence of the interference region according to the statistical information of the mask image, and obtaining the mask image of the final positioning region.
And further processing the sorted result according to the histogram statistical information, and correcting the bin segment with the over-large or under-small occupation ratio so as to reduce the influence of strong light and other interference information as much as possible.
The specific treatment steps are as follows:
1) removing the mask pixel value in the pixel value range corresponding to the smaller bin value, wherein the pixel value distribution of the positioning image is consistent, and the pixel value range corresponding to the smaller bin value is probably interference information, so that the subsequent processing is not involved;
2) if the maximum ratio value after the sorting is judged to be larger than the set threshold value, only the mask pixel values in the pixel value range corresponding to the bin value are reserved, the mask image pixel values in the other ranges are all set to be 0, and the processing of the mask image is finished. If the maximum proportion value is smaller than the set threshold value, turning to the next step;
3) if the maximum value is judged to be positioned in the first bins, the sum of the proportion values corresponding to the first bins is calculated, if the proportion is larger than the sum of all the rest proportions, only the mask image values in the pixel value ranges corresponding to the first bins are reserved, the step can judge that the color of the vehicle is a dark color system, because the maximum proportion value and the proportion values in the first bins occupy most of the dark color system, the corresponding pixel values in the rest bins are all set to be 0, the area with overlarge local pixel values caused by the vehicle body reflection can be removed, and the processing of the mask image is finished. Otherwise, go to the next step;
4) if the maximum value is positioned at the position of the middle several items of bin, and the proportion sum of the middle several items is larger than the proportion sum of the rest positions, only the pixel values of the mask image in the pixel value range corresponding to the middle several items of bin are reserved, and the processing of the mask image is finished. The purpose of this step is to remove the effects of body part area reflections and shadows. Otherwise, go to the next step:
5) if the maximum value is located at the position of the last few terms of bin, and the proportion sum of the last few terms is larger than the proportion sum of the rest positions, only the mask image value in the pixel value range corresponding to the bin position where the maximum value is located and the nearest neighbor bin around the bin position is reserved. This step can remove the effect of partial shadowing on areas with lower gray values.
Practice proves that the reflection of the vehicle body is not easy to remove, so a reflection area is selected to be avoided, and the area affected by the reflection is removed as much as possible through histogram statistical information.
After the processing, the reflection and other interference areas with small occupation ratio can be effectively removed, namely, the pixel values of the mask images corresponding to the interference areas are set to be zero, and only the areas corresponding to the non-zero pixel values in the mask images are reserved to be used as final positioning mask images.
And in the final mask image, the region with the pixel value not being zero is a positioning region for recognizing the color of the vehicle body. A pixel value in the mask image corresponds to a retention state of a block in the scout image.
The effective area positioning image of the vehicle body color identification can be determined by the finally obtained mask image. If the pixel value in the mask image is 0, the corresponding block is represented as an area which does not participate in calculation; if the pixel value is not 0, it indicates that the corresponding block is a valid positioning area.
Claims (8)
1. An effective area positioning method for vehicle body color identification is characterized in that: the method comprises the following steps:
(1) acquiring a vehicle body color identification primary positioning area;
(2) carrying out image preprocessing on the image of the primary positioning area;
(3) calculating a block characteristic mask image for the preprocessed image;
(4) calculating brightness characteristics of the positioning image corresponding to the characteristic mask image, and updating the mask image;
(5) carrying out information statistics on the obtained characteristic mask image;
calculating a histogram of the mask image and processing the histogram;
processing the histogram comprises calculating the ratio of the number of pixels in each bin, and sorting the obtained t ratios;
the histogram of the mask image is calculated and the detailed processing process is as follows:
5-1, setting fhistAs histogram image, mask image fmaskThe range of the pixel values is 0-255, the pixel values are divided into equal t parts, namely the bin number of the histogram is t, the number of the pixel values falling into t intervals is calculated, fhistIs a vector with t dimension;
5-2, histogram f obtained forhistMake statisticsCalculating the number of pixel values falling into each bin and the mask image fmaskThe ratio of the sum of the number of the medium non-zero pixels;
5-3, sorting the t calculated ratios from large to small;
(6) correcting the pixel value of the mask image according to the statistical information of the mask image to obtain a final positioning image;
according to the statistical information of the mask image, removing the influence of the interference area, and obtaining the mask image of the final positioning area;
further processing the sorted result according to the histogram statistical information, and correcting the bin segment with the over-large or under-small occupation ratio so as to reduce the influence of strong light and other interference information as much as possible;
the specific treatment steps are as follows:
6-1, removing the mask pixel value in the pixel value range corresponding to the less-occupied bin value, wherein the positioning image should meet the condition that the pixel value distribution is consistent, and the pixel value range corresponding to the less-occupied bin value is probably interference information, so that the subsequent processing is not involved;
6-2, judging whether the sorted maximum proportion value is larger than a set threshold value, only keeping the mask pixel values in the pixel value range corresponding to the bin value, setting the mask image pixel values in the other ranges to be 0, and finishing the processing of the mask image, wherein the step is to distinguish the range where most pixel values in the mask image are located and remove the influence of the pixel values in other ranges; if the maximum proportion value is smaller than the set threshold value, turning to the next step;
6-3, if the maximum value is judged to be positioned in the first bins, calculating the sum of the proportional values corresponding to the first bins, if the proportion is larger than the sum of all the rest proportional values, only keeping the mask image values in the pixel value ranges corresponding to the first bins, and judging that the color of the vehicle is a dark color system, because the maximum proportional value and the proportional values in the first bins occupy most of the pixel values, setting the corresponding pixel values in the rest bins to be 0, removing the area with overlarge local pixel values caused by vehicle body reflection, and finishing the processing of the mask image; otherwise, go to the next step;
6-4, if the maximum value is positioned at the positions of the middle several items of bins and the proportion sum of the middle several items is larger than the proportion sum of the rest positions, only keeping the pixel values of the mask image in the pixel value range corresponding to the middle several items of bins, and finishing the processing of the mask image; the purpose of the step is to remove the influence of reflection and shadow of the vehicle body part area; otherwise, go to the next step:
6-5, if the maximum value is positioned at the positions of the last bins, and the proportion sums of the last bins are larger than the proportion sum of the rest positions, only keeping the mask image value in the pixel value range corresponding to the bin position where the maximum value is positioned and the nearest neighbor bin around the bin position; this step can remove the effect of partial shadowing on areas with lower gray values.
2. The effective area positioning method for vehicle body color recognition according to claim 1, characterized in that:
in the step (1), acquiring a vehicle body color identification primary positioning area, including acquiring license plate positioning information and a positioning image;
firstly, acquiring position information of a license plate in a whole image, namely rectangular information, including coordinates (x) of the upper left corner of the license plate in the image according to a license plate positioning technology0,y0) Width w of license plate0And height h0;
The step of acquiring the preliminary positioning area specifically comprises the following steps: acquiring a rectangular region above the license plate as a primary positioning region according to the position of the license plate, and setting the width and the height of the region as w and h respectively;
in the step (2), image preprocessing is carried out on the primary positioning area, wherein the image preprocessing comprises texture information extraction and morphological processing;
the texture information extraction specifically comprises the following steps: carrying out graying processing on the preliminary positioning image, calculating the edge characteristics of the preliminary positioning image, and carrying out binarization processing; wherein, the edge feature adopts an edge extraction operator, including a sobel operator, a canny operator or a prewitt operator; the morphological treatment is to adopt a swelling operation to make the edge clearer.
3. The effective area positioning method for vehicle body color recognition according to claim 1, characterized in that:
calculating a characteristic mask image of the processed positioning image in the step (3), namely performing block processing on the processed positioning image to obtain a texture characteristic mask image taking a block as a unit;
the image mask is used for shielding all or part of an image to be processed by using a selected image, graph or object to control the image processing area or processing process; in digital image processing, a mask is a two-dimensional matrix array, sometimes a multi-valued image is used, and a mask image is a two-dimensional matrix and is treated as an image;
in digital image processing, image masks are used to: extracting an interested region, and multiplying a pre-made interested region mask and an image to be processed to obtain an interested region image, wherein the image value in the interested region is kept unchanged, and the image value outside the region is 0; shielding, namely shielding certain areas on the image by using a mask, so that the certain areas do not participate in processing or calculation of processing parameters, or only processing or counting shielded areas; extracting structural features, namely detecting and extracting the structural features similar to the mask in the image by using a similarity variable or image matching method; fourthly, making images with special shapes;
the mask image is used for shielding, and certain areas on the mask image are used for shielding so as not to participate in subsequent calculation;
the blocking processing of the positioning image specifically comprises the following steps: partitioning the processed positioning image, and setting the size of the block as blk + blk, so that the positioning image can be partitioned into a plurality of blocks; processing by taking a block as a unit, calculating the proportion of texture pixels in each block in the block, and dividing the positioning image into texture blocks and smooth blocks according to the relation between the proportion and a threshold value;
creating a corresponding mask image, wherein the state of one block in the positioning image corresponds to one pixel value in the mask image, the size of the obtained mask image is (w/blk, h/blk), if the block in the positioning image is determined to be a smooth block, the corresponding pixel value in the mask image is set to 255 or other non-zero values, and if the texture block is positioned, the pixel value of the corresponding position in the mask image is set to 0, so that the mask image corresponding to the positioning image is obtained; and for the area corresponding to the pixel value of 0 in the mask image, the subsequent identification operation is not involved.
4. The effective area positioning method for vehicle body color recognition according to claim 1, characterized in that:
step (4), calculating brightness characteristics of the primary positioning image corresponding to the characteristic mask image, updating the mask image, calculating the average value of the brightness of the pixels in the block in the positioning image corresponding to the slider, and taking the value as the pixel value of the corresponding block in the mask image to obtain the updated mask image;
step (6), correcting the pixel value of the mask image according to the statistical information of the mask image to obtain a final positioning image, wherein the step of removing an interference area in the preliminary positioning area according to the statistical information comprises a light reflection area; and determining the pixel value of the final mask image according to the statistical information so as to obtain whether the pixel value of the corresponding block in the positioning area image is reserved or not, finally obtaining the pixel value of the corresponding block only containing the condition, and taking the image as the final positioning image.
5. The effective area positioning method for vehicle body color recognition according to claim 1, characterized in that:
in the step (1), it is assumed that the current image containing the vehicle is f, and the license plate position information in the image is Rect (x)0,y0,w0,h0) Respectively representing the rectangular coordinates of the license plate in the original image f, (x)0,y0) Coordinate value, w, representing the top left corner of the license plate in image f0Indicates the width, h, of the license plate0Indicating the height of the license plate; the width and height of the selected positioning area are (w, h), the rectangular coordinates of the positioning area in the original image are represented as Rect (x, y, w, h), and the positioned area is represented as an image floc;
Where w and h denote width and height information of the positioning region, respectively denoted as w ═ m × w0,h=n*h0I.e. y ═ y0-h,x=x0-α(w-w0) Where a represents the offset of the location area with respect to the center of the license plate.
6. The effective area positioning method for vehicle body color recognition according to claim 1, characterized in that:
in the step (2): preprocessing the image of the preliminary positioning area, and performing further texture feature analysis on the preliminary color positioning area determined in the step (1);
preprocessing the preliminary positioning image, including edge information extraction and morphological processing;
the specific process of extracting the edge information is that the positioning image f is firstly processedlocPerforming graying to obtain a grayscale image fgrayRendering a grayscale image f using an edge detection operatorgrayAnd binarizing the edge information;
the edge information extraction adopts edge extraction operators, including a sobel operator, a canny operator or a prewitt operator;
selecting sobel edge detection, selecting detection in two directions because the interference information is not fixed in direction, namely detecting vertical edge and horizontal edge, and recording the calculated edge image as fedge;
Then to the edge image fedgeBinarization processing is carried out to remove part of weak edge information, which is denoted as fbinary(ii) a The binary image is beneficial to further analysis and processing of the image, the data volume is reduced, and the outline information of the interested target can be highlighted; in the image binarization processing, a fixed threshold method and an adaptive threshold method can be used;
a fixed threshold method, in which a threshold is manually set or obtained by calculation, the gray value of the pixel in the image larger than the threshold is represented by 255, otherwise, the gray value is represented by 0; the calculation method of the fixed threshold comprises the steps of calculating the average value of image pixels as the threshold, or using a histogram method to find the lowest position of a peak valley between two peaks as the threshold;
the self-adaptive threshold method adopts a maximum inter-class variance method (OSTU), an iteration method and a local threshold method in the field of image processing to obtain a threshold;
the morphological processing is to perform morphological dilation processing on the obtained binary image to obtain a clearer edge image, and the dilation operation comprises the following steps:
2-1, scanning the image f with the structuring element BbinaryEach of the pixels of (1);
2-2, carrying out OR operation on the structural elements and the binary image covered by the structural elements;
2-3 if one element is 0, the resulting image ftextureIs 0, otherwise is 255.
7. The effective area positioning method for vehicle body color recognition according to claim 1, characterized in that:
the blocking treatment in the step (3) is specifically as follows: the preprocessed texture image ftextureProcessing by taking blocks as units, and calculating the proportion of edge pixels in the preprocessed image in each block; comparing the ratio with a set threshold value, thereby dividing each block in the positioning image into a texture block and a smooth block:
the specific blocking treatment process comprises the following steps:
3-1 texture image f known from the above stepstextureThe size of (d) is (w, h), and the size of the partition is blk × blk; the image is divided into (w/blk) × (h/blk) blocks, and then each blk × blk block is processed in turn;
3-2, creating a mask image f corresponding to the texture imagemaskThe size of the mask image is (w/blk) × (h/blk), that is, the number of pixels is the number of the mask image blocks; f. ofmaskOne pixel value corresponds to ftextureOne block of (1);
3-3, calculating the texture image f in sequencetextureThe ratio of the number of edge pixel values in each block to the total pixel value blk × blk of the block;
3-4, judging the size of the ratio and a set threshold, when the ratio is larger than the set threshold, indicating that the texture pixel value in the block is larger, judging the block as a texture block, and taking the mask image f as a texture blockmaskThe pixel value of the corresponding block is set to 0; on the contrary, when the ratio is smaller than the set threshold, the texture pixel value in the block is smaller, the block is judged as a smooth block, and the mask image f is used for maskingmaskThe pixel value of the corresponding block is set to 255 or other non-zero value to indicate differentiation; the threshold value represents the ratio of the texture pixel value in each block to the total number of pixels of the block, and the range is 0-1, and the threshold value is selected according to the ratio for distinguishing the texture pixel value in each block so as to judge whether the block is smooth or not;
5) when traversing the texture image ftextureWhen all blocks in (1) are in, the mask image f can be obtainedmaskAll pixel values of (a).
8. The effective area positioning method for vehicle body color recognition according to claim 6, characterized in that:
in the step (4), the brightness value of the positioning image is calculated to update the feature mask image, and the specific processing process is as follows:
4-1, selecting the gray level image f of the positioning image obtained by calculation in the step (2)gray;
4-2, positioning the gray level image fgrayPartitioning, wherein the partitioning method is the same as that in the step (3), and the partitioning method is divided into blocks with the size of blk × blk;
4-3, from the determined mask image fmaskSelecting a smooth block corresponding to a pixel value of 255 or other non-zero values for operation;
4-4, calculating the positioning gray level image f corresponding to the sliding blockgrayAn average value of pixel values of each block in (a);
4-5, taking the calculated brightness average value as the block mask image fmaskThe new pixel value of (2);
traversing all the smooth blocks in the mask image to obtain an updated mask image fmaskI.e. the texture block still has a corresponding pixel value of 0, while the pixel value of the smooth block is the average value of the luminance of the corresponding block.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711498902.2A CN108256521B (en) | 2017-12-29 | 2017-12-29 | Effective area positioning method for vehicle body color identification |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711498902.2A CN108256521B (en) | 2017-12-29 | 2017-12-29 | Effective area positioning method for vehicle body color identification |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108256521A CN108256521A (en) | 2018-07-06 |
CN108256521B true CN108256521B (en) | 2021-06-22 |
Family
ID=62724665
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711498902.2A Active CN108256521B (en) | 2017-12-29 | 2017-12-29 | Effective area positioning method for vehicle body color identification |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108256521B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109062484B (en) * | 2018-07-30 | 2022-08-02 | 安徽慧视金瞳科技有限公司 | Manual mask image acquisition method for interactive classroom teaching system |
CN109325421B (en) * | 2018-08-28 | 2021-01-26 | 武汉真元生物数据有限公司 | Eyelash removing method and system based on edge detection |
CN110569864A (en) * | 2018-09-04 | 2019-12-13 | 阿里巴巴集团控股有限公司 | vehicle loss image generation method and device based on GAN network |
CN109801249A (en) * | 2018-12-27 | 2019-05-24 | 深圳豪客互联网有限公司 | Image interfusion method, device, computer equipment and storage medium |
JP7383722B2 (en) * | 2019-03-22 | 2023-11-20 | ビーエーエスエフ コーティングス ゲゼルシャフト ミット ベシュレンクテル ハフツング | Method and system for defect detection in image data of target coatings |
CN113139409B (en) * | 2020-01-20 | 2023-06-16 | 浙江宇视科技有限公司 | Vehicle identification method, device, equipment and storage medium |
CN112348103B (en) * | 2020-11-16 | 2022-11-11 | 南开大学 | Image block classification method and device and super-resolution reconstruction method and device thereof |
CN114140382B (en) * | 2021-10-22 | 2022-07-29 | 珠海视熙科技有限公司 | Screen area detection method and device and storage medium |
CN113795071B (en) * | 2021-11-11 | 2022-03-08 | 珠海视熙科技有限公司 | Atmosphere lamp control method and device and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102184413A (en) * | 2011-05-16 | 2011-09-14 | 浙江大华技术股份有限公司 | Automatic vehicle body color recognition method of intelligent vehicle monitoring system |
JP2012238244A (en) * | 2011-05-12 | 2012-12-06 | Fuji Heavy Ind Ltd | Environment recognition device and environment recognition method |
CN106384117A (en) * | 2016-09-14 | 2017-02-08 | 东软集团股份有限公司 | Vehicle color recognition method and device |
CN106529553A (en) * | 2016-10-27 | 2017-03-22 | 深圳市捷顺科技实业股份有限公司 | Vehicle body color recognition region positioning method and device |
CN106599869A (en) * | 2016-12-22 | 2017-04-26 | 安徽大学 | Vehicle attribute identification method based on multi-task convolutional neural network |
CN106650611A (en) * | 2016-10-27 | 2017-05-10 | 深圳市捷顺科技实业股份有限公司 | Method and apparatus for recognizing color of vehicle body |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130101211A1 (en) * | 2010-08-19 | 2013-04-25 | Aisin Seiki Kabushiki Kaisha | Target location determination device |
-
2017
- 2017-12-29 CN CN201711498902.2A patent/CN108256521B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012238244A (en) * | 2011-05-12 | 2012-12-06 | Fuji Heavy Ind Ltd | Environment recognition device and environment recognition method |
CN102184413A (en) * | 2011-05-16 | 2011-09-14 | 浙江大华技术股份有限公司 | Automatic vehicle body color recognition method of intelligent vehicle monitoring system |
CN106384117A (en) * | 2016-09-14 | 2017-02-08 | 东软集团股份有限公司 | Vehicle color recognition method and device |
CN106529553A (en) * | 2016-10-27 | 2017-03-22 | 深圳市捷顺科技实业股份有限公司 | Vehicle body color recognition region positioning method and device |
CN106650611A (en) * | 2016-10-27 | 2017-05-10 | 深圳市捷顺科技实业股份有限公司 | Method and apparatus for recognizing color of vehicle body |
CN106599869A (en) * | 2016-12-22 | 2017-04-26 | 安徽大学 | Vehicle attribute identification method based on multi-task convolutional neural network |
Non-Patent Citations (2)
Title |
---|
Vehicle color recognition using monocular camera;Mengjie Yang等;《2011 International Conference on Wireless Communications and Signal Processing (WCSP)》;20111208;全文 * |
一种高效的车辆颜色识别方法;肖驰;《现代计算机(专业版)》;20170615;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN108256521A (en) | 2018-07-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108256521B (en) | Effective area positioning method for vehicle body color identification | |
CN111310558B (en) | Intelligent pavement disease extraction method based on deep learning and image processing method | |
CN111145161B (en) | Pavement crack digital image processing and identifying method | |
CN109886896B (en) | Blue license plate segmentation and correction method | |
CN106709436B (en) | Track traffic panoramic monitoring-oriented cross-camera suspicious pedestrian target tracking system | |
TWI409718B (en) | Method of locating license plate of moving vehicle | |
CN108564814B (en) | Image-based parking lot parking space detection method and device | |
US7639878B2 (en) | Shadow detection in images | |
CN109784344A (en) | A kind of non-targeted filtering method of image for ground level mark identification | |
CN107784669A (en) | A kind of method that hot spot extraction and its barycenter determine | |
CN110414355A (en) | The right bit sky parking stall of view-based access control model and parking stall line detecting method during parking | |
KR101182173B1 (en) | Method and system for recognizing vehicle plate | |
CN110033431B (en) | Non-contact detection device and detection method for detecting corrosion area on surface of steel bridge | |
CN115115612B (en) | Surface defect detection method and system for mechanical parts | |
CN107895151A (en) | Method for detecting lane lines based on machine vision under a kind of high light conditions | |
CN110674812B (en) | Civil license plate positioning and character segmentation method facing complex background | |
Chang et al. | An efficient method for lane-mark extraction in complex conditions | |
CN115661110B (en) | Transparent workpiece identification and positioning method | |
CN110705553B (en) | Scratch detection method suitable for vehicle distant view image | |
CN115841633A (en) | Power tower and power line associated correction power tower and power line detection method | |
KR101026778B1 (en) | Vehicle image detection apparatus | |
CN114018946B (en) | OpenCV-based high-reflectivity bottle cap defect detection method | |
CN111476804A (en) | Method, device and equipment for efficiently segmenting carrier roller image and storage medium | |
Vargas et al. | A shadow removal algorithm for vehicle detection based on reflectance ratio and edge density | |
TWI498830B (en) | A method and system for license plate recognition under non-uniform illumination |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |