A kind of extracting method of novel target and its sub-pixel angle point
Technical field
The present invention relates to ground close-range photogrammetry field, especially a kind of single camera vision system lower pinhole camera it is novel
The extracting method of target and its sub-pixel angle point.
Background technique
Object ranging based on image is current research hotspot, and many fields industrially have obtained widely
Using, such as forestry survey, automatic Pilot.Object ranging based on image, is broadly divided into initiative range measurement and passive ranging
Two methods[1].Initiative range measurement is to carry out ranging using laser radar[2-4].Passive ranging is by machine vision to two-dimensional digital
Object depth information is calculated in image, then according to image pixel information and camera imaging principle calculate object away from
From[5-6].It not only can replace many manual workings using machine vision, improve production automation level, improve detection accuracy, more
It is effective solution route that many general measuring methods cannot achieve.Machine vision ranging is broadly divided into monocular vision ranging, double
Two class of mesh visual token [1-9].The depth information acquisition method of early stage is mainly binocular stereo vision and camera motion information, is needed
Multiple image is wanted to complete the acquisition of image depth information[10-16].Compared with binocular distance measurement, the acquisition of monocular range images is not required to
Want stringent hardware condition, more competitive superiority.The geometric position of the picture point on image obtained due to camera and true generation
Corresponded in boundary the geometric position of object point be it is closely related, these positions and its correlation are then the geometry moulds by camera imaging
What type determined, therefore once can determine the parameter of this geometrical model, we can completely express two-dimentional picture point and three
The corresponding relationship between object point is tieed up, to calculate image object object distance.In the prior art, the object of single camera vision system
There are many methods for Depth Information Acquistion.The depth information of target to be measured is such as obtained using corresponding points standardization[17-19].Document
[17] a kind of robot target positioning distance measuring method based on monocular vision is had studied, this method is usually to obtain by camera calibration
The inside and outside parameter of camera is taken, the transformational relation between image coordinate system and world coordinate system is solved in conjunction with projection model, to count
Calculate object depth information.Unfortunately, the method needs to acquire the target image of different direction, and accurately records each point and exist
Respective coordinates in world coordinate system and image coordinate system, stated accuracy are affected for measurement accuracy.Further, it is also possible to logical
The relationship building depth extraction model in research world coordinate system between object actual imaging and image pixel is crossed, image is calculated
Middle object is at a distance from actual scene between camera.Document [20] puts object of reference on road surface and measures its distance, choosing
Suitable mathematical model is selected, the corresponding relationship being fitted between object of reference distance and pixel recycles this relationship extract real-time depth
Information.Unfortunately, the method precision of document [20] will receive the influence of telemeasurement error and error of fitting.Document [21]
A kind of vertical target image is devised, the angle point data by detecting the image establish image ordinate pixel value and actual measurement
Mapping relations between angle combine known vehicle-mounted monocular camera height to obtain vehicle-mounted depth in image and believe using this relationship
Breath.Since different cameral equipment inner parameter has differences, for the camera apparatus of different model, this method needs are resurveyed
Target image information, establishes camera depth information extraction model, and different in-vehicle cameras camera lens make with assemble etc. due to,
So that camera pitch angle can also have differences, therefore the method versatility of document [21] is poor.In addition, the method for document [21] is adopted
It is applied to horizontal plane with the relationship between vertical target research perpendicular picture point imaging angle and ordinate pixel value, and by this
The measurement of upper object distance, so that range accuracy is relatively low, because of camera level and the incomplete phase of vertical direction Distortion Law
Together.The selection of target is most important to the building of depth extraction model, however, real using traditional gridiron pattern target research object point
It is existing by perspective transform due to its as broad as long characteristic when relationship between border imaging angle and corresponding picture point ordinate pixel
So that models fitting effect is poor, measurement accuracy is not high for the influence of elephant.
It can make model that there is equipment interoperability in addition, constructing depth extraction model by the method for camera calibration, it should
Model needs to obtain camera internal parameter, the stated accuracy of camera, the object ranging to image by the method for camera calibration
Precision has vital effect.Zhang Zhengyou calibration method is most common camera calibration method, using tradition
Black and white square interlock stacked gridiron pattern target.This target can only be used to realize the calibration of camera in same plane, if will
The horizontal positioned then stated accuracy of target can be reduced accordingly.Application No. is 201710849961.3 patent applications, disclose one kind
Improved camera calibration model and distortion correction model suitable for intelligent sliding moved end camera is (hereinafter referred to as: improved with non-
The peg model of linear distortion item), this method can help to correct scaling board picture, obtain the inside and outside ginseng of camera of higher precision
Number, but the distortion correction model is only used for the nonlinear distortion of correction camera, the perspective phenomenon not being suitable in imaging.
Bibliography:
[1] He Ruofei, Tian Xuetao, Liu Hongjuan wait unmanned plane target localization method of the based on Monte Carlo Kalman filtering
[J] Northwestern Polytechnical University journal, 2017,35 (3): 435-441.
[2] Lin F, Dong X, Chen B M, et al.A Robust Real-Time Embedded Vision
System on an Unmanned Rotorcraft for Ground Target Following[J].IEEE Trans on
Industrial Electronics, 2012,59 (2): 1038-1049.
[3] Zhang Wanlin, Hu Zhengliang, Zhu Jianjun wait one of the comprehensive view instrument of individual soldier target position calculation method [J]
Electronic measurement technique, 2014,37 (11): 1-3.
[4] Sun Junling, Sun Guangmin, Ma Pengge wait laser eyepiece of the based on symmetrical wavelet noise reduction and asymmetric Gauss curve fitting
Position [J] Chinese laser, 2017,44 (6): 178-185.
[5] Shi Jie, Li Yin child, Qi Guoqing, passive tracking algorithm [J] China under waiting not exclusively to measure based on machine vision
Middle University of Science and Technology's journal, 2017,45 (6): 33-37.
[6] Xu Cheng, yellow grand celebration, a kind of passive target positioning of the numerous small drone of clanging or clanking sound in hole and precision analysis [J] instrument instrument
Table journal, 2015,36 (5): 1115-1122.
[7] Li Kehong, Jiang Lingmin, Gong Yong justice .2 are tieed up to 3 d image/Video Quality Metric image depth extracting method and are summarized
[J] Journal of Image and Graphics, 2014,19 (10): 1393-1406.
[8] Wang Hao, Xu Zhiwen, Xie Kun, wait binocular range-measurement system [J] Jilin University journal of the based on OpenCV, and 2014,
32 (2): 188-194.
[9] Sun W, Chen L, Hu B, et al.Binocular vision-based position
determination algorithm and system[C]//Proceedings of the 2012International
Conference on Computer Distributed Control and Intelligent Environmental
Monitoring.Piscataway:IEEE Computer Society, 2012:170-173.
[10]Ikeuchi K.Determining a depth map using a dual photometric stereo
[J] .The International Journal of Robotics Research, 1987,6 (1): 15-31.
[11] Shao M, Simchony T, Chellappa R.New algorithms from reconstruction
of a 3-d depth map from one or more images[C]//Proceedings of CVPR’88.Ann
Arbor:IEEE, 1988:530-535.
[12] Matthies L, Kanade T, Szeliski R.Kalman filter-based algorithms for
estimating depth from image sequences[J].International Journal of Computer
Vision, 1989,3 (3): 209-238.
[13] Mathies L, Szeliski R, Kanade T.Incremental estimation of dense
depth maps from image sequence[C]//Proceedings of CVPR'88.Ann Arbor;IEEE,
1988:366-374.
[14] Mori T, Yamamoto M.A dynamic depth extraction method [C] //
Proceedings of Third International Conference on Computer Vision.Osaka:IEEE,
1990:672-676.
[15] Inoue H, Tachikawa T, Inaba M.Robot vision system with a
Correlation chip for real-time tracking, optical flow and depth map generation
[C] //Proceeding of Robotics and Automation.Nice:IEEE, 1992:1621-1626.
[16] Tree image distance measuring method [J] the agricultural mechanics of Hu Tianxiang, Zheng Jiaqiang, Zhou Hongping based on binocular vision
Report, 2010,41 (11): 158-162.
[17] Yu Naigong, Huang Can, Lin Jia are calculated based on robot target positioning distance measuring technique study [J] of monocular vision
Machine measurement and control, 2012,20 (10): 2654-2660.
[18] ranging research [J] the robot in Wu Gang, Tang Zhen people's monocular formula autonomous robot vision guided navigation, 2010,
32 (6): 828-832.
[19] Lu Weiwei, Xiao Zhitao, Lei Meilin study [J] with distance measuring method based on the front vehicles detection of monocular vision
Video Applications and engineering, 2011,35 (1): 125-128.
[20] Wu C F, Lin C J, Lee C Y, et al.Applying a functional neurofuzzy
network to real-time lane detection and front-vehicle distance measurement
[J] .IEEE Transactions on Systems, Man and Cybernetics-Part C:Applications and
Reviews, 2012,42 (4): 577-589.
[21] yellow cloudling, peak, Xu Guoyan wait monocular depth information extraction [J] of based on single width vertical target image
BJ University of Aeronautics & Astronautics's journal, 2015,41 (4): 649-655.
Summary of the invention
The object of the present invention is to provide the extracting method of a kind of novel target and its sub-pixel angle point, the novel target
Optical axis direction angle point accurate can be not only extracted, but also has reasonably evaded perspective transform angle steel joint extraction accuracy and has caused
Influence;The extracting method of the sub-pixel angle point does not need to specify gridiron pattern number in advance and algorithm robustness is high, to abnormal
It is preferable to become more picture extraction effect.
To achieve the above object, the present invention adopts the following technical scheme:
A kind of novel target, including the gridiron pattern target that rectangle black block and rectangular white block are staggeredly stacked, each rectangle
The width of black block and rectangular white block is fixed length and equal, it is characterised in that: the target is horizontal positioned, setting target away from
A row color lump size nearest from camera is d mm*d mm, and subsequent latter row's length is than previous row's length incrementIf
xiFor the actual range of i-th of angle point to camera, yiFor the length of each color lump, then the difference DELTA d of adjacent color lump lengthiAre as follows:
If the relationship between the computational length and actual range of each color lump is f (x), can be obtained according to formula (8):
Therefore, when a target row grid size nearest apart from camera is dmm*d mm, subsequent every row's width fixes,
Length incrementFor d*f (x) mm.
A kind of extracting method of the sub-pixel angle point of novel target described in claim 1, it is characterised in that including such as
Lower step:
It is defined using the checkerboard angle point detection process based on growth of the propositions such as Andreas Geiger two different
Angle point template, a kind of for the angle point parallel with reference axis, another kind is for rotating 45 ° of angle point, according to pixel each in image
Point and the similarity parameter of template find angle point on the image, carry out initial Corner Detection;The position and direction of angle steel joint carry out
Sub-pixel finely extracts, and sub-pixel Corner character is carried out with the cornerSubPix () function in OpenCV, by most
The standard deviation rate of smallization gradient image refines edge direction vector;It is finally label angle point and exports its subpixel coordinate,
Gridiron pattern is grown and rebuild according to energy function, marks angle point, exports sub-pixel angular coordinate.
Compared with prior art, the beneficial effects of the present invention are: due to the adoption of the above technical scheme,
(1) on the basis of traditional gridiron pattern target, existing perspective transform is existing when according to camera shooting level ground
As using a kind of incremental novel chess case marker target of the width equal length of specific standard as experimental material, this target is not
Optical axis direction angle point accurate can be only extracted, and has reasonably been evaded caused by perspective transform angle steel joint extraction accuracy
It influences;
(2) checkerboard angle point detection process by propositions such as Andreas Geiger based on growth and OpenCV are provided
CornerSubPix () function combines, and algorithm does not need to specify gridiron pattern number in advance and algorithm robustness is high, to distortion journey
It is preferable to spend biggish picture extraction effect.
Detailed description of the invention
Fig. 1 is novel target figure;
Fig. 2 is Corner Detection Algorithm implementation flow chart;
Fig. 3 is that camera upward angle of visibility is higher than horizontal line shooting geometrical model figure;
Fig. 4 is camera upward angle of visibility lower than horizontal line shooting geometrical model figure;
Fig. 5 is camera shooting perspective geometry model;
Fig. 6 is each coordinate system schematic diagram in pin-hole model;
Fig. 7 is camera stereo imaging system principle;
Fig. 8 is the relational graph between object ordinate pixel value and imaging angle;
Specific embodiment
In order to be more clear technical solution of the present invention, below in conjunction with attached drawing 1 to 8, the present invention is described in detail.
It should be understood that specific embodiment described in this specification is not intended to limit just for the sake of explaining the present invention
Protection scope of the present invention.
The present invention is a kind of novel target, and interlock stacked gridiron pattern target including rectangle black block and rectangular white block,
The width of each rectangle black block and rectangular white block is fixed length and equal, and the target is horizontal positioned, sets target distance
The nearest row's color lump size of camera is d mm*d mm, and subsequent latter row's length is than previous row's length incrementIf xi
For the actual range of i-th of angle point to camera, yiFor the length of each color lump, then the difference DELTA d of adjacent color lump lengthiAre as follows:
If the relationship between the computational length and actual range of each color lump is f (x), can be obtained according to formula (8):
Therefore, when a target row grid size nearest apart from camera is dmm*d mm, subsequent every row's width fixes,
Length incrementFor d*f (x) mm.
It is verified using novel target of the invention, it is in extremely significant line between the computational length and actual range of each color lump
Property correlativity, therefore can preferably f (x)) be constant.
A kind of extracting method of the sub-pixel angle point of above-mentioned novel target includes the following steps: to utilize Andreas
The checkerboard angle point detection process based on growth of the propositions such as Geiger defines two different angle point templates, and one kind is used for and sits
The parallel angle point of parameter, another kind exist for rotating 45 ° of angle point according to the similarity parameter of pixel each in image and template
Angle point is found on image, carries out initial Corner Detection;The position and direction of angle steel joint carry out sub-pixel and finely extract, and use
CornerSubPix () function in OpenCV carries out sub-pixel Corner character, by minimize the standard of gradient image from
Rate refines edge direction vector;It is finally label angle point and exports its subpixel coordinate, is laid equal stress on according to energy function growth
Gridiron pattern is built, angle point is marked, exports sub-pixel angular coordinate.
Embodiment 1
A kind of depth extraction and passive ranging method of the optimization based on monocular vision, include the following steps:
One, mobile phone camera is demarcated, obtains camera internal parameter and image resolution ratio.The calibration uses Zhang Zhengyou
Standardization, and introduce the improved peg model with nonlinear distortion variable and camera internal parameter is corrected.
The physical size size as pixel each in plane is set first as dx*dy (unit: mm), image coordinate system (x,
Y) coordinate of the origin in pixel coordinate system (u, v) is (u0, v0), (x, y) is the normalized coordinate of picture point in real image, figure
Any pixel meets following relationship in two coordinate systems as in:
fx、fyFor the normalization focal length in x-axis and y-axis, any point P in camera coordinates systemc(Xc, Yc, Zc) project to image
It is (x on coordinate systemc, yc, f), it is f with initial point distance that image coordinate system plane is vertical with optical axis z-axis, according to similar triangles original
Reason it follows that
Introduce the improved peg model with nonlinear distortion variable, including the diameter as caused by lens shape defect
To distortion and since there are tangential distortion caused by different degrees of bias, radial distortion mathematical models for optical system are as follows:
Wherein r2=x2+y2, (x ', y ') it is sat for the normalization of the ideal linearity camera coordinates system without distortion term after correction
Scale value, radial distortion value is related with the position of picture point in the picture, and the radial distortion value at image border is larger,
Tangential distortion model mathematical model are as follows:
It wherein include k1、k2、k3、p1、p2Totally 5 kilrrfactors obtain distortion correction Function Modules by formula (3), (4)
Type is as follows:
There are following relationships for conversion from world coordinate transformation to camera coordinates:
Pc=R (PW- C)=RPW+T (6)
Convolution (1)~(6), may be expressed as: with homogeneous coordinates and matrix form
Mint、MextIt is the inside and outside parameter matrix of camera calibration respectively, wherein camera internal parameter includes image center pixel
Value u0、v0, fx、fyFor in x-axis and y-axis normalization focal length, by Java combination OpenCV realize mobile phone camera calibration, acquisition
Inner parameter described in mobile phone camera, camera lens distortion parameter and image resolution ratio vmax、umax;Calibration gained camera internal ginseng
Number are as follows: fx=3486.5637, u0=1569.0383, fy=3497.4652, v0=2107.9899, image resolution ratio 3120
× 4208, camera lens distortion parameter are as follows: [0.0981, -0.1678,0.0003, -0.0025,0.0975],
Two, it by the acquisition to novel target image, establishes camera depth and extracts model.Existing target is that length and width are equal
Black and white chessboard case marker target.The difference of modulation of the invention and existing target is, setting target is apart from camera nearest
One row's grid size is d*d mm, and the width of subsequent every row's grid is to fix, and the previous row's value added of the latter parallelism of length is
X in following formulaiFor the actual range of i-th of angle point to camera, yiFor the length of each grid, then adjacent square length
Difference DELTA diAre as follows:
If the relationship between the computational length and actual range of each grid is f (x), can be obtained according to formula (8):
Through Pearson correlation analysis, it is between length and actual range extremely significant linear relationship (p < 0.01),
Correlation coefficient r be equal to 0.975, by least square method can in the hope of calculate f (x) derivative f ' (x),
Therefore, when a target row grid size nearest apart from camera is d*d mm (the survey when range of d takes 30~60mm
Accuracy of measurement highest) when, subsequent every row's width fixes, length incrementFor d*f ' (x) mm, novel target as shown in Figure 1,
There are the angles that perspective transform phenomenon makes Harris and Shi-Tomasi etc. common when object on shooting level ground
Point detection algorithm robustness is poor, and can also detect mistake when camera is larger along camera coordinates system ox axis rotated counterclockwise by angle
It loses, therefore the checkerboard angle point detection process based on growth of the propositions such as present invention combination Andreas Geiger and OpenCV are mentioned
The comerSubPix () function of confession carries out the detection of sub-pixel corner location, and the algorithm robustness is high, larger to distortion degree
Picture extraction effect it is preferable,
The implementation process of Corner Detection Algorithm as shown in Fig. 2, the above-mentioned modulation of the present invention sub-pixel angle point grid
Step are as follows:
1) angle point is found according to the similarity parameter of pixel each in image and template on the image, positions target angle point position
It sets;
Two different angle point templates are defined first, and a kind of for the angle point parallel with reference axis, another kind is for rotating
45 ° of angle point, each template are made of 4 filtering cores { A, B, C, E }, with carrying out convolution operation with image later;Then sharp
The similarity of each inflection point and angle point is calculated with the two angle point templates:
WhereinIndicate that convolution kernel X (X=A, B, C, E) and template i (i=1,2) are responded in the convolution of some pixel,
WithIt indicates the similarity of two kinds of possible inflection points of template i, calculates the available angle of similarity of each pixel in image
Point similar diagram;It is handled using non-maxima suppression algorithm angle steel joint pixel map to obtain candidate point;Then it is counted with gradient
Method verify these candidate points in the nxn neighborhood of a local, first local area grayscale image carries out sobel filtering, then counts
Weighting direction histogram (32bins) is calculated, finds two therein main mode γ with meanshift algorithm1And γ2;According to
The direction at edge, for desired gradient intensityConstruct a template T.(* indicates cross-correlation operation symbol)
Then product with angle point similarity is judged just to obtain initial angle point with threshold value as angle point score value.
2) the position and direction progress sub-pixel of angle steel joint finely extracts;
Sub-pixel Corner character is carried out with the cornerSubPix () function in OpenCV, by Corner character to sub- picture
Element, to obtain the other Corner Detection effect of sub-pixel;To refine edge direction vector, it is minimized according to image gradient value
Standard deviation rate:
WhereinIt is adjacent pixel collection, the gradient value m with module ii
=[cos (γi)sin(γi)]TMatch.(ask calculation scheme according to document Geiger A, Moosmann F, Caret
a1.Automatic camera and range sensor calibration using a single shot[C]//
Robotics and Automation (ICRA), 2012 IEEE International Conference on.IEEE,
2012:3936-3943.)
3) it is finally label angle point and exports its subpixel coordinate, gridiron pattern is grown and rebuild according to energy function, marks
Remember angle point, exports sub-pixel angular coordinate;
According to document " Geiger A, MoosmannF, Caret al.Automatic camera and range
Sensor calibration using a single shot [C] //Robotics and Automation (ICRA),
2012IEEE International Conference on.IEEE, the method that 2012:3936-3943. " is provided optimize energy
Function rebuilds gridiron pattern and marks angle point, energy growth function formula are as follows:
E (x, y)=Ecorners(y)+Estruct(x, y) (16)
Wherein, EcornersIt is the negative value of current chessboard angle point sum, EstructIt is of two adjacent corner points and prediction angle point
With degree;Angle point pixel value is exported by OpenCV.
Linear correlative analysis is carried out to image objects angle, ordinate pixel value using SPSS 22, exports Pearson phase
Relationship number, output Pearson correlation coefficient r are as shown in table 2.It is verified, under equipment and camera the rotation angle of different model, object
Body ordinate pixel value and actual imaging angle are in extremely significant negative correlativing relation (p < 0.01), in addition, the present invention is also to different
The slope difference of linear function carries out between object ordinate pixel value and imaging angle under device model and camera rotation angle
Significance test, the results showed that, under distinct device model and camera rotation angle object ordinate pixel value and imaging angle it
Between linear function slope differences it is heteropolar significant (p < 0.01), illustrate that the equipment of different model and camera rotation angle, depth mention
Modulus type is different,
2 object ordinate pixel value of table and imaging angle related coefficient
Table 2 Pearson correlation coefficient of image ordinate pixel
values and actual imaging angles
Note: * * indicates extremely significant (p < 0.01).
Note:**represents very significant correlation (p < 0.01)
Verified, equipment and camera with model rotate under angle, and object ordinate pixel value is in actual imaging angle
Extremely significant negative correlativing relation (p < 0.01), correlation coefficient r are greater than 0.99.In addition, the present invention is also to different device model and phase
The slope difference that machine rotates linear function between object ordinate pixel value and imaging angle under angle carries out significance test.Knot
Fruit show distinct device model and camera rotation angle under between object ordinate pixel value and imaging angle linear function it is oblique
Rate difference is extremely significant (p < 0.01), illustrates the equipment and camera rotation angle of different model, depth extraction model is not
Together.
Abstract function is set according to the linear relationship between object imaging angle α and ordinate pixel value v, establishes and contains mesh
Mark tri- object imaging angle α, ordinate pixel value v and camera rotation angle β parameter space relational models, i.e. α=F (v, β),
Under equipment and camera the rotation angle of different model, subject ordinate pixel value and imaging angle are in pole
Significant negative linear correlation, and the slope of the linear relationship and intercept are different, therefore set:
α=F (v, β)=av+b (17)
Wherein parameter a, b is related with camera model and camera rotation angle,
When α is minimized α=αminWhen=90- θ-β, θ is the half at camera vertical field of view angle, i.e. subject projects
When to picture lowermost end, v=vmax(vmaxFor camera CMOS or ccd image sensor column coordinate valid pixel number), substitute into formula
(17) it can obtain:
90- β-θ=avmax+b (18)
Work as αminWhen+2 90 ° of θ >, i.e. θ > β, camera upward angle of visibility is higher than horizontal line at this time, and camera shoots perspective geometry model
Such as Fig. 3, ground level unlimited distance, α is infinitely close to 90 °, and v is substantially equal to v at this time0-tanβ*fy, fyFor phase under pixel unit
The focal length of machine, when β rotates counterclockwise for negative value, that is, camera also similarly, therefore, substituting into formula (17) can obtain:
90=a (v0-tanβ·fy)+b (19)
Work as αminWhen+2 90 ° of θ <, i.e. θ < β, camera upward angle of visibility is lower than horizontal line at this time, and camera shoots perspective geometry model
If Fig. 4, ground level unlimited distance object imaging angle α are maximized, αmax=αminWhen+2 θ=90- β+θ, i.e. subject
When body projects to picture highest point, v=0, substituting into formula (17) can be obtained:
90- β+θ=b (20)
According to pinhole camera aufbauprinciple, the tangent value of the camera vertical field of view angle θ of half is schemed equal to camera CMOS or CCD
As the half of sensor side length is divided by camera focus, therefore θ can be calculated:
L in formula (21)CMOSFor the side length of camera CMOS or ccd image sensor, convolution (18)~(21), F (α, β)
Are as follows:
δ is camera nonlinear distortion variable error in formula (10), in conjunction with mobile phone camera shooting height h, according to trigonometric function
Principle establishes mobile phone camera depth extraction model:
3 mobile phone camera inner parameter of millet is substituted into formula (10) to obtain:
The specific depth extraction model of the equipment is obtained according to trigonometric function principle are as follows:
Three, by the Image Acquisition to target to be measured, target point pixel value u, v are obtained.Figure is carried out by mobile phone camera
As acquisition, perspective geometry model such as Fig. 5 is established, wherein f is camera focus, and θ is the half at camera vertical field of view angle, and h is camera
It takes pictures highly, β is rotation angle of the camera along camera coordinates system ox axis, and camera rotates clockwise β value and is positive, is negative counterclockwise, β value
It is obtained by camera internal gravity sensor, α is object imaging angle;The camera lens obtained in conjunction with first step camera calibration
Distortion parameter carries out nonlinear distortion correction to radial distortion existing for image and tangential distortion error;By the ideal after correction
Linear normalization coordinate value (x, y) substitutes into formula (1), image each point pixel coordinate value after asking calculating to correct, by bilinearity
Image after slotting method corrects pixel value progress interpolation processing after correction;Using computer vision and image procossing
Technology pre-processes the image after correction, including image binaryzation, morphological image operation and the inspection of object contour edge
It surveys, obtains the edge of object, and then calculate the geometric center point pixel value (u, v) at the edge of object and ground face contact.
Use (MI 3) camera of millet mobile phone 3 as picture collection equipment, carries out picture collection by camera trivets, and
The height h for measuring camera to ground is equal to 305mm, and camera rotation angle β is equal to 0 °,
Nonlinear distortion correction is carried out to radial distortion existing for image and tangential distortion error;
The camera lens distortion parameter obtained according to first step camera calibration: [0.0981, -0.1678,0.0003, -
0.0025,0.0975], ideal linearity normalized coordinate value after correcting is calculated according to formula (5):
Image each point pixel coordinate value after correcting is calculated in conjunction with formula (1) and (2), is handled and is rectified by bilinear interpolation
Image after just;
The present invention measures its depth and distance by taking the cuboid box being placed on level ground as an example, first to acquisition
Image carries out binary conversion treatment, then carries out edge detection to cuboid box using Canny operator, extracts object profile.
Extracting cuboid box bottom margin central point pixel value is (1851.23,3490).
Four, the camera internal parameter and target point pixel value and combining camera depth extraction mould of above-mentioned steps acquisition are utilized
Type calculates object to be measured object image and takes up an official post meaning point to the distance between mobile phone camera L.Angle beta and half are rotated according to camera
Camera vertical field of view angle θ between size relation, select corresponding depth model, ask the camera internal of calculation to join above-mentioned steps
Number image center pixel value v0, normalized focal length f in y-axisyAnd image resolution ratio vmaxAnd above-mentioned steps ask the to be measured of calculation
Object ordinate pixel value v, camera rotation angle beta and mobile phone camera shooting height h substitute into the depth extraction model, calculate
Target point depth value D,
Fig. 6 is camera stereo imaging system schematic diagram, and midpoint P is camera position, and the straight line and image where point A, B are flat
Face is parallel, and coordinate of the A under camera coordinates system is (X, Y, Z), and the coordinate of point B is (X+Tx, Y, Z), project to plane of delineation A '
(xl, yl)、B’(xr, yr) on, it can be obtained according to formula (2):
In conjunction with formula (1) and formula (22), the two o'clock A ' that Y value is identical and depth Z is equal, the horizontal parallax of B ' can be derived
D:
It is thus known that camera focus f, image center coordinate (u0, v0) and as pixel each in plane in the direction of the x axis
Physical size size dx, in conjunction with depth extraction model, calculate target point to optical axis direction vertical range Tx:
In pin-hole model, the transformational relation between each coordinate system of camera is as shown in fig. 7, calculating target point depth value D
And its vertical range T to optical axis directionxOn the basis of, according to formula (11)~(12), arbitrary point on image can be calculated
To shooting the distance between camera L:
Camera internal parameter, camera are taken pictures height h, rotation angle beta and cuboid box bottom margin central point is vertical sits
Mark pixel value v, which substitutes into formula (24), can calculate the object actual imaging angle equal to 69.58 °.According to trigonometric function original
Reason calculates target point depth value D (unit: mm):
D=305*tan 69.58 °=819.21 (27)
By parameter fx, u0, D and cuboid box bottom margin central point abscissa pixel value u substitute into formula (12) and can count
Vertical range T of the calculation object geometric center point to optical axis directionx:
Therefore, which reaches shooting camera in the distance L of floor projection point are as follows:
By tape measuring, distance of the cuboid box apart from camera floor projection point is 827mm, therefore uses the present invention
Carry out ranging, relative error 0.62%.
Embodiment 2
Below by taking millet 3 (MI 3) mobile phone as an example, novel target and its sub-pixel angle point of the invention are illustrated
Extracting method.
One, mobile phone camera is demarcated, obtains camera internal parameter and image resolution ratio
Use ranks number be 8*9 size be 20*20 gridiron pattern scaling board as the experimental material of camera calibration, lead to
The scaling board picture that 3 mobile phone camera of millet acquires 20 different angles is crossed, using OpenCV according to above-mentioned improved with non-thread
The camera calibration model of sex distortion item demarcates millet 3 (MI 3) mobile phone camera,
Scaling board picture is read using fin () function first, and obtains the image of the first picture by .cols .rows
Resolution ratio;Then sub-pixel angle point in scaling board picture is extracted by find4QuadCornerSubpix () function, be used in combination
DrawChessboardCorners () function marks angle point;CalibrateCamera () function is called to demarcate camera,
It is used for obtained camera interior and exterior parameter to carry out projection again to the three-dimensional point in space calculating, obtains new subpoint, calculate
Error between new subpoint and old subpoint;Camera internal reference matrix and distortion parameter are exported and save,
Calibration gained camera internal parameter are as follows: fx=3486.5637, u0=1569.0383, fy=3497.4652, v0=
2107.9899, image resolution ratio is 3120 × 4208, camera lens distortion parameter are as follows: [0.0981, -0.1678,0.0003, -
0.0025,0.0975],
Two, it by the acquisition to novel target image, establishes camera depth and extracts model
The initial experiment material that the present invention uses traditional gridiron pattern scaling board of 45*45mm to design as target, to calculate
The difference of adjacent square length, the present invention devise 6 groups of experiments, extract traditional X-comers that grid size is 45*45mm
Value, and ask calculate adjacent corner points between the actual physics distance that is represented under world coordinate system of unit pixel, to guarantee to indulge between angle point
Coordinate pixel value difference is roughly equal, the length y of each gridiValue it is as shown in table 1,
The calculating width of each grid of table 1
Table 1 Computing width of each grid
Through Pearson correlation analysis, it is between length and actual range extremely significant linear relationship (p < 0.01),
Correlation coefficient r is equal to 0.975, can be in the hope of derivative f ' (x)=0.262 of calculating f (x), therefore, when the mark by least square method
When a range row grid size nearest from camera is 45*45mm, then every row's width is fixed, width value added Δ d is
11.79mm,
The angle point of the novel target is extracted by the Robust Algorithm of Image Corner Extraction in specific implementation step,
The present invention use millet 3 choose respectively millet, Huawei, tri- kinds of different models of iPhone smart phone as image
Equipment is acquired, camera rotates angle beta=0 °.Data are acquired using the Corner Detection Algorithm, and it is quasi- to carry out function to its relationship
It closes, Fig. 8 is the relationship between the ordinate pixel value fitted and image objects angle, can according to angle point grid data and Fig. 8
, 3 mobile phone of millet depth extraction model when camera rotates angle beta=0 ° are as follows:
α=- 0.015v+112.6 (30)
Extracting cuboid box bottom margin central point pixel value is (1762.05,2360), by cuboid box bottom sides
Edge central point ordinate pixel value v, which substitutes into formula (29), can calculate the object actual imaging angle equal to 74.2 °.According to
Trigonometric function principle calculates target point depth value D (unit: mm):
D=305*tan 74.2 °=1077.85 (31).