CN108629227B - Method and system for determining left and right boundaries of vehicle in image - Google Patents

Method and system for determining left and right boundaries of vehicle in image Download PDF

Info

Publication number
CN108629227B
CN108629227B CN201710154586.0A CN201710154586A CN108629227B CN 108629227 B CN108629227 B CN 108629227B CN 201710154586 A CN201710154586 A CN 201710154586A CN 108629227 B CN108629227 B CN 108629227B
Authority
CN
China
Prior art keywords
vehicle
coordinate
boundary
determining
image
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
Application number
CN201710154586.0A
Other languages
Chinese (zh)
Other versions
CN108629227A (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.)
Zongmu Technology Shanghai Co Ltd
Original Assignee
Zongmu Technology Shanghai Co Ltd
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 Zongmu Technology Shanghai Co Ltd filed Critical Zongmu Technology Shanghai Co Ltd
Priority to CN201710154586.0A priority Critical patent/CN108629227B/en
Publication of CN108629227A publication Critical patent/CN108629227A/en
Application granted granted Critical
Publication of CN108629227B publication Critical patent/CN108629227B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/56Context or environment of the image exterior to a vehicle by using sensors mounted on the vehicle
    • G06V20/58Recognition of moving objects or obstacles, e.g. vehicles or pedestrians; Recognition of traffic objects, e.g. traffic signs, traffic lights or roads
    • G06V20/584Recognition of moving objects or obstacles, e.g. vehicles or pedestrians; Recognition of traffic objects, e.g. traffic signs, traffic lights or roads of vehicle lights or traffic lights
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20224Image subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30248Vehicle exterior or interior
    • G06T2207/30252Vehicle exterior; Vicinity of vehicle
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/08Detecting or categorising vehicles

Abstract

The invention provides a method and a system for determining left and right boundaries of a vehicle in an image, after relatively accurate vehicle bottom edge information in the image is obtained, the vertical gradient in an extended area of the vehicle bottom edge is projected to the horizontal direction, and candidate areas of the left and right boundaries of the vehicle are worked out by utilizing the peak value change characteristics of the vertical gradient, so that the calculation amount is small, the reliability is high, and the boundary information of the coordinates of the vehicle can be relatively quickly and accurately obtained; and then, according to the characteristic that the contrast of the light and shade of the pixels of the left and right boundary candidate coordinates of the vehicle is obvious twice, respectively carrying out difference on the left and right regions to obtain the contrast by utilizing the fact that the right partial region of the left boundary is a wheel or other shadow region and the left partial region of the right boundary is a wheel or other shadow region, and evaluating the coordinates of the left and right boundaries by using the contrast, so that the left and right boundaries of the vehicle in the image are selected, and the method is simple, clear and high in stability.

Description

Method and system for determining left and right boundaries of vehicle in image
Technical Field
The present invention relates to the field of image processing, and more particularly, to a method and system for determining left and right boundaries of a vehicle in an image.
Background
Currently, vehicle detection is one of the important items in the research field of automatic driving. In the conventional vehicle detection, a candidate region of a target vehicle in an image is obtained by a sliding window method or a saliency analysis method, and then a classifier is used for judging whether the candidate region is a candidate region or not. There are other methods, such as the edgebox algorithm, which adopt the merging and separation of candidate regions, and finally obtain the candidate region of the target vehicle in the image, and then send the candidate region to the subsequent classifier for determination of yes or no.
However, none of these methods is very accurate in determining the vehicle boundaries, since the "sliding window" or merging and separating of candidate regions, etc. is based on a certain step size or criterion. These steps or criteria are difficult to cover to vehicle targets at various angles throughout the scene, so that the determined boundaries are often difficult to reach to a sufficiently accurate degree.
Disclosure of Invention
In view of the above-mentioned shortcomings of the prior art, the present invention aims to provide a method and a system for determining left and right boundaries of a vehicle in an image, which are used for solving the problem that it is difficult to accurately determine the boundaries of the vehicle in the image in the prior art.
To achieve the above and other related objects, the present invention provides a method of determining left and right boundaries of a vehicle in an image, comprising: drawing at least one square area with the bottom side of at least one vehicle as a side length according to coordinates of the bottom side of the at least one vehicle which are determined in advance, and taking the at least one square area as at least one square candidate area of the vehicle; wherein the left boundary of the vehicle is located in a left half of the square candidate region and the right boundary of the vehicle is located in a right half of the square candidate region; performing boundary inspection on the at least one square candidate region, and removing the square candidate regions which do not meet the conditions; for each square candidate region meeting the conditions, adjusting the vehicle bottom edge of the square candidate region, so that the adjusted vehicle bottom edge and the vehicle bottom edge before adjustment form an interested region; judging whether the width of each region of interest is not greater than a preset width value or not; if so, solving a vertical gradient value of a region corresponding to the region of interest in the image; if not, obtaining a vertical gradient value of a region corresponding to the region of interest from the sampled image of the image; calculating absolute values of the vertical gradient values, and projecting the absolute values to the horizontal direction; acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction, and determining the coordinate as a first left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a first right boundary candidate coordinate; setting the projection of each maximum absolute value in the horizontal direction to zero; then, in the left half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second right boundary candidate coordinate; judging whether the length of the bottom edge of the vehicle of each square candidate area meeting the conditions is larger than a preset length value or not; if not, respectively calculating a first credibility score of the first left boundary candidate coordinate and a second credibility score of the second left boundary candidate coordinate, and taking the left boundary candidate coordinate corresponding to the maximum first credibility score and the second credibility score as the left boundary coordinate; and respectively calculating a third credibility score of the first right boundary candidate coordinate and a fourth credibility score of the second right boundary candidate coordinate, and taking the right boundary candidate coordinate corresponding to the minimum of the third credibility score and the fourth credibility score as the right boundary coordinate.
In an embodiment of the present invention, the calculating a first confidence score of the first left boundary candidate coordinate and a second confidence score of the second left boundary candidate coordinate respectively includes: respectively determining a first temporary square area with a first temporary bottom edge as a side length of a first rectangular area and a second rectangular area formed by a preset width and a preset height on the left side and the right side of the first left boundary candidate coordinate, obtaining a second temporary square area with a preset second temporary bottom edge as a side length on the right side of the first left boundary candidate coordinate, respectively performing difference on pixel values of corresponding points in the first temporary square area and the second temporary square area, and then adding and summing results of the difference, wherein the results are used as a first reliability score of the first left boundary candidate coordinate; determining and acquiring a third temporary square rectangular area and a fourth rectangular area which take a first temporary bottom edge formed by the width and the height as a side length on the left side and the right side of the second left boundary candidate coordinate respectively, acquiring a fourth temporary square area which takes the second temporary bottom edge as the side length on the right side of the second left boundary candidate coordinate in the third rectangular area and the fourth rectangular area, respectively subtracting pixel values of points corresponding to the third temporary square area and the fourth temporary square area, and then adding and summing the subtraction results to obtain a second credibility score of the second left boundary candidate coordinate.
In an embodiment of the present invention, the calculating a third confidence score of the first right boundary candidate coordinate and a fourth confidence score of the second right boundary candidate coordinate respectively includes: determining a fifth rectangular area and a sixth rectangular area which are formed by preset width and height on the left side and the right side of the first right boundary candidate coordinate respectively to obtain a fifth temporary square area with the first temporary bottom edge as the side length, obtaining a sixth temporary square area with the second temporary bottom edge as the side length on the right side of the first right boundary candidate coordinate, respectively subtracting the pixel values of corresponding points in the fifth temporary square area and the sixth temporary square area, and then adding and summing the subtraction results to obtain a third fractional confidence level of the first right boundary candidate coordinate; determining a seventh temporary square rectangular area and an eighth rectangular area which are formed by the width and the height and are obtained by taking the first temporary bottom edge as the side length on the left side and the right side of the second right boundary candidate coordinate respectively, obtaining an eighth temporary square area by taking the second temporary bottom edge as the side length on the right side of the second right boundary candidate coordinate, respectively subtracting the pixel values of corresponding points in the seventh temporary square area and the eighth temporary square area, and then adding and summing the subtraction results to obtain a fourth credibility score of the second right boundary candidate coordinate.
In an embodiment of the present invention, the preset widths are: 1/5 of the bottom edge of the vehicle; the preset height is as follows: 1/3 at the bottom edge of the vehicle.
In an embodiment of the present invention, the method further includes: and determining the integral boundary of the vehicle according to the vehicle bottom edge coordinates of the vehicle and the determined left and right boundary coordinates, thereby realizing the image segmentation of the vehicle target.
In an embodiment of the present invention, the adjusting the bottom edge of the vehicle in the square candidate area includes: and enabling the bottom edge of the vehicle to float upwards and expand leftwards and rightwards.
In an embodiment of the present invention, the preset width value is: a minimum width value of the vehicle can be resolved in a sample image of the image.
In an embodiment of the present invention, the vertical gradient values are: vertical sobel gradient values.
To achieve the above and other related objects, the present invention provides a system for determining left and right boundaries of a vehicle in an image, comprising: the candidate region generation module is used for drawing at least one square region with the bottom side of at least one vehicle as the side length according to the coordinates of the bottom side of at least one vehicle which is determined in advance, and the square region is used as at least one square candidate region of the vehicle; wherein the left boundary of the vehicle is located in a left half of the square candidate region and the right boundary of the vehicle is located in a right half of the square candidate region; the boundary checking module is used for carrying out boundary checking on the at least one square candidate region and removing the square candidate regions which do not meet the conditions; the interesting region generating module is used for adjusting the vehicle bottom edge of each square candidate region according with the condition so that the adjusted vehicle bottom edge and the vehicle bottom edge before adjustment form an interesting region; the gradient value calculation module is used for judging whether the width of each region of interest is not greater than a preset width value or not; if so, solving a vertical gradient value of a region corresponding to the region of interest in the image; if not, obtaining a vertical gradient value of a region corresponding to the region of interest from the sampled image of the image; calculating absolute values of the vertical gradient values, and projecting the absolute values to the horizontal direction; the candidate coordinate generating module is used for acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction and determining the coordinate as a first left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a first right boundary candidate coordinate; setting the projection of each maximum absolute value in the horizontal direction to zero; then, in the left half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second right boundary candidate coordinate; the boundary coordinate determination module is used for judging whether the length of the bottom edge of the vehicle of each square candidate area meeting the conditions is larger than a preset length value or not; if not, respectively calculating a first credibility score of the first left boundary candidate coordinate and a second credibility score of the second left boundary candidate coordinate, and taking the left boundary candidate coordinate corresponding to the maximum first credibility score and the second credibility score as the left boundary coordinate; and respectively calculating a third credibility score of the first right boundary candidate coordinate and a fourth credibility score of the second right boundary candidate coordinate, and taking the right boundary candidate coordinate corresponding to the minimum of the third credibility score and the fourth credibility score as the right boundary coordinate.
In an embodiment of the present invention, the calculating a first confidence score of the first left boundary candidate coordinate and a second confidence score of the second left boundary candidate coordinate respectively includes: respectively determining a first temporary square area with a first temporary bottom edge as a side length of a first rectangular area and a second rectangular area formed by a preset width and a preset height on the left side and the right side of the first left boundary candidate coordinate, obtaining a second temporary square area with a preset second temporary bottom edge as a side length on the right side of the first left boundary candidate coordinate, respectively performing difference on pixel values of corresponding points in the first temporary square area and the second temporary square area, and then adding and summing results of the difference, wherein the results are used as a first reliability score of the first left boundary candidate coordinate; determining and acquiring a third temporary square rectangular area and a fourth rectangular area which take a first temporary bottom edge formed by the width and the height as a side length on the left side and the right side of the second left boundary candidate coordinate respectively, acquiring a fourth temporary square area which takes the second temporary bottom edge as the side length on the right side of the second left boundary candidate coordinate in the third rectangular area and the fourth rectangular area, respectively subtracting pixel values of points corresponding to the third temporary square area and the fourth temporary square area, and then adding and summing the subtraction results to obtain a second credibility score of the second left boundary candidate coordinate.
In an embodiment of the present invention, the calculating a third confidence score of the first right boundary candidate coordinate and a fourth confidence score of the second right boundary candidate coordinate respectively includes: determining a fifth rectangular area and a sixth rectangular area which are formed by preset width and height on the left side and the right side of the first right boundary candidate coordinate respectively to obtain a fifth temporary square area with the first temporary bottom edge as the side length, obtaining a sixth temporary square area with the second temporary bottom edge as the side length on the right side of the first right boundary candidate coordinate, respectively subtracting the pixel values of corresponding points in the fifth temporary square area and the sixth temporary square area, and then adding and summing the subtraction results to obtain a third fractional confidence level of the first right boundary candidate coordinate; determining a seventh temporary square rectangular area and an eighth rectangular area which are formed by the width and the height and are obtained by taking the first temporary bottom edge as the side length on the left side and the right side of the second right boundary candidate coordinate respectively, obtaining an eighth temporary square area by taking the second temporary bottom edge as the side length on the right side of the second right boundary candidate coordinate, respectively subtracting the pixel values of corresponding points in the seventh temporary square area and the eighth temporary square area, and then adding and summing the subtraction results to obtain a fourth credibility score of the second right boundary candidate coordinate.
In an embodiment of the present invention, the manner of presetting the bottom edge of the first temporary vehicle includes: the preset width is as follows: 1/5 of the bottom edge of the vehicle; the preset height is as follows: 1/3 at the bottom edge of the vehicle.
In an embodiment of the present invention, the system further includes: and the target image segmentation module is used for determining the integral boundary of the vehicle according to the vehicle bottom edge coordinates of the vehicle and the determined left and right boundary coordinates, so that the image segmentation of the vehicle target is realized.
In an embodiment of the present invention, the adjusting the bottom edge of the vehicle in the square candidate area includes: and enabling the bottom edge of the vehicle to float upwards and expand leftwards and rightwards.
In an embodiment of the present invention, the preset width value is: a minimum width value of the vehicle can be resolved in a sample image of the image.
In an embodiment of the present invention, the vertical gradient values are: vertical sobel gradient values.
As mentioned above, the method and system for determining the left and right boundaries of the vehicle in the image of the invention can obtain the relatively accurate information of the bottom edge of the vehicle in the image, and then calculate the candidate regions of the left and right boundaries of the vehicle according to the projection of the vertical direction gradient in the extended region of the bottom edge of the vehicle in the horizontal direction and the peak value change characteristics thereof, and the method has small calculation amount and high reliability, and can relatively quickly and accurately obtain the boundary information of the coordinates of the vehicle; and then, according to the characteristic that the contrast of the light and shade of the pixels of the left and right boundary candidate coordinates of the vehicle is obvious twice, respectively carrying out difference on the left and right regions to obtain the contrast by utilizing the fact that the right partial region of the left boundary is a wheel or other shadow region and the left partial region of the right boundary is a wheel or other shadow region, and evaluating the coordinates of the left and right boundaries by using the contrast, so that the left and right boundaries of the vehicle in the image are selected, and the method is simple, clear and high in stability.
Drawings
FIG. 1 is a flow chart illustrating a method for determining left and right boundaries of a vehicle in an image according to an embodiment of the present invention.
FIG. 2 is a block diagram of a system for determining left and right boundaries of a vehicle in an image, according to an embodiment of the present invention.
Description of the element reference numerals
System for determining left and right boundaries of vehicle in image
201 candidate region generation module
202 boundary checking module
203 region of interest generation module
204 gradient value calculating module
205 candidate coordinate generating module
206 boundary coordinate determination module
S101 to S111
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the components related to the present invention are only shown in the drawings rather than drawn according to the number, shape and size of the components in actual implementation, and the type, quantity and proportion of the components in actual implementation may be changed freely, and the layout of the components may be more complicated.
Referring to fig. 1, the present invention provides a method for determining left and right boundaries of a vehicle in an image, comprising the steps of:
step S101: according to the coordinates of at least one vehicle bottom edge which is determined in advance, at least one square area (square area) with the at least one vehicle bottom edge as a side length is drawn to serve as at least one square candidate area of the vehicle. It is worth noting that the method is performed with a certain degree of accuracy of predefined vehicle bottom edges, and that the state of such bottom edges displayed in the image should be straight, rather than diagonal. In particular, the left and right boundaries, which are the two sides of the default vehicle, are within the left and right halves of the candidate area, respectively, namely: the left boundary of the vehicle is located in the left half of the square candidate region and the right boundary of the vehicle is located in the right half of the square candidate region.
Step S102: and carrying out boundary check on the at least one square candidate region, and removing the square candidate regions which do not meet the conditions. For example: and eliminating the square candidate area with low correlation degree by setting a threshold condition.
Step S103: for each eligible square candidate region, adjusting the vehicle bottom side of the square candidate region, for example: and floating, expanding left and right and the like the bottom edge of the vehicle, so that the adjusted bottom edge of the vehicle and the bottom edge of the vehicle before adjustment form an interested area. In detail, the region of interest is a rectangular region formed by the expanded vehicle bottom side being wide and the distance between the two vehicle bottom sides before and after adjustment being high.
Step S104: and judging whether the width of each region of interest is not larger than a preset width value or not, wherein the preset width value is the minimum width value capable of distinguishing the vehicle in a sampling image of the image. The sample image is an image obtained by sampling the original image by a predetermined multiple, for example: the resolution of the original image is 1024 × 512, and the resolution of the sample image obtained after 2-fold sampling is 512 × 256. If the determination result in this step is yes, go to step S105; otherwise, step S106 is executed.
Step S105: the region of interest is mapped back into an image, where vertical gradient values (e.g., sobel gradient values in the vertical direction) of the region corresponding to the region of interest are found.
Step S106: and (3) obtaining a vertical gradient value (for example, a sobel gradient value in a vertical direction) of a region corresponding to the interested region in the sampling image of the image. Then, each of the vertical gradient values is projected to the horizontal direction, and preferably, an absolute value of each of the vertical gradient values is calculated first, and then each of the absolute values is projected to the horizontal direction.
Step S107: acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction, and determining the coordinate as a first left boundary candidate coordinate; and acquiring the coordinate corresponding to the maximum absolute value in the right half region in the horizontal direction, and determining the coordinate as a first right boundary candidate coordinate.
Step S108: the projection of the respective largest absolute values in the horizontal direction is set to zero.
Step S109: acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction, and determining the coordinate as a second left boundary candidate coordinate; and acquiring the coordinate corresponding to the maximum absolute value in the right half region in the horizontal direction, and determining the coordinate as a second right boundary candidate coordinate.
Step S110: and judging whether the length of the bottom edge of the vehicle of each square candidate area meeting the condition is greater than a preset length value, and if the judgment result is negative, executing the step S111.
Step S111: taking 1/5 of the bottom edge of the vehicle as a width and 1/3 of the bottom edge of the vehicle as a height, respectively determining a first rectangular area (which should be positioned on the left side of a left wheel of the vehicle and is higher than a pixel value of the wheel) and a second rectangular area (which should be a partial area of the wheel, is nearly black and is lower than the pixel value) formed by the width and the height on the left side and the right side of the candidate coordinate of the first left boundary, respectively performing difference on the pixel values of corresponding points in the two areas, and then adding and summing the results of the difference to obtain a first fractional confidence degree of the candidate coordinate of the first left boundary; similarly, taking 1/5 of the bottom side of the vehicle as a width and 1/3 of the bottom side of the vehicle as a height, determining a third rectangular region (which should be located on the left side of the left wheel of the vehicle and is higher than the pixel value of the wheel) and a fourth rectangular region (which should be a partial region of the wheel, near black, and is lower in pixel value) formed by the width and the height on the left side and the right side of the second left boundary candidate coordinate, respectively, and subtracting the pixel values of corresponding points in the third rectangular region and the fourth rectangular region, respectively, and then adding and summing the results of the subtracted pixel values to obtain a second confidence score of the second left boundary candidate coordinate; taking the left boundary candidate coordinate corresponding to the maximum first and second credibility scores as a left boundary coordinate;
correspondingly, taking 1/5 of the bottom edge of the vehicle as the width and 1/3 of the bottom edge of the vehicle as the height, respectively determining a fifth rectangular area (which should be a partial area of a wheel, is nearly black, and has a low pixel value) and a sixth rectangular area (which should be located on the right side of the right wheel of the vehicle and has a high pixel value) formed by the width and the height on the left side and the right side of the first right boundary candidate coordinate, respectively performing difference on the pixel values of corresponding points in the two areas, and then adding and summing the difference results to obtain a third confidence score of the first right boundary candidate coordinate; similarly, taking 1/5 of the bottom side of the vehicle as a width and 1/3 of the bottom side of the vehicle as a height, determining a seventh rectangular region (which should be a partial region of a wheel, near black, with a low pixel value) and an eighth rectangular region (which should be located on the right side of the right wheel of the vehicle, with a high pixel value) formed with the width and the height on the left side and the right side of the second right boundary candidate coordinate, respectively, subtracting the pixel values of corresponding points in the seventh rectangular region and the eighth rectangular region, respectively, and then summing the results of the respective subtraction to obtain a fourth confidence score of the second right boundary candidate coordinate; and taking the right boundary candidate coordinate corresponding to the minimum (maximum absolute value) in the third and fourth credibility scores as the right boundary coordinate.
Note that, the above: taking 1/5 on the bottom side of the vehicle as the width and 1/3 on the bottom side of the vehicle as the height, the first, second, third, fourth, fifth, sixth, seventh and eighth rectangular candidate regions are formed, which is only a preferable implementation manner, and the specific size ratio definition can be preset according to actual conditions. Further, the above-described "correspondence" of the corresponding points refers to positions in the matrix, for example: the first rectangular area and the second rectangular area are respectively 2 × 2 matrixes, each element in the matrixes has a pixel value, then a point corresponding to a11 is b11, a point corresponding to a12 is b12, a point corresponding to a21 is b21, a point corresponding to a22 is b22, the pixel values of the corresponding points are subjected to difference to obtain 4 difference values, and the 4 difference values are added and summed to obtain the reliability score.
After the final left and right boundary coordinates are determined, the overall boundary of the vehicle in the final image can be obtained according to the vehicle bottom edge coordinates of the vehicle, and therefore image segmentation of the vehicle target is achieved.
Referring to fig. 2, the present invention also provides a system 2 for determining left and right boundaries of a vehicle in an image, similar to the principle of the above-described embodiment of the method. Since the technical features in the foregoing method embodiments can be applied to this system embodiment, they are not repeated.
The system 2 mainly comprises: the candidate region generation module 201, the boundary check module 202, the region of interest generation module 203, the gradient value calculation module 204, the candidate coordinate generation module 205, and the boundary coordinate determination module 206, and may further include: a target image segmentation module (not shown). The functions implemented by the various modules will be described in detail below:
the candidate region generation module 201: drawing at least one square area with the bottom side of at least one vehicle as a side length according to coordinates of the bottom side of the at least one vehicle which are determined in advance, and taking the at least one square area as at least one square candidate area of the vehicle; wherein the left boundary of the vehicle is located in a left half of the square candidate region and the right boundary of the vehicle is located in a right half of the square candidate region.
The boundary check module 202: and carrying out boundary check on the at least one square candidate region, and removing the square candidate regions which do not meet the conditions.
Region of interest generation module 203: and for each square candidate area meeting the conditions, adjusting the vehicle bottom edge of the square candidate area (such as floating up and expanding the vehicle bottom edge leftwards and rightwards) so that the adjusted vehicle bottom edge and the vehicle bottom edge before adjustment form an interested area.
Gradient value calculation module 204: for each region of interest, determining whether the width of the region of interest is not greater than a preset width value (e.g., a minimum width value that allows the vehicle to be resolved in a sample image of the image); if so, solving a vertical gradient value of a region corresponding to the region of interest in the image; if not, obtaining a vertical gradient value of a region corresponding to the region of interest from the sampled image of the image; optionally, the absolute value of each vertical gradient value is calculated first, and then each absolute value is projected to the horizontal direction.
The candidate coordinate generation module 205: acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction, and determining the coordinate as a first left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a first right boundary candidate coordinate; setting the projection of each maximum absolute value in the horizontal direction to zero; then, in the left half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second left boundary candidate coordinate; and acquiring the coordinate corresponding to the maximum absolute value in the right half region in the horizontal direction, and determining the coordinate as a second right boundary candidate coordinate.
Boundary coordinate determination module 206: judging whether the length of the bottom edge of the vehicle of each square candidate area meeting the conditions is larger than a preset length value or not; if yes, respectively calculating a first confidence score of the first left boundary candidate coordinate and a second confidence score of the second left boundary candidate coordinate, for example: respectively determining a first temporary square area with a first temporary bottom edge as a side length of a first rectangular area and a second rectangular area formed by a preset width and a preset height on the left side and the right side of the first left boundary candidate coordinate, obtaining a second temporary square area with a preset second temporary bottom edge as a side length on the right side of the first left boundary candidate coordinate, respectively performing difference on pixel values of corresponding points in the first temporary square area and the second temporary square area, and then adding and summing results of the difference, wherein the results are used as a first reliability score of the first left boundary candidate coordinate; determining and acquiring a third temporary square rectangular area and a fourth rectangular area which are formed by the width and the height and take a first temporary bottom edge as a side length on the left side and the right side of the second left boundary candidate coordinate respectively, and acquiring a fourth temporary square area which is formed by the second temporary bottom edge as a side length on the right side of the second left boundary candidate coordinate in the third rectangular area and the fourth rectangular area; respectively subtracting the pixel values of the points corresponding to the third temporary square area and the fourth temporary square area, then adding and summing the subtraction results to obtain a second confidence score of the second left boundary candidate coordinate, and taking the left boundary candidate coordinate corresponding to the maximum of the first confidence score and the second confidence score as the left boundary coordinate; and calculating a third confidence score of the first right boundary candidate coordinate and a fourth confidence score of the second right boundary candidate coordinate, respectively, for example: determining a fifth rectangular area and a sixth rectangular area which are formed by preset width and height on the left side and the right side of the first right boundary candidate coordinate respectively to obtain a fifth temporary square area with the first temporary bottom edge as the side length, obtaining a sixth temporary square area with the second temporary bottom edge as the side length on the right side of the first right boundary candidate coordinate, respectively subtracting the pixel values of corresponding points in the fifth temporary square area and the sixth temporary square area, and then adding and summing the subtraction results to obtain a third fractional confidence level of the first right boundary candidate coordinate; determining a seventh temporary square rectangular area and an eighth rectangular area which are formed by the width and the height and are obtained by taking the first temporary bottom edge as a side length on the left side and the right side of the second right boundary candidate coordinate respectively, obtaining an eighth temporary square area which is formed by the second right boundary candidate coordinate and is obtained by taking the second temporary bottom edge as a side length on the right side of the second right boundary candidate coordinate, respectively subtracting the pixel values of the corresponding points in the seventh temporary square area and the eighth temporary square area, then adding and summing the subtraction results to obtain a fourth confidence score of the second right boundary candidate coordinate, and taking the right boundary candidate coordinate corresponding to the smallest (largest absolute value) of the third confidence score and the fourth confidence score as the right boundary coordinate.
In one embodiment, the predetermined width is 1/5 of the bottom edge of the vehicle; the preset height is taken at 1/3 at the bottom edge of the vehicle.
When the system 2 further comprises: and when the target image segmentation module is used, the target image segmentation module determines the integral boundary of the vehicle according to the vehicle bottom edge coordinates of the vehicle and the determined left and right boundary coordinates, so that the image segmentation of the vehicle target is realized.
In summary, according to the method and system for determining the left and right boundaries of the vehicle in the image, the coordinates of the candidate boundaries are obtained by adopting different image materials based on the bottom edges of the vehicles with different scales, the candidate regions of the boundaries are obtained by utilizing the projection of the absolute value of the vertical gradient in the horizontal direction, and the candidate coordinates of the left and right boundaries are determined by obtaining the maximum value twice; finally, the characteristic that pixels in a certain range at two sides of the left and right boundary candidate coordinates are strongly contrasted is utilized to select the left and right boundary coordinates, so that the left and right boundaries of the vehicle are determined, various defects in the prior art are effectively overcome, and the method has high industrial utilization value.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.

Claims (16)

1. A method of determining left and right boundaries of a vehicle in an image, comprising:
drawing at least one square area with the bottom side of at least one vehicle as a side length according to coordinates of the bottom side of the at least one vehicle which are determined in advance, and taking the at least one square area as at least one square candidate area of the vehicle; wherein the left boundary of the vehicle is located in a left half of the square candidate region and the right boundary of the vehicle is located in a right half of the square candidate region;
performing boundary inspection on the at least one square candidate region, and removing the square candidate regions which do not meet the conditions;
for each square candidate region meeting the conditions, adjusting the vehicle bottom edge of the square candidate region to enable the adjusted vehicle bottom edge and the vehicle bottom edge before adjustment to form an interested region;
judging whether the width of each region of interest is not greater than a preset width value or not;
if so, solving a vertical gradient value of a region corresponding to the region of interest in the image;
if not, obtaining a vertical gradient value of a region corresponding to the region of interest from the sampled image of the image;
calculating absolute values of the vertical gradient values, and projecting the absolute values to the horizontal direction;
acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction, and determining the coordinate as a first left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a first right boundary candidate coordinate;
setting the projection of each maximum absolute value in the horizontal direction to zero; subsequently, the process of the present invention,
acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction, and determining the coordinate as a second left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second right boundary candidate coordinate;
judging whether the length of the bottom edge of the vehicle of each square candidate area meeting the conditions is larger than a preset length value or not;
if not, respectively calculating a first credibility score of the first left boundary candidate coordinate and a second credibility score of the second left boundary candidate coordinate, and taking the left boundary candidate coordinate corresponding to the maximum first credibility score and the second credibility score as the left boundary coordinate; and respectively calculating a third credibility score of the first right boundary candidate coordinate and a fourth credibility score of the second right boundary candidate coordinate, and taking the right boundary candidate coordinate corresponding to the minimum of the third credibility score and the fourth credibility score as the right boundary coordinate.
2. The method for determining a left-right boundary of a vehicle in an image according to claim 1, wherein said calculating a first confidence score for the first left boundary candidate coordinate and a second confidence score for the second left boundary candidate coordinate respectively comprises:
determining a first rectangular area and a second rectangular area which are formed by preset width and height on the left side and the right side of the first left boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the first rectangular area and the second rectangular area respectively, and then adding and summing results of the difference to obtain a first credibility score of the first left boundary candidate coordinate;
and determining a third rectangular area and a fourth rectangular area formed by the width and the height on the left side and the right side of the second left boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the third rectangular area and the fourth rectangular area respectively, and then adding and summing results of the difference to obtain a second credibility score of the second left boundary candidate coordinate.
3. The method for determining a left and right vehicle boundary in an image of claim 1, wherein said calculating a third confidence score for the first right boundary candidate coordinate and a fourth confidence score for the second right boundary candidate coordinate, respectively, comprises:
determining a fifth rectangular area and a sixth rectangular area which are formed by preset width and height on the left side and the right side of the first right boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the fifth rectangular area and the sixth rectangular area respectively, and then adding and summing results of the difference to obtain a third credibility score of the first right boundary candidate coordinate;
determining a seventh rectangular area and an eighth rectangular area formed by the width and the height on the left side and the right side of the second right boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the seventh rectangular area and the eighth rectangular area respectively, and then adding and summing results of the difference to obtain a fourth credibility score of the second right boundary candidate coordinate.
4. A method for determining a left and right vehicle boundary in an image according to claim 2 or 3, wherein the preset width is: 1/5 of the bottom edge of the vehicle; the preset height is as follows: 1/3 at the bottom edge of the vehicle.
5. The method for determining the left and right boundaries of a vehicle in an image according to claim 1, further comprising: and determining the integral boundary of the vehicle according to the vehicle bottom edge coordinates of the vehicle and the determined left and right boundary coordinates, thereby realizing the image segmentation of the vehicle target.
6. The method of claim 1, wherein the adjusting the vehicle bottom edge of the square candidate region comprises: and enabling the bottom edge of the vehicle to float upwards and expand leftwards and rightwards.
7. The method for determining a left and right vehicle boundary in an image of claim 1, wherein the preset width value is: a minimum width value of the vehicle can be resolved in a sample image of the image.
8. The method for determining a left and right vehicle boundary in an image of claim 1, wherein the vertical gradient values are: vertical sobel gradient values.
9. A system for determining left and right boundaries of a vehicle in an image, comprising:
the candidate region generation module is used for drawing at least one square region with the bottom side of at least one vehicle as the side length according to the coordinates of the bottom side of at least one vehicle which is determined in advance, and the square region is used as at least one square candidate region of the vehicle; wherein the left boundary of the vehicle is located in a left half of the square candidate region and the right boundary of the vehicle is located in a right half of the square candidate region;
the boundary checking module is used for carrying out boundary checking on the at least one square candidate region and removing the square candidate regions which do not meet the conditions;
the interesting region generating module is used for adjusting the vehicle bottom edge of each square candidate region according with the conditions so that the adjusted vehicle bottom edge and the vehicle bottom edge before adjustment form an interesting region;
the gradient value calculation module is used for judging whether the width of each region of interest is not greater than a preset width value or not; if so, solving a vertical gradient value of a region corresponding to the region of interest in the image; if not, obtaining a vertical gradient value of a region corresponding to the region of interest from the sampled image of the image; calculating absolute values of the vertical gradient values, and projecting the absolute values to the horizontal direction;
the candidate coordinate generating module is used for acquiring a coordinate corresponding to the maximum absolute value in the left half area in the horizontal direction and determining the coordinate as a first left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a first right boundary candidate coordinate; setting the projection of each maximum absolute value in the horizontal direction to zero; then, in the left half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second left boundary candidate coordinate; in the right half area in the horizontal direction, obtaining a coordinate corresponding to the maximum absolute value, and determining the coordinate as a second right boundary candidate coordinate;
the boundary coordinate determination module is used for judging whether the length of the bottom edge of the vehicle of each square candidate area meeting the conditions is larger than a preset length value or not; if not, respectively calculating a first credibility score of the first left boundary candidate coordinate and a second credibility score of the second left boundary candidate coordinate, and taking the left boundary candidate coordinate corresponding to the maximum first credibility score and the second credibility score as the left boundary coordinate; and respectively calculating a third credibility score of the first right boundary candidate coordinate and a fourth credibility score of the second right boundary candidate coordinate, and taking the right boundary candidate coordinate corresponding to the minimum of the third credibility score and the fourth credibility score as the right boundary coordinate.
10. The system for determining left and right boundaries of a vehicle in an image of claim 9 wherein said calculating a first confidence score for said first left boundary candidate coordinate and a second confidence score for said second left boundary candidate coordinate, respectively, comprises:
determining a first rectangular area and a second rectangular area which are formed by preset width and height on the left side and the right side of the first left boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the first rectangular area and the second rectangular area respectively, and then adding and summing results of the difference to obtain a first credibility score of the first left boundary candidate coordinate;
and determining a third rectangular area and a fourth rectangular area formed by the width and the height on the left side and the right side of the second left boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the third rectangular area and the fourth rectangular area respectively, and then adding and summing results of the difference to obtain a second credibility score of the second left boundary candidate coordinate.
11. The system for determining left and right vehicle boundaries in an image of claim 9 wherein said calculating a third confidence score for said first right boundary candidate coordinate and a fourth confidence score for said second right boundary candidate coordinate, respectively, comprises:
determining a fifth rectangular area and a sixth rectangular area which are formed by preset width and height on the left side and the right side of the first right boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the fifth rectangular area and the sixth rectangular area respectively, and then adding and summing results of the difference to obtain a third credibility score of the first right boundary candidate coordinate;
determining a seventh rectangular area and an eighth rectangular area formed by the width and the height on the left side and the right side of the second right boundary candidate coordinate respectively, performing difference on pixel values of corresponding points in the seventh rectangular area and the eighth rectangular area respectively, and then adding and summing results of the difference to obtain a fourth credibility score of the second right boundary candidate coordinate.
12. The system for determining the left and right boundaries of a vehicle in an image according to claim 10 or 11, wherein the preset widths are: 1/5 of the bottom edge of the vehicle; the preset height is as follows: 1/3 at the bottom edge of the vehicle.
13. The system for determining left and right boundaries of a vehicle in an image of claim 9, further comprising: and the target image segmentation module is used for determining the integral boundary of the vehicle according to the vehicle bottom edge coordinates of the vehicle and the determined left and right boundary coordinates, so that the image segmentation of the vehicle target is realized.
14. The system for determining left and right vehicle boundaries in an image of claim 9 wherein said adjusting the vehicle bottom edge of the square candidate region comprises: and enabling the bottom edge of the vehicle to float upwards and expand leftwards and rightwards.
15. The system for determining a left and right vehicle boundary in an image of claim 9, wherein the preset width value is: a minimum width value of the vehicle can be resolved in a sample image of the image.
16. The system for determining left and right boundaries of a vehicle in an image of claim 9 wherein the vertical gradient values are: vertical sobel gradient values.
CN201710154586.0A 2017-03-15 2017-03-15 Method and system for determining left and right boundaries of vehicle in image Active CN108629227B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710154586.0A CN108629227B (en) 2017-03-15 2017-03-15 Method and system for determining left and right boundaries of vehicle in image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710154586.0A CN108629227B (en) 2017-03-15 2017-03-15 Method and system for determining left and right boundaries of vehicle in image

Publications (2)

Publication Number Publication Date
CN108629227A CN108629227A (en) 2018-10-09
CN108629227B true CN108629227B (en) 2021-04-06

Family

ID=63686851

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710154586.0A Active CN108629227B (en) 2017-03-15 2017-03-15 Method and system for determining left and right boundaries of vehicle in image

Country Status (1)

Country Link
CN (1) CN108629227B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109960983A (en) * 2017-12-25 2019-07-02 大连楼兰科技股份有限公司 Left and right vehicle wheel boundary alignment method based on gradient and picture contrast
CN109960981A (en) * 2017-12-25 2019-07-02 大连楼兰科技股份有限公司 Left and right vehicle wheel boundary alignment system and device based on gradient and picture contrast
CN113470053B (en) * 2020-03-30 2024-03-05 杭州海康威视数字技术股份有限公司 Synthetic graph segmentation method and device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102509067A (en) * 2011-09-22 2012-06-20 西北工业大学 Detection method for lane boundary and main vehicle position
CN105718870A (en) * 2016-01-15 2016-06-29 武汉光庭科技有限公司 Road marking line extracting method based on forward camera head in automatic driving

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4406381B2 (en) * 2004-07-13 2010-01-27 株式会社東芝 Obstacle detection apparatus and method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102509067A (en) * 2011-09-22 2012-06-20 西北工业大学 Detection method for lane boundary and main vehicle position
CN105718870A (en) * 2016-01-15 2016-06-29 武汉光庭科技有限公司 Road marking line extracting method based on forward camera head in automatic driving

Also Published As

Publication number Publication date
CN108629227A (en) 2018-10-09

Similar Documents

Publication Publication Date Title
CN101408985B (en) Method and apparatus for extracting circular luminous spot second-pixel center
JP5794255B2 (en) Object detection device
CN108596878B (en) Image definition evaluation method
CN109859226B (en) Detection method of checkerboard corner sub-pixels for graph segmentation
CN110879994A (en) Three-dimensional visual inspection detection method, system and device based on shape attention mechanism
CN108629227B (en) Method and system for determining left and right boundaries of vehicle in image
US8396285B2 (en) Estimating vanishing points in images
CN105574533B (en) A kind of image characteristic extracting method and device
JP2015062121A5 (en)
EP2993621B1 (en) Method and apparatus for detecting shielding against object
CN107909047B (en) Automobile and lane detection method and system applied to automobile
CN105894521A (en) Sub-pixel edge detection method based on Gaussian fitting
CN109478329B (en) Image processing method and device
KR101483742B1 (en) Lane Detection method for Advanced Vehicle
CN105261021A (en) Method and apparatus of removing foreground detection result shadows
US8396297B2 (en) Supervised edge detection using fractal signatures
Flesia et al. Sub-pixel straight lines detection for measuring through machine vision
KR20180098945A (en) Method and apparatus for measuring speed of vehicle by using fixed single camera
US10380743B2 (en) Object identifying apparatus
KR101026778B1 (en) Vehicle image detection apparatus
CN103337080A (en) Registration technology of infrared image and visible image based on Hausdorff distance in gradient direction
CN110059544B (en) Pedestrian detection method and system based on road scene
CN102831419A (en) Method for detecting and blurring plate number in street view image rapidly
CN108629226B (en) Vehicle detection method and system based on image layering technology
CN104680523A (en) Multi-modal region-consistent significance object detection method based on foreground and background priori

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