Invention content
In order to solve problems in the prior art, the present invention provides a kind of vehicle detection sides based on space of components relationship
Method, the vehicle checking method based on space of components relationship, including:
Video image is obtained, determines the distance between car plate component and car light component of vehicle sample in the video image
Value and angle value represent empty between car plate component and car light component according to the distance value and angle value combination algorithm foundation
Between relationship gauss hybrid models;
The video image is demarcated using direct linear transformation, obtains perspective transformation matrix;
Information in the video image is carried out inverse projection according to the perspective transformation matrix, obtained by the inverse projection face of structure
Obtain inverse projection figure;
According to color transformation model, in conjunction with gradient algorithm, the car plate component and described is determined from the inverse projection figure
Car light component;
If the number of the car plate component and the car light component in the inverse projection figure and be not less than preset value,
The likelihood score of the car plate component and the car light component in the gauss hybrid models is obtained, if the number of the likelihood score
Value is more than likelihood score threshold value, it is determined that the car plate component and the component that the car light component is a vehicle, and then determine vehicle
Number.
Optionally, described that the video image is demarcated using direct linear transformation, obtain perspective transformation matrix, packet
It includes:
The calibration point of six known coordinates is chosen in world coordinate system, wherein four calibration points are located at horizontal plane,
The height value of calibration point described in another two is not zero;
Image coordinate of the calibration point of six known coordinates in image coordinate system is obtained, is obtained by least square method
Take the perspective transformation matrix between the world coordinate system and described image coordinate system.
Optionally, the structure inverse projection face, according to the perspective transformation matrix by the information in the video image into
Row inverse projection obtains inverse projection figure, including:
Pane location is chosen on the inverse projection face, determines that each pane location is corresponding on the video image
Sampled pixel point;
The video image is converted into gray level image, and obtains the gray value of the sampled pixel point;
Inverse throw will be carried out on inverse projection face described in the gray value phase of the sampled pixel point according to the perspective transformation matrix
Shadow obtains the inverse projection figure after inverse projection.
Optionally, described according to color transformation model, in conjunction with gradient algorithm, the car plate is determined from the inverse projection figure
Component and the car light component, including:
By the car plate color model in color transformation model, the car plate gray-scale map of the video image is obtained, and then is obtained
Take the car plate gradient map of the car plate gray-scale map;
Car plate sample areas identical with car plate size is chosen from the car plate gradient map, obtains the car plate sample area
The average gradient value of all pixels in domain, if the average gradient value is more than predetermined gradient threshold value, it is determined that the car plate sample
One's respective area is license plate area, and determines the car plate component by connected component labeling method in the license plate area;
By the car light color model in the color transformation model, the car light gray-scale map of the video image is obtained, into
And the binary image of the car light gray-scale map is obtained in conjunction with binary-state threshold;
The white area in the binary image is obtained, it is true by the connected component labeling method in the white area
The fixed car light component.
Optionally, if the number of the car plate component and the car light component in the inverse projection figure and not small
In preset value, then the likelihood score of the car plate component and the car light component in the gauss hybrid models is obtained, if institute
The numerical value for stating likelihood score is more than likelihood score threshold value, it is determined that the car plate component and the component that the car light component is a vehicle,
And then determine number of vehicles, including:
Obtain the car plate component and the car light component in the inverse projection figure number and;
If the number and be not less than preset value, obtain the car plate component and the vehicle in the inverse projection figure
The distance between lamp part value and angle value, and then determine the distance value and the angle value in the gauss hybrid models
Likelihood score;
If the numerical value of the likelihood score is more than likelihood score threshold value, it is determined that the car plate component and the car light component are
The component of one vehicle, and then determine number of vehicles.
Optionally, the vehicle checking method based on space of components relationship further includes:
If the numerical value of the likelihood score is less than the likelihood score threshold value, because of the car light component and the car plate component
Quantity it is very few, can not determine vehicle detection result.
The advantageous effect that technical solution provided by the invention is brought is:
By introducing gauss hybrid models during vehicle detection, compared with prior art, can overcome block and
Influence of the illumination condition difference to algorithm of target detection, improves the accuracy of vehicle identification.
Embodiment one
The present invention provides a kind of vehicle checking methods based on space of components relationship, as shown in Figure 1, described be based on component
The vehicle checking method of spatial relationship, including:
11, video image is obtained, is determined between the car plate component of vehicle sample in the video image and car light component
Distance value and angle value, according to the distance value and angle value combination algorithm foundation represent car plate component and car light component it
Between spatial relationship gauss hybrid models;
12, the video image is demarcated using direct linear transformation, obtains perspective transformation matrix;
13, inverse projection face is built, the information in the video image is carried out by inverse projection according to the perspective transformation matrix,
Obtain inverse projection figure;
14, according to color transformation model, in conjunction with gradient algorithm, the car plate component and institute are determined from the inverse projection figure
State car light component;
If the 15, number of the car plate component in the inverse projection figure and the car light component and not less than default
Value, then obtain the likelihood score of the car plate component and the car light component in the gauss hybrid models, if the likelihood
The numerical value of degree is more than likelihood score threshold value, it is determined that the car plate component and the component that the car light component is a vehicle, and then really
Determine number of vehicles.
In force, in order to solve defect difficult to road vehicle identification in the prior art, present applicant proposes
A kind of vehicle checking method based on space of components relationship, the particular content of this method are as follows:
First, the video image with vehicle to be detected is obtained, determines the car plate component of vehicle sample in the video image
The distance between car light component value length and angle value angle, according to the distance value length and the angle value
Angle combination EM algorithms establish the gauss hybrid models (GMM) for representing spatial relationship between car plate component and car light component.Here
Spatial relationship between car plate component and car light component can refer to left car light with reference chart 2, the wherein regions LR, and the regions RR refer to right
Car light, the regions LP then refer to car plate.D refers to the distance between two components value length, and θ is then referred between two components
Angle value angle.
It is worth noting that, it is one that EM algorithms used herein, which are (Expection-Maximizationalgorithm),
Kind iterative algorithm walks two big iterative steps by E steps and M, and each iteration all makes maximum likelihood function increase.Specifically:
(1) by the way that initialization value is arranged, finding out makes the maximum value of likelihood equation, this step is known as E- steps (E-step)
(2) value found out, update are utilized.This step is known as M- steps (M-step).
And Gauss model (GMM, Gaussian mixture model) is exactly to use Gaussian probability-density function (normal distribution
Curve) accurately quantify things, a things is decomposed into several based on Gaussian probability-density function (normal distribution curve)
The model of formation.The principle and process of Gauss model are established to image background:Image grey level histogram reflection is certain in image
The frequency that a gray value occurs, can also be thought as the estimation of gradation of image probability density.If the target area that image is included
Domain and background area difference are bigger, and there are certain difference in background area and target area in gray scale, then the image
Double peak-to-valley shapes are presented in grey level histogram, and one of peak corresponds to target, another peak corresponds to the center gray scale of background.
Then, the video image is demarcated using direct linear transformation, obtains perspective transformation matrix;
Here direct linear transformation is also known as Direct Linear Transformation, abbreviation DLT.It is to establish picture
The algorithm of direct linear relationship between point coordinates instrument and corresponding object point object space coordinate.With following features:In not needing
Elements of exterior orientation, is suitable for non-metric camera, in satisfaction, the measurement task of low precision.
Secondly, inverse projection face is built, in order to which the perspective transformation matrix that is obtained according to back is by the letter in video image
Type inverse projection is ceased, to get inverse projection figure.
During actual photographed, the scene graph that video camera takes is projection of the three dimensional spatial scene in two-dimensional space,
During the vehicle travelled on road and road is identified using machine vision, a kind of Converse solved mistake is needed
Journey is reduced into the pavement image of vertical view from obtained two dimensional image.According to after above-mentioned transformation by reciprocal direction as a result, can obtain
The depth information of road is got, pavement of road situation can be preferably provided, vehicle is more easily provided and travels reference information.This
It is also the theoretical foundation of vehicle checking method provided by the invention.
Again, on the basis of the inverse projection figure that back is got, according to color transformation model and gradient algorithm is combined,
Detailed car plate component and car light component are determined from the inverse projection figure.The particular content of the step carries out in detail below
Analysis, details are not described herein again.
Finally, the quantity of the car plate component and car light component that are determined to back summarizes, if the inverse projection figure
In the car plate component and the car light component number and be not less than preset value, then obtain the car plate component and the vehicle
Likelihood score of the lamp part in the gauss hybrid models, if the numerical value of the likelihood score is more than likelihood score threshold value, it is determined that
The car plate component and the component that the car light component is a vehicle, and then determine number of vehicles.Equally, detailed content is later
In analyzed.
The present invention provides a kind of vehicle checking methods based on space of components relationship, including establish gauss hybrid models,
Perspective transformation matrix is obtained, inverse projection face is built, is carried out the information in the video image according to the perspective transformation matrix
Inverse projection obtains inverse projection figure, the car plate component and the car light component is determined from the inverse projection figure, if described inverse
The number of the car plate component and the car light component in perspective view and be not less than preset value, then determining the car plate component
It is determining number of vehicles after the component of a vehicle with the car light component.By introducing Gaussian Mixture mould during vehicle detection
Type can overcome and block and influence of the illumination condition difference to algorithm of target detection, improve vehicle knowledge compared with prior art
Other accuracy.
Optionally, described that the video image is demarcated using direct linear transformation, obtain perspective transformation matrix, packet
It includes:
The calibration point of six known coordinates is chosen in world coordinate system, wherein four calibration points are located at horizontal plane,
The height value of calibration point described in another two is not zero;
Image coordinate of the calibration point of six known coordinates in image coordinate system is obtained, is obtained by least square method
Take the perspective transformation matrix between the world coordinate system and described image coordinate system.
In force, in conjunction with Fig. 3, the camera calibration method in above-mentioned steps is illustrated, camera calibration needs six
The calibration point of its known world coordinate system, wherein four calibration points are in the horizontal plane, such as P0~P3 points in Fig. 3, other two
Calibration point is not in the horizontal plane, that is to say, that height in space is not equal to 0, such as P4~P5 points in Fig. 4.
Refer to projection relation of the scene in three-dimensional space to the plane of delineation in specifically used imaging model, in objective world
Three-dimensional scene projection be related to several coordinate systems to the two dimensional image that video camera takes:
(1) world coordinate system, also referred to as true or real coordinate system are the absolute coordinate systems of objective world.
(2) camera coordinate system is the coordinate system sheared as coordinate origin using video camera.
(3) image coordinate system is the plane coordinate system formed in the image that video camera takes.
(4) computer picture coordinate system is the coordinate system used in computer-internal digital picture.
First kind world coordinate system and third class image coordinate system are used in this step, are led in image coordinate system
Coordinate of the known point in world coordinate system is crossed, and is got between image coordinate system and world coordinate system in conjunction with least square method
Transition matrix, which is perspective transformation matrix.The inverse projection that the perspective transformation matrix is used in subsequent step turns
It changes.
Optionally, the structure inverse projection face, according to the perspective transformation matrix by the information in the video image into
Row inverse projection obtains inverse projection figure, including:
Pane location is chosen on the inverse projection face, determines that each pane location is corresponding on the video image
Sampled pixel point;
The video image is converted into gray level image, and obtains the gray value of the sampled pixel point;
Inverse throw will be carried out on inverse projection face described in the gray value phase of the sampled pixel point according to the perspective transformation matrix
Shadow obtains the inverse projection figure after inverse projection.
In force, it in order to which the information in video image to be carried out to the process of inverse projection according to perspective transformation matrix, needs
Carry out following steps:
(1) using the lattice of 5cm × 5cm as pane location on inverse projection face, and by the pane location to video figure
As being projected in residing plane, in order to each pane location of determination corresponding image-region on the video images, and then determining should
The sampled pixel point for including in image-region.
(2) video image is converted into gray level image, the sample picture that back is got is determined from the gray level image
The gray value of vegetarian refreshments.
(3) perspective transformation matrix obtained before is combined according to the gray value of the sampled pixel point got, in inverse projection
Type inverse projection on face, to get the inverse projection figure after inverse projection.Box in Fig. 4 (a) is the inverse projection face of structure, figure
4 (b) be by video image carry out inverse projection processing to be parallel in three dimensions built on the inverse projection face of X-O-Z planes it is inverse
Perspective view 1, Fig. 4 (c) are the inverse projection face for carrying out video image to be parallel to Y-O-Z planes in inverse projection processing to three dimensions
Inverse projection Fig. 2 of upper structure.
By the Inverse projection of this step, the step of projecting video image on inverse projection face is realized, in order to
According to the vehicle identification step realized in perspective plane progress subsequent step.
Optionally, described according to color transformation model, in conjunction with gradient algorithm, the car plate is determined from the inverse projection figure
Component and the car light component, including:
By the car plate color model in color transformation model, the car plate gray-scale map of the video image is obtained, and then is obtained
Take the car plate gradient map of the car plate gray-scale map;
Car plate sample areas identical with car plate size is chosen from the car plate gradient map, obtains the car plate sample area
The average gradient value of all pixels in domain, if the average gradient value is more than predetermined gradient threshold value, it is determined that the car plate sample
One's respective area is license plate area, and determines the car plate component by connected component labeling method in the license plate area;
By the car light color model in the color transformation model, the car light gray-scale map of the video image is obtained, into
And the binary image of the car light gray-scale map is obtained in conjunction with binary-state threshold;
The white area in the binary image is obtained, it is true by the connected component labeling method in the white area
The fixed car light component.
In force, it in order to be accurately obtained the image of car plate component, needs to carry out following steps:
By the car plate color model in preset color conversion model, video image is converted, after obtaining conversion
Car plate gray-scale map, and then obtain the car plate gradient map of the car plate gray-scale map.Then selection and car plate from the car plate gradient map
The comparable car plate sample areas of area, and then the average gradient value of the car plate sample areas is obtained, in order to combine predetermined gradient
Threshold value determines license plate area, and accurate car plate component is determined by connected component labeling method in determining license plate area.
Fig. 5 (a) is raw video image, and Fig. 5 (b) is the inverse projection figure obtained after Inverse projection, and Fig. 5 (c) is conversion
Car plate gray-scale map afterwards, Fig. 5 (d) are the car plate gradient map got, and Fig. 5 (e) is the average gradient value figure of car plate sample areas
Picture, Fig. 5 (f) are the sharp picture of obtained car plate component.
In order to be accurately obtained the image of car light component, need to carry out following steps:
By the car light color model in preset color conversion model, video image is converted, after obtaining conversion
Car light gray-scale map, the binary image of car light gray-scale map is then obtained by binary conversion treatment.It extracts in the binary image
White area, the car light component is determined by the connected component labeling method in white area.
Fig. 6 (a) is raw video image, and Fig. 6 (b) is the car plate gray-scale map after conversion, and Fig. 6 (d) is after Threshold segmentation
Binary image, Fig. 6 (e) are the sharp picture of obtained car plate component.
Through the above steps, the car plate component in video image and car light component can be accurately obtained, to be follow-up step
Accurate vehicle identification is carried out in rapid to lay the foundation.
Optionally, if the number of the car plate component and the car light component in the inverse projection figure and not small
In preset value, then the likelihood score of the car plate component and the car light component in the gauss hybrid models is obtained, if institute
The numerical value for stating likelihood score is more than likelihood score threshold value, it is determined that the car plate component and the component that the car light component is a vehicle,
And then determine number of vehicles, including:
Obtain the car plate component and the car light component in the inverse projection figure number and;
If the number and be not less than preset value, obtain the car plate component and the vehicle in the inverse projection figure
The distance between lamp part value and angle value, and then determine the distance value and the angle value in the gauss hybrid models
Likelihood score;
If the numerical value of the likelihood score is more than likelihood score threshold value, it is determined that the car plate component and the car light component are
The component of one vehicle, and then determine number of vehicles.
In force, after back gets accurate car plate component and car light component, the quantity of the two is converged
Always, if number and be not less than preset value, obtain the car plate component and the car light component in the gauss hybrid models
In likelihood score, if the numerical value of the likelihood score be more than likelihood score threshold value, it is determined that the car plate component and the car light portion
Part is the component of a vehicle, to complete the judgement to a vehicle, is repeated the above steps in video image, and then is determined whole
Number of vehicles.
Road vehicle is identified through the above steps, compared with the existing technology in scheme, can be significant
Improve the accuracy of vehicle identification.
Optionally, the vehicle checking method based on space of components relationship further includes:
If the numerical value of the likelihood score is less than the likelihood score threshold value, because of the car light component and the car plate component
Quantity it is very few, can not determine vehicle detection result.
In force, after back gets accurate car plate component and car light component, the quantity of the two is converged
Always, if the number summarized is less than preset value, likelihood score threshold can be less than because of the very few numerical value for leading to likelihood score of number of components
Value cannot also realize accurate vehicle identification to determine whether above-mentioned component belongs to same vehicle.
The present invention provides a kind of vehicle checking methods based on space of components relationship, including establish gauss hybrid models,
Perspective transformation matrix is obtained, inverse projection face is built, is carried out the information in the video image according to the perspective transformation matrix
Inverse projection obtains inverse projection figure, the car plate component and the car light component is determined from the inverse projection figure, if described inverse
The number of the car plate component and the car light component in perspective view and be not less than preset value, then determining the car plate component
It is determining number of vehicles after the component of a vehicle with the car light component.By introducing Gaussian Mixture mould during vehicle detection
Type can overcome and block and influence of the illumination condition difference to algorithm of target detection, improve vehicle knowledge compared with prior art
Other accuracy.
It should be noted that:The vehicle checking method based on space of components relationship that above-described embodiment provides carries out vehicle inspection
The embodiment of survey, the only explanation as the vehicle checking method in practical applications, can also according to actual needs will be above-mentioned
Vehicle checking method uses in other application scene, and specific implementation process is similar to above-described embodiment, and which is not described herein again.
Each serial number in above-described embodiment is for illustration only, the assembling for not representing each component or the elder generation during use
Sequence afterwards.
Example the above is only the implementation of the present invention is not intended to limit the invention, all in the spirit and principles in the present invention
Within, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention.