A kind of based on fish-eye vehicle flow detection system, method and method for correcting image
Technical field
The invention belongs to a kind of vehicle flow detection system, be specifically related to based on fish-eye vehicle flow detection system, method and method for correcting image.
Background technology
Existing monitoring system adopts single common view angle camera lens, and vehicle flowrate is monitored; Adopt the system of common lens, the scene of monitoring is abundant not, and the current flux monitoring system mainly operates on industrial computer, has so not only increased the construction costs cost, and has needed larger industrial computer equipment to be processed.
Summary of the invention
Abundant not in order to solve the scene that has the monitoring of vehicle flowrate monitoring system now, and construction costs high in cost of production problem, the present invention has designed a kind of based on fish-eye vehicle flow detection system and method for correcting image.
A kind of based on fish-eye vehicle flow detection system, comprise image collecting device, vehicle Flow Detection module and data storage device, the vehicle Flow Detection module connects respectively image collecting device and data storage device, image collecting device comprises integrated fish eye lens and sensor, and sensor connects the vehicle Flow Detection module by the image rectification chip.Its advantage is: system of the present invention comprises that three parts form, first's image collecting device, and this part mainly is comprised of fish eye lens and sensor imaging moiety; Second portion vehicle Flow Detection module realizes vehicle flowrate is checked in this part; The third part data memory device, the data after this part is processed second portion are stored.Having fish-eye system has the vehicle flowrate on monitoring road surface, better visual angle; The scope checked is wider, and native system does not need additional checkout facility, has reduced cost.
Described based on fish-eye vehicle flow detection system, the image rectification chip is fpga chip, and the vehicle Flow Detection module is the DSP data processing module.Its advantage is: the fish eye lens collected by camera, after view data, is processed through correction algorithm, and the image restoring of distortion is become to normal picture, sends to the vehicle Flow Detection module.Fish eye lens is proofreaied and correct and is processed in fpga chip, need to open up in fpga chip inside a memory cache district, and this zone is used for storing the view data after proofreading and correct.At first, calculate the position of the coordinate points of two field picture after correcting and the corresponding relation of the coordinate points on former two field picture, then this on former two field picture put locational numerical value assignment to the rectification of buffer zone inside after on the corresponding point of frame, then dispose this frame internal storage data and carry out the next frame processing.The image that data processing module receives after video acquisition module is corrected carries out the vehicle flowrate analysis.A panel region in this module intercepts image is analyzed, and vehicle sails this zone into and is not more than the length of general vehicle in image with the distance of leaving this zone, and this zone need to be demarcated according to actual scene.
A kind of based on fish-eye traffic flow detecting method, comprise the following steps:
Step 1, the fish eye lens acquisition of image data, and be sent to FPGA image rectification chip by sensor;
Step 2, FPGA image rectification chip is proofreaied and correct fault image;
Step 3, the yuv data image binaryzation after the self-adaption binaryzation module in the DSP data processing module will be proofreaied and correct is processed;
Step 4, the DSP data processing module adopts gradient vehicle local feature to detect and whether HOG vehicle characteristics matching process joint-detection has vehicle to pass through;
Step 5, the image information that will contain vehicle deposits data storage device in.
Described based on fish-eye traffic flow detecting method, the gray-scale value in step 3 in self-adaption binaryzation module image is set to 0 or 1, and the setting of threshold value adopts the method for adaptive threshold.
Described based on fish-eye traffic flow detecting method, in step 4, gradient information is processed the pattern that adopts one dimension or two dimension.
Described based on fish-eye traffic flow detecting method, HOG vehicle characteristics matching process in step 4, the HOG feature of employing headstock or tailstock model, carry out off-line training and classification with SVM support vector machine linear classifier.
Its advantage is: the fish eye lens collected by camera, after view data, is proofreaied and correct correcting algorithm through fisheye image and is processed, and the image restoring of distortion is become to normal picture, sends to the vehicle Flow Detection module.Yuv data image binaryzation after the self-adaption binaryzation module will be proofreaied and correct is processed.Gray-scale value in image is set to 0 or 1, and the setting of threshold value adopts the method for adaptive threshold.Whether the detection of gradient vehicle local feature and HOG vehicle characteristics matching process join together to detect surveyed area in this two field picture has vehicle to pass through.There is abundant gradient information the vehicle part, the information of vehicles in the analyzing and testing zone that employing the method can be rough.Gradient information is processed the pattern that can adopt one dimension or two dimension, and the higher need of the dimension time to be processed is longer.HOG vehicle characteristics matching process adopts the HOG feature of headstock or tailstock model, with SVM support vector machine linear classifier, carries out off-line training and classification.Utilize this feature can judge which image pattern contains vehicle, those image patterns do not have vehicle, thereby carry out accurate vehicle flowrate.The image data information that will contain vehicle is filed, and returns and starts to carry out data analysis next time.
A kind of fish-eye method for correcting image comprises the following steps:
(1) according to the spherical co-ordinate model in the panorama picture of fisheye lens principle, set up the XYZ space rectangular coordinate system, wherein, P is for inciding fish-eye light; F1 is fish-eye focal length; The angle of light P and Z axis is θ; A(x1, y1) for light P falls the point on the plane that x axle y axle forms through the common lens perfect condition, with Z axis, form angle β, form angle ψ with X-axis, A point and central point apart from being R; K is the projective invariant coefficient; B(x2, y2) for the point of P on the plane of falling x axle y axle after fish eye lens refraction and forming, with Z axis, form angle α, with the angle of X-axis be ψ, B point and central point apart from being r;
(2) by the conversion relation of β and θ and θ and α, determine α and β angle; The conversion relation formula of β and θ is:
The rectangular projection formula of fish eye lens in the limited range of plane is as follows:
By formula, 1. with formula, 2. obtained
α and β angle are
⑤
(3) 3., 4. and 5. obtain the relation of R and r by the formula in step (2):
(4) convert the B point to the polar coordinates formula from planimetric coordinates:
⑦
(5) determine A(x1, the y1 that light P obtains under conventional lens shooting) coordinate:
(6) 6. with formula, 7. obtain the range formula of R by formula:
(7) according to formula 8., 9., 10.,, obtain the coordinate transformation relation that A point and B are ordered:
Utilize this relation to become normal picture to the image restoring of the distortion of fisheye camera shooting preferably.Then normal picture after conversion is delivered to the DSP data processing module and is carried out vehicle flowrate calculating.The fish eye lens correction algorithm is exactly the pixel and the coordinate points corresponding relation of correcting on rear image solved on former frame.
The accompanying drawing explanation
Fig. 1 is fish-eye vehicle flow detection system principle;
Fig. 2 is fish-eye vehicle flow detection system processing procedure;
Fig. 3 is the correction handling principle figure of flake video in FPGA inside;
Fig. 4 is video mode vehicle Flow Detection schematic diagram;
Fig. 5 is the vehicle flow detection algorithm process flow diagram;
Fig. 6 is fish eye lens correcting algorithm three-dimensional imaging figure;
Fig. 7 is fish eye lens correcting algorithm planar imaging figure.
Embodiment
Below in conjunction with accompanying drawing, structure of the present invention is explained in detail to explanation, as Fig. 1 is fish-eye vehicle flow detection system principle; A kind of based on fish-eye vehicle flow detection system, comprise image collecting device, vehicle Flow Detection module and data storage device, the vehicle Flow Detection module connects respectively image collecting device and data storage device, image collecting device comprises integrated fish eye lens and sensor, and sensor connects the vehicle Flow Detection module by the image rectification chip.As Fig. 2 is fish-eye vehicle flow detection system processing procedure; Described based on fish-eye vehicle flow detection system, the image rectification chip is fpga chip, and the vehicle Flow Detection module is the DSP data processing module.
A kind of based on fish-eye traffic flow detecting method, comprise the following steps:
Step 1, the fish eye lens acquisition of image data, and be sent to FPGA image rectification chip by sensor;
Step 2, FPGA image rectification chip is proofreaied and correct fault image;
Step 3, the yuv data image binaryzation after the self-adaption binaryzation module in the DSP data processing module will be proofreaied and correct is processed;
Step 4, the DSP data processing module adopts gradient vehicle local feature to detect and whether HOG vehicle characteristics matching process joint-detection has vehicle to pass through;
Step 5, the image information that will contain vehicle deposits data storage device in.
Described based on fish-eye traffic flow detecting method, the gray-scale value in step 3 in self-adaption binaryzation module image is set to 0 or 1, and the setting of threshold value adopts the method for adaptive threshold.
Described based on fish-eye traffic flow detecting method, in step 4, gradient information is processed the pattern that adopts one dimension or two dimension.
Described based on fish-eye traffic flow detecting method, HOG vehicle characteristics matching process in step 4, the HOG feature of employing headstock or tailstock model, carry out off-line training and classification with SVM support vector machine linear classifier.
A kind of fish-eye method for correcting image comprises the following steps:
(1) according to the spherical co-ordinate model in the panorama picture of fisheye lens principle, set up the XYZ space rectangular coordinate system, wherein, P is for inciding fish-eye light; F1 is fish-eye focal length; The angle of light P and Z axis is θ; A(x1, y1) for light P falls the point on the plane that x axle y axle forms through the common lens perfect condition, with Z axis, form angle β, form angle ψ with X-axis, A point and central point apart from being R; K is the projective invariant coefficient; B(x2, y2) for the point of P on the plane of falling x axle y axle after fish eye lens refraction and forming, with Z axis, form angle α, with the angle of X-axis be ψ, B point and central point apart from being r;
(2) by the conversion relation of β and θ and θ and α, determine α and β angle; The conversion relation formula of β and θ is:
The rectangular projection formula of fish eye lens in the limited range of plane is as follows:
By formula, 1. with formula, 2. obtained
α and β angle are
⑤
(3) 3., 4. and 5. obtain the relation of R and r by the formula in step (2): as Fig. 7 is fish eye lens correcting algorithm planar imaging figure;
(4) convert the B point to the polar coordinates formula from planimetric coordinates:
(5) determine A(x1, the y1 that light P obtains under conventional lens shooting) coordinate:
(6) 6. with formula, 7. obtain the range formula of R by formula:
(7) according to formula 8., 9., 10.,, obtain the coordinate transformation relation that A point and B are ordered:
The fish eye lens collected by camera is after view data, at first, calculate the position of the coordinate points of two field picture after correcting and the corresponding relation of the coordinate points on former two field picture, then this on former two field picture put locational numerical value assignment to the rectification of buffer zone inside after on the corresponding point of frame, then dispose this frame internal storage data and carry out the next frame processing.The fish eye lens correction algorithm is exactly the pixel and the coordinate points corresponding relation of correcting on rear image solved on former frame, and correcting principle figure as shown in Figure 3; Proofread and correct correcting algorithm through fisheye image and process, the image restoring of distortion is become to normal picture, send to the vehicle Flow Detection module.The image that data processing module receives after video acquisition module is corrected carries out the vehicle flowrate analysis.A panel region in this module intercepts image is analyzed, as Fig. 4 is video mode vehicle Flow Detection schematic diagram; Vehicle sails this zone into and leaves this regional distance H and is not more than the length of general vehicle in image, and this zone need to be demarcated according to actual scene.Yuv data image binaryzation after the self-adaption binaryzation module will be proofreaied and correct is processed.Gray-scale value in image is set to 0 or 1, and the setting of threshold value adopts the method for adaptive threshold.Whether the detection of gradient vehicle local feature and HOG vehicle characteristics matching process join together to detect surveyed area in this two field picture has vehicle to pass through.There is abundant gradient information the vehicle part, the information of vehicles in the analyzing and testing zone that employing the method can be rough.Gradient information is processed the pattern that can adopt one dimension or two dimension, and the higher need of the dimension time to be processed is longer.HOG vehicle characteristics matching process adopts the HOG feature of headstock or tailstock model, with SVM support vector machine linear classifier, carries out off-line training and classification.Utilize this feature can judge which image pattern contains vehicle, those image patterns do not have vehicle, thereby carry out accurate vehicle flowrate.The image data information that will contain vehicle is filed, and returns and starts to carry out data analysis next time.As Fig. 5 is the vehicle flow detection algorithm process flow diagram.
Technique scheme has only embodied the optimal technical scheme of technical solution of the present invention, and those skilled in the art have all embodied principle of the present invention to some changes that wherein some part may be made, within belonging to protection scope of the present invention.