Disclosure of Invention
The invention provides a zebra crossing detection method and a zebra crossing detection system for assisting safe driving of a vehicle, and solves the technical problem in the prior art.
The technical scheme for solving the technical problems is as follows:
a zebra crossing detection method for assisting safe driving of a vehicle comprises the following steps:
s1, shooting a target scene through a vehicle-mounted camera, and acquiring a road image in the target scene, wherein the road image comprises an interested area containing a target to be detected and a non-interested area not containing the target to be detected, and the target to be detected is a zebra crossing;
s2, carrying out primary line feature detection on the road image to obtain line features;
s3, acquiring the position information of vanishing points in the road image according to the line characteristics;
s4, carrying out secondary line feature detection on the road image to obtain a straight line in the road image, and extracting line segments along the straight line direction according to a gray scale change rule;
s5, marking the line segments in the road image in a black and white mode according to the visual characteristics of the target to be detected, and acquiring line segment information;
s6, screening the line segments in the road image for the first time according to the line segment information to obtain candidate interesting regions;
and S7, performing secondary screening on the candidate interesting region according to the position information of the vanishing point, the cross ratio invariance of the target to be detected, and the brightness information and the region aspect ratio of the region corresponding to the target to be detected to obtain a final detection result.
The invention has the beneficial effects that: according to the technical scheme, effective detection of a plurality of vanishing points in the image can be realized, so that not only a single target can be detected, but also a plurality of targets to be detected under a complex intersection can be detected. On the basis of the primary detection of the region of interest, multiple priori constraint knowledge information is introduced to realize the target detection from coarse to fine.
On the basis of the technical scheme, the invention can be further improved as follows.
Preferably, the S2 specifically includes:
and carrying out line feature detection on the road image by a Hough transform method to obtain line features.
The beneficial effects of the above technical scheme are: the straight line or line segment can be detected from the black and white image by the Hough transform method, the straight line features with certain interruption length can be connected by the Hough transform method, the data loss and missing detection caused by the shielding of the target part under the condition of road fouling are reduced, the line features of the target to be detected can be effectively captured, and information is provided for subsequent detection and identification.
Preferably, the S3 specifically includes:
constructing a Gaussian hemisphere by taking the center of an optical axis of the vehicle-mounted camera as a sphere center;
taking the Gaussian hemisphere as an accumulation space, projecting the road image to the accumulation space, and acquiring parallel lines in the road image, wherein one line in the road image corresponds to a circle on the Gaussian hemisphere, and a vanishing point in the road image corresponds to an intersection point where a plurality of circles on the Gaussian hemisphere intersect;
and acquiring the position information of the vanishing points corresponding to the parallel lines according to the voting strategy of the accumulation space.
Preferably, the S6 specifically includes:
when the number of the line segments in the line segment information and the length of the line segments are confirmed to be within the corresponding empirical threshold, determining the line segments corresponding to the line segment information as the target to be detected, and determining the area corresponding to the line segments corresponding to the line segment information as the region of interest,
and when the number of the line segments or the length of the line segments in the line segment information is determined not to be within the corresponding empirical threshold, determining that the line segments corresponding to the line segment information are not the target to be detected, determining that the area corresponding to the line segments corresponding to the line segment information is the non-interesting area, and removing the non-interesting area to obtain a candidate interesting area.
Preferably, the S7 specifically includes:
and when the line segment in the candidate interesting region is confirmed to be in accordance with the intersection ratio invariance restrained in the vanishing point corresponding to the line segment, the brightness information of the candidate interesting region is in the confidence interval of the brightness information, and the area aspect ratio of the candidate interesting region is in the confidence interval of the area aspect ratio, determining the candidate interesting region as the interesting region, and obtaining the final detection result.
Preferably, the S7 specifically obtains the confidence interval of the brightness information and the confidence interval of the area aspect ratio by a positive and negative sample statistics method.
A zebra crossing detection system to assist in safe driving of a vehicle, comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for shooting a target scene through a vehicle-mounted camera and acquiring a road image in the target scene, the road image comprises an interested area containing a target to be detected and a non-interested area not containing the target to be detected, and the target to be detected is a zebra crossing;
the primary line detection module is used for carrying out primary line feature detection on the road image to obtain line features;
the second acquisition module is used for acquiring the position information of vanishing points in the road image according to the line characteristics;
the secondary line detection module is used for carrying out secondary line feature detection on the road image to obtain a straight line in the road image, and extracting line segments along the straight line direction according to a gray level change rule;
the marking module is used for carrying out black and white marking on the line segments in the road image according to the visual characteristics of the target to be detected and acquiring line segment information;
the primary screening module is used for carrying out primary screening on the line segments in the road image according to the line segment information to obtain candidate interesting regions;
and the secondary screening module is used for carrying out secondary screening on the candidate interesting region according to the position information of the vanishing point, the cross ratio invariance of the target to be detected, and the brightness information and the region aspect ratio of the region corresponding to the target to be detected to obtain a final detection result.
Preferably, the primary line detection module is specifically configured to:
carrying out line feature detection on the road image by a Hough transform method to obtain line features;
the second obtaining module is specifically configured to:
constructing a Gaussian hemisphere by taking the center of an optical axis of the vehicle-mounted camera as a sphere center;
taking the Gaussian hemisphere as an accumulation space, projecting the road image to the accumulation space, and acquiring parallel lines in the road image, wherein one line in the road image corresponds to a circle on the Gaussian hemisphere, and a vanishing point in the road image corresponds to an intersection point where a plurality of circles on the Gaussian hemisphere intersect;
and acquiring the position information of the vanishing points corresponding to the parallel lines according to the voting strategy of the accumulation space.
Preferably, the primary screening module is specifically configured to:
when the number of the line segments in the line segment information and the length of the line segments are confirmed to be within the corresponding empirical threshold, determining the line segments corresponding to the line segment information as the target to be detected, and determining the area corresponding to the line segments corresponding to the line segment information as the region of interest,
and when the number of the line segments or the length of the line segments in the line segment information is determined not to be within the corresponding empirical threshold, determining that the line segments corresponding to the line segment information are not the target to be detected, determining that the area corresponding to the line segments corresponding to the line segment information is the non-interesting area, and removing the non-interesting area to obtain a candidate interesting area.
Preferably, the secondary screening module is specifically configured to:
when the line segment in the candidate interesting region is confirmed to be in accordance with the intersection ratio invariance restrained in the vanishing point corresponding to the line segment, the brightness information of the candidate interesting region is in the confidence interval of the brightness information, and the area aspect ratio of the candidate interesting region is in the confidence interval of the area aspect ratio, the candidate interesting region is determined to be the interesting region, and the final detection result is obtained; and also used for
And acquiring a confidence interval of the brightness information and a confidence interval of the area aspect ratio by a positive and negative sample statistical method.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, a zebra crossing detection method for assisting safe driving of a vehicle includes:
s1, shooting a target scene through a vehicle-mounted camera, and acquiring a road image in the target scene, wherein the road image comprises an interested area containing a target to be detected and a non-interested area not containing the target to be detected, and the target to be detected is a zebra crossing;
s2, carrying out primary line feature detection on the road image to obtain line features;
s3, acquiring the position information of vanishing points in the road image according to the line characteristics;
s4, carrying out secondary line feature detection on the road image to obtain a straight line in the road image, and extracting line segments along the straight line direction according to the gray scale change rule;
s5, marking the line segments in the road image in a black and white mode according to the visual characteristics of the target to be detected, and acquiring line segment information;
s6, screening the line segments in the road image for the first time according to the line segment information to obtain candidate interesting regions;
and S7, carrying out secondary screening on the candidate interesting region according to the position information of the vanishing point, the cross ratio invariance of the target to be detected, the brightness information of the region corresponding to the target to be detected and the region aspect ratio to obtain a final detection result.
The effective detection of a plurality of vanishing points in the image can be realized, so that not only a single target can be detected, but also a plurality of targets to be detected under a complex intersection can be detected. On the basis of the primary detection of the region of interest, multiple priori constraint knowledge information is introduced to realize the target detection from coarse to fine.
Preferably, S2 specifically includes:
and carrying out line feature detection on the road image by a Hough transform method to obtain line features.
The straight line or line segment can be detected from the black and white image by the Hough transform method, the straight line features with certain interruption length can be connected by the Hough transform method, the data loss and missing detection conditions caused by the shielding of the target part under the condition of road fouling are reduced, the line features of the target to be detected can be effectively captured, and information is provided for subsequent detection and identification.
Preferably, S3 specifically includes:
constructing a Gaussian hemisphere by taking the center of an optical axis of the vehicle-mounted camera as a sphere center;
taking a Gaussian hemisphere as an accumulation space, projecting a road image to the accumulation space, and obtaining parallel lines in the road image, wherein one line in the road image corresponds to a circle on the Gaussian hemisphere, and a vanishing point in the road image corresponds to an intersection point of intersection of a plurality of circles on the Gaussian hemisphere;
and acquiring the position information of vanishing points corresponding to the parallel lines according to a voting strategy of the accumulation space.
Preferably, S6 specifically includes:
when the number of the line segments in the line segment information and the length of the line segments are confirmed to be within the corresponding empirical threshold, the line segments corresponding to the line segment information are determined to be the target to be detected, the areas corresponding to the line segments corresponding to the line segment information are the interested areas,
and when the number of the line segments or the length of the line segments in the line segment information is determined not to be within the corresponding empirical threshold, determining that the line segments corresponding to the line segment information are not the target to be detected, determining that the areas corresponding to the line segments corresponding to the line segment information are non-interesting areas, and removing the non-interesting areas to obtain candidate interesting areas.
Preferably, S7 specifically includes:
and when the line segment in the candidate interesting region is confirmed to be in accordance with the intersection ratio invariance restrained in the vanishing point corresponding to the line segment, the brightness information of the candidate interesting region is in the confidence interval of the brightness information, and the area aspect ratio of the candidate interesting region is in the confidence interval of the area aspect ratio, determining the candidate interesting region as the interesting region, and obtaining the final detection result.
Preferably, the confidence interval of the brightness information and the confidence interval of the area aspect ratio are obtained by a reasonably effective positive and negative sample statistics method.
1. Extraction vanishing point
A set of mutually parallel straight lines in the scene are projected into the photograph either intersecting at a point or continuing to be mutually parallel. The point where a set of parallel lines in a three-dimensional scene intersect in two-dimensional space is called vanishing point. In the case of continuing parallelism in a two-dimensional scene, the vanishing point is considered to be at infinity, such vanishing points being referred to as infinite vanishing points. The zebra stripes are parallel in a three-dimensional scene, but intersect at vanishing points in a two-dimensional image, and the detection of the zebra stripes is mainly used for accurately detecting the vanishing points in the scene.
In order to avoid missing the target, the initial line detection method requires comprehensive detection of parallel lines, which requires different situations to be considered in the vanishing point detection process, so that the detection results under different imaging conditions provide necessary support information for target detection as much as possible. Based on the traditional Hough transform, straight lines belonging to the same vanishing point are firstly classified into the same class, and the process is an accumulation process and is used for searching main straight line classes. The accumulation process is to reduce the computational complexity of the clustering process, and project the unconstrained two-dimensional image into a constrained space, so that the processing has the advantage of processing vanishing points at infinity and vanishing points at a finite distance in the same way. With gaussian hemisphere as accumulation space. Wherein, the optical axis center of the camera is taken as the spherical center of the Gaussian hemisphere. As shown in fig. 2, a circle on the gaussian hemisphere represents a line in the image, and a point on the gaussian hemisphere corresponds to a vanishing point in the image. For the accumulation of lines, a gaussian hemisphere is embedded in the counting cell, and corresponding to the increase of lines, the circles on the hemisphere are increased.
Assume N is a set of detected line segments that converge in a sum vanishing point direction oneSo that
The corresponding straight lines in the three-dimensional space are respectively l
1,l
2,…,l
N. Meanwhile, the coordinate systems of the three-dimensional space and the camera are respectively (O, X, Y, Z) and (F, X, Y, Z), theta and phi are respectively included angles formed by the line segments and the coordinate axis under the camera coordinate system, and at least k of the N straight lines are arranged at the jth vanishing point V
j(j is more than or equal to 0). For a given
Vector terms, all eligible vectors
Satisfies the condition gaussian hemisphere Γ: cos (theta)
i-θ
u)sinφ
isinφ
u+cosφ
icosφ
u=0,θ
u∈[0,2π),φ
uE [0, pi/2), i and u are positive integers. Each cross line in the image plane corresponds to a circle of the gaussian hemisphere, indicating that there is a vanishing point, and in this way, it is possible to avoid the situation of excessive vanishing points.
Let the k-th vanishing point possibly be in the direction
In the above, the voting strategy in the accumulation space can obtain the real vanishing point position in the actual image space. In an actual dynamic traffic scene, objects to be detected can appear in the vehicle advancing direction and the vertical direction of the vehicle at a complex intersection. During the detection process, we prefer to select the parallel lines consistent with the scene motion direction as the main direction, and the parallel line group in the vertical direction as the other direction for finding vanishing points in the image plane. In the vanishing point detection process, based on the characteristics of the zebra crossing, a simple regular equal interval search method is adopted for the quantization and accumulation method of the Hough space, so that redundant vanishing points are avoided, and the execution efficiency of the algorithm is improved.
2. Extracting line features
For the image containing the zebra crossing target to be detected, the target is easily limited by vehicles, pedestrians and imaging conditions, so that the traditional Hough transform line detection effect is not ideal, a plurality of straight lines are easy to miss detection, or a plurality of false straight line information is generated, which is not beneficial to actual scene target detection. In the Hough transform method, based on a new voting method, linear features with certain interruption length are connected, data loss and missing detection caused by shielding of a target part under the condition of road fouling are reduced, the line features of the zebra crossing can be effectively captured, and information is provided for subsequent detection and identification. Because the zebra stripes are located underground and the camera is located at the front windshield, the target to be detected is located at the lower half part of the image, and in order to reduce the unnecessary search and the storage space requirement of the algorithm and improve the execution efficiency of the algorithm, only the line detection processing is considered to be carried out in the target area of the image. On the basis of on-line detection, based on the rule of gray scale change of adjacent straight lines, the line segment of the straight line with severe gray scale change in the straight line direction is taken, the black color is marked on the part from black to white, and the white color is marked on the part from white to black, so that the segmentation result is obtained.
3. Cross ratio invariance constraint
The cross ratio invariance constraint is a basic invariant related to mapping transformation, and essential features in an image can be revealed by utilizing the calculation of the cross ratio invariance, and the cross ratio invariance constraint is also a hot spot of computer vision research. In image space P2Given different four points P on a straight line1,P2,P3,P4Two arbitrary points PiAnd PjExpressed as Δ P, the euclidean distance between themiPjThen, as shown in fig. 3, the cross-ratio invariance constrained at vanishing point O can be expressed as:
corresponding four points P1',P2',P3',P4' will also retain the property of cross-ratio invariance. In the algorithm of zebra crossing detection, the cross ratio of parallel line groups is emphasizedAnd (4) invariance constraint to obtain a line segment meeting the condition, and positioning a region of interest (a region formed by zebra stripes) containing the target to be detected (the zebra stripes) in the image. Due to the characteristics of the zebra crossing, whether different straight line groups meet the knowledge information can be checked based on the dynamic cross ratio invariance constraint condition, and the occurrence of false detection or false alarm is reduced as much as possible. In the primary screening process, the number of the preset parallel lines is 6, so that the numerical value is reasonable and accords with the actual situation, and meanwhile, in the vehicle-mounted environment, whether zebra stripes appear or not can be determined to a great extent by the alternate appearance mode of three black and white areas, so that the false alarm rate is reduced, and the practical application is facilitated.
4. Luminance information constraint
The zebra crossing to be detected in the image keeps the stability of the form to a certain extent due to the mode information, and the brightness information characteristic of the zebra crossing alternately appearing in black and white can provide powerful information support for further confirmation of the region of interest.
CI road image from RGB spaceRGB(x, y) conversion to LST space ILSTThe transformation formula for (x, y) is as follows:
wherein, IR(x,y),IG(x,y),IB(x, y) represent spatial information of red, green, and blue parts, respectively, IL(x,y),IS(x,y),IT(x, y) represent spatial information of L, S and T, respectively, l (luminance channel) is a luminance channel, S and T are chrominance channels, α ═ 255/max { I {R(x,y),IG(x,y),IB(x, y) }, information of the S part and the T part in the LST space does not change along with the change of the brightness information, and the information of the S part can correctly reflect the information of illumination change. In the zebra crossing detection, the change of the brightness information is one of the very important characteristics of the target, and the adoption of the strategy is beneficial to removing the false and true, reducing the false alarm rate of the detection algorithm and improving the accuracy.
The detected candidate regions of interest are first represented in the LST space while the average value within the region is calculated. The area is represented by F (x, y), the width × height represents the size of the area, and F (x, y) represents the grayscale value of the pixel (x, y). Assuming that an interested region in a road image contains n × p pixel points, i, j, n and p are positive integers, the information of a mean value m and a variance d in the interested region can be obtained by calculation with a method of the following formula:
the analysis of the target mode to be detected can be known, the standard deviation can be used for noise evaluation in the region of interest, the mean value represents the average brightness information in the region of interest, the confidence interval of the brightness information is obtained by adopting a sample statistics-based method, for the detection result obtained in the rough extraction stage, positive and negative samples are randomly selected and are respectively 500 used for statistical analysis, and the finally determined confidence interval of the brightness information in the region of interest is [80,160 ]. The area below 80 is most likely the road surface, while the area above 160 is background information that appears randomly within the number of buildings, numbers or images.
5. Aspect ratio constraint
The randomness of the scene image information leads to the complexity of the candidate regions, so that a high false alarm rate often occurs in the detection algorithm. Due to the collective characteristic of the zebra crossing, the whole area of the zebra crossing is a rectangle with a certain range of aspect ratio in the camera image, and the zebra crossing also meets the characteristic even when the zebra crossing is imaged at a long distance or at different angles. Therefore, the aspect ratio constraint of the candidate interesting region is taken as a piece of constraint information to be used for filtering out the information from adjacent vehicles, pedestrians, trees or other regions which do not contain the target to be detected, and the accuracy of the detection result is improved as much as possible under the condition of ensuring the recall rate.
And similarly, obtaining a confidence interval of the aspect ratio of a region to be detected (a candidate interesting region) by adopting a statistical analysis method, randomly selecting 300 positive samples and negative samples as statistical objects in the candidate region with the detection result, wherein the statistical result shows that the effective aspect ratio confidence interval is [1,8.65 ]. When the aspect ratio is greater than or equal to less than 1 or greater than 8.65, the candidate region is a detection result of a randomly occurring adjacent interferent, and may be filtered out to retain the candidate region including the target.
Compared with the prior art, the method has the advantages that: (1) the zebra crossing can be effectively detected under different weather conditions on different roads; (2) when the vehicle travels about 30 meters, the zebra crossing can be effectively and accurately detected by the image captured by the vehicle-mounted camera; (3) when more than one zebra crossing target appears in the image, the target can be effectively detected.
As shown in fig. 4, a zebra crossing detection system for assisting safe driving of a vehicle includes:
the system comprises a first acquisition module 1, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for shooting a target scene through a vehicle-mounted camera and acquiring a road image in the target scene, the road image comprises an interested area containing a target to be detected and a non-interested area not containing the target to be detected, and the target to be detected is a zebra crossing;
the primary line detection module 2 is used for carrying out primary line feature detection on the road image to obtain line features;
the second acquisition module 3 is used for acquiring the position information of vanishing points in the road image according to the line characteristics;
the secondary line detection module 4 is used for performing secondary line feature detection on the road image to obtain a straight line in the road image, and extracting line segments along the straight line direction according to a gray level change rule;
the marking module 5 is used for carrying out black and white marking on line segments in the road image according to the visual characteristics of the target to be detected and acquiring line segment information;
the primary screening module 6 is used for carrying out primary screening on the line segments in the road image according to the line segment information to obtain candidate interesting regions;
and the secondary screening module 7 is used for carrying out secondary screening on the candidate interesting region according to the position information of the vanishing point, the cross ratio invariance of the target to be detected, the brightness information of the region corresponding to the target to be detected and the region aspect ratio to obtain a final detection result.
Preferably, the primary line detection module 2 is specifically configured to:
carrying out line feature detection on the road image by a Hough transform method to obtain line features;
the second obtaining module 3 is specifically configured to:
constructing a Gaussian hemisphere by taking the center of an optical axis of the vehicle-mounted camera as a sphere center;
taking a Gaussian hemisphere as an accumulation space, projecting a road image to the accumulation space, and obtaining parallel lines in the road image, wherein one line in the road image corresponds to a circle on the Gaussian hemisphere, and a vanishing point in the road image corresponds to an intersection point of intersection of a plurality of circles on the Gaussian hemisphere;
and acquiring the position information of vanishing points corresponding to the parallel lines according to a voting strategy of the accumulation space.
Preferably, the primary screening module 6 is specifically configured to:
when the number of the line segments in the line segment information and the length of the line segments are confirmed to be within the corresponding empirical threshold, the line segments corresponding to the line segment information are determined to be the target to be detected, the areas corresponding to the line segments corresponding to the line segment information are the interested areas,
and when the number of the line segments or the length of the line segments in the line segment information is determined not to be within the corresponding empirical threshold, determining that the line segments corresponding to the line segment information are not the target to be detected, determining that the areas corresponding to the line segments corresponding to the line segment information are non-interesting areas, and removing the non-interesting areas to obtain candidate interesting areas.
Preferably, the secondary screening module 7 is specifically configured to:
when the line segment in the candidate interesting region is confirmed to be in accordance with the intersection ratio invariance restrained in the vanishing point corresponding to the line segment, the brightness information of the candidate interesting region is in the confidence interval of the brightness information, and the area aspect ratio of the candidate interesting region is in the confidence interval of the area aspect ratio, the candidate interesting region is determined to be the interesting region, and the final detection result is obtained; and also used for
And obtaining a confidence interval of the brightness information and a confidence interval of the area aspect ratio by a positive and negative sample statistical method.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.