The spatial point coordinate measuring method of one camera multi-angle
Technical field
The present invention relates to a kind of vision measuring method, especially a kind of space point coordinate measurement side of one camera multi-angle
Method belongs to vision measurement field.
Background technique
Currently, there are commonly three-dimensional coordinates measurement method and vision coordinate measurement methods for measurement of coordinates, three coordinates industrially are surveyed
Amount machine can complete the precise measurement of complex parts, but the measurement of contact is not only time-consuming, but also be easy to scratch tested part,
Measurement range is also limited, and measuring device volume is huge, higher to operating environment requirements;Vision measurement is since non-contact, environment is suitable
Answering property is good and quickly develops in every field, and existing spatial point coordinate vision measurement technology is divided into monocular vision measuring technique
With multi-vision visual measuring technique.
Monocular vision measuring technique uses a video camera as visual sensor, utilizes the geometrical constraint between spatial point
Knowledge establishes solution relationship of the spatial point with corresponding picture point, completes the measurement of spatial point coordinate, although this method design is simple,
Measurement flexibly, but is limited to that each spatial point has and only a perspective projection straight line is corresponding to it, and lacks spatial point depth letter
Breath.
Multi-vision visual measuring technique uses two or multiple cameras as visual sensor, although can complete in visual field
The measurement of any spatial point coordinate, measurement accuracy is high, but due to using multiple cameras, public view field is small, and expensive.
Summary of the invention
The purpose of the present invention is to solve the defects of the above-mentioned prior art, provide a kind of space of one camera multi-angle
Point coordinate measurement method, this method are realized the three-dimensional coordinate measurement of space object surface point-of-interest using single camera, are
Dimensional measurement, 3D modeling, emulation, the verifying of multi-body mechanical system provide the foundation.
The purpose of the present invention can be reached by adopting the following technical scheme that:
A kind of spatial point coordinate measuring method of one camera multi-angle, which comprises
World coordinate system is defined on jobbie, N number of mark point known to coordinate is pasted on the surface of the object, together
When on the point of interest of target surface binding mark point;Wherein, N≤6;
It known to coordinate acquisition and interested label point image, measures mark point under M angle using single camera and exists
Pixel coordinate under all angles;Wherein, M≤2;
According to national forest park in Xiaokeng, established using transmission matrix transformation linear between world coordinate system and pixel coordinate system
Transformation relation, and the 2N system of linear equations that N number of mark point is established is solved using least square method, calibration obtains camera each
Inside and outside parameter under a angle;
According to same point of interest, the inside and outside parameter of corresponding pixel coordinate and camera determines that M space is straight under M angle
Line solves a solution of the midpoint as point of interest of straight line common vertical line section two-by-two, point of interest is obtained between M space line
M* (M-1)/2 solution, the optimal solution of point of interest is determined using least square method.
Further, in N number of mark point, at least 4 points not in the same plane.
Further, the linear transformation relationship between the world coordinate system and pixel coordinate system is as follows:
Wherein, u and v is coordinate of the subpoint in pixel coordinate system;X, y, z is seat of the point of interest under world coordinate system
Mark;Li(i=1,2 ... 11) for table contain the value of camera inside and outside parameter.
Further, if by bu=b/fu, bv=b/fvAnd D=- (x0r31+y0r32+z0r33), then parameter Li(i=
1,2 ... 11) it is expressed as follows:
Wherein, u0、v0For the pixel coordinate of camera optical axis and the intersection point as plane;fu、fvIt is single pixel in the direction u and v
Actual size;B is the focal length of camera;rij(i, j=1,2,3) is the element of spin matrix R in outer parameter;x0、y0、z0For phase
Coordinate of the machine coordinate origin under world coordinate system.
Further, inside and outside parameter of the camera under all angles includes four intrinsic parameter u0、v0、fuAnd fv, and
Two outer parameter R3×3And T3×1;Wherein, u0、v0The pixel coordinate of camera optical axis and the intersection point as plane, fu、fvFor single pixel
Actual size in the direction u and v;R is the spin matrix of camera coordinates system and world coordinate system, and T is camera coordinates system and the world
Translation vector between coordinate system.
Further, the space line by the optical center of camera, point of interest and the subpoint as plane 3 lines
It determines.
Further, two planes that the common vertical line of the straight line two-by-two section is respectively determined with common vertical line section by two straight lines
Intersection determines.
Further, described to determine that the optimal solution of point of interest refers to the point and M* (M-1)/2 acquired using least square method
The quadratic sum of the distance of each point is minimum in a point.
The present invention have compared with the existing technology it is following the utility model has the advantages that
1, the present invention pass through N number of mark point known to coordinate in space and its pixel coordinate measured under each angle one
One corresponding relationship solves 2N system of linear equations using least square method, realizes the camera calibration under all angles, then sharp
With space geometry method, the corresponding M space line equation of point of interest and two-by-two the common vertical line section equation of straight line are solved, minimum is utilized
Square law determines that the optimal solution at common vertical line section midpoint is the measured value of point of interest.This method measurement accuracy reaches, and sits with binocular
Mapping amount is compared, and cost is greatly saved.
2, the static coordinate measurement of the achievable body surface point of interest of the present invention can solve any body using these points
Centroid position and attitude angle provide necessary means for dimensional measurement, 3D modeling, simulating, verifying and Optimized System Design.
3, the invention avoids scientific research personnel when drawing three-dimensional model is used to emulate, and measures part size one by one with ruler
Time-consuming and laborious problem, greatly facilitates scientific research personnel.
Detailed description of the invention
Fig. 1 is the spatial point coordinate measuring method flow chart of the one camera multi-angle of the embodiment of the present invention 1.
Fig. 2 is the national forest park in Xiaokeng schematic diagram of the embodiment of the present invention 1.
Fig. 3 is the space point coordinate measurement site layout project figure of the embodiment of the present invention 2.
Fig. 4 is the schematic diagram of the space multistory geometry solving coordinate optimal solution of the embodiment of the present invention 2.
Wherein, 1- iron sheet case, 2- first demarcate paper, and 3- second demarcates paper, the first shooting angle of 4-, the second shooting angle of 5-
Degree, 6- third shooting angle, 7- camera coordinates system origin (optical center), 8- test ground.
Specific embodiment
Present invention will now be described in further detail with reference to the embodiments and the accompanying drawings, but embodiments of the present invention are unlimited
In this.
Embodiment 1:
As shown in Figure 1, present embodiments providing a kind of spatial point coordinate measuring method of one camera multi-angle, this method packet
Include following steps:
S101, world coordinate system is defined on jobbie, N number of label known to coordinate is pasted on the surface of the object
Point, while the binding mark point on the point of interest of target surface;Wherein, N≤6.
In this step, N number of mark point is BMW mark point, for realizing accurate as plane projection point in image procossing
It extracts, and in N number of mark point, at least 4 points not in the same plane.
S102, known to coordinate acquisition and interested label point image, label is measured under M angle using single camera
Pixel coordinate of the point under all angles;Wherein, M≤2.
In this step, pixel coordinate of the mark point under all angles is measured using TEMA software.
S103, according to national forest park in Xiaokeng, established between world coordinate system and pixel coordinate system using transmission matrix transformation
Linear transformation relationship, and solve the 2N system of linear equations that N number of mark point is established using least square method, demarcate and obtain phase
Inside and outside parameter of the machine under all angles.
Fig. 2 is the schematic diagram of national forest park in Xiaokeng, this step can represent world coordinate system and pixel according to this model
The linear transformation relationship of coordinate system, specific derivation relationship are as follows:
1) camera coordinates system and the relationship of world coordinate system may be expressed as:
Wherein, (Xc, Yc, Zc) it is coordinate of the spatial point under camera coordinates system;The spin matrix that R is 3 × 3;(x, y, z)
For the world coordinates of spatial point;(x0, y0, z0) it is coordinate of the camera coordinates system origin under world coordinate system.
2) relationship of image coordinate system and camera coordinates system may be expressed as:
Wherein, b is camera focus,For the coordinate as plane projection point under image coordinate system.
3) relationship of pixel coordinate system and image coordinate system may be expressed as:
Wherein, ku, kvRespectively full-size(d) of the single pixel on the direction u and v;u0, v0For the pixel coordinate of focus.
4) relationship of pixel coordinate system and world coordinate system may be expressed as:
Wherein, Zc=r31(x-x0)+r32(y-y0)+r33(z-z0);rij(i, j=1,2,3) is the member in spin matrix R
Element.
It further spreads out to obtain:
Wherein, u and v is coordinate of the subpoint in pixel coordinate system;X, y, z is seat of the point of interest under world coordinate system
Mark;Li(i=1,2 ... 11) for table contain the value of camera inside and outside parameter.
If by bu=b/fu, bv=b/fvAnd D=- (x0r31+y0r32+z0r33), then parameter Li(i=1,2 ...
11) it is expressed as follows:
Wherein, u0、v0For the pixel coordinate of camera optical axis and the intersection point (focus) as plane;fu、fvIt is single pixel in u
With the actual size in the direction v;B is the focal length of camera;rij(i, j=1,2,3) is the element of spin matrix R in outer parameter;x0、
y0、z0For coordinate of the camera coordinates system origin under world coordinate system.
In this step, inside and outside parameter of the camera under all angles includes four intrinsic parameter u0、v0、fuAnd fvAnd two
Outer parameter R3×3And T3×1;Wherein, u0、v0As described above, for the pixel coordinate of camera optical axis and the intersection point as plane, fu、fvAs above
It is described, it is actual size of the single pixel in the direction u and v;R is the spin matrix of camera coordinates system and world coordinate system, and T is phase
Translation vector between machine coordinate system and world coordinate system.
S104, according to same point of interest, the inside and outside parameter of corresponding pixel coordinate and camera determines that M item is empty under M angle
Between straight line, the midpoint for solving straight line common vertical line section two-by-two solves as one of point of interest, obtains interest between M space line
M* (M-1)/2 solution of point, the optimal solution of point of interest is determined using least square method.
In this step, the space line by the optical center of camera, point of interest and the subpoint as plane 3 lines
It determines, M space line is since the presence of calibrated error under all angles is without intersecting at the same point of interest;Straight line two-by-two
The intersection for two planes that common vertical line section is respectively determined with common vertical line section by two straight lines determines;It is determined using least square method emerging
The optimal solution of interest point refers to quadratic sum of the point acquired at a distance from each point in M* (M-1)/2 point for minimum.
Embodiment 2:
As shown in figure 3, the site layout project figure of the space point coordinate measurement for the present embodiment, test ground 8 has been paved with side length
For the floor tile of 50cm × 50cm, the iron sheet case 1 that shape is cuboid is moved first, makes two right-angle sides and the floor of its bottom end
Two right-angle sides of brick are overlapped;Then two chequered with black and white calibration paper, two calibration are pasted on two perpendiculars of iron sheet case 1
The first calibration paper 2 of paper difference and the second calibration paper 3, guarantee that a line of two calibration paper is overlapped with a seamed edge of iron sheet case, two
The upper right-angle side for opening calibration paper intersects at a point;Wherein, the side length of element of the first calibration paper 2 is 30mm × 30mm, the second calibration
The side length of element of paper 3 is 25mm × 25mm, establishes world coordinate system as shown in the figure, then any angle point (mark on two calibration paper
Fixed point) coordinate under world coordinate system can facilitate reading;The camera of test is that Vision Research company of the U.S. produces
Phantom M310 high speed camera, the position of mobile camera, and it is leveled, make camera coordinates system origin (optical center) as far as possible
7 project on the angle point of floor tile, can conveniently obtain optical center 7 under world coordinate system by the side length of floor tile and ruler in this way
Coordinate, this coordinate can verify that the accuracy of camera calibration result, the optical center coordinate under the first shooting angle 4 be (- 1, -0.5,
0.23) m adjusts the focal length of camera, makes the picture of acquisition than more visible, the picture collection under the first shooting angle 4 of completion, the figure
1280 × 800 pixel of resolution ratio of piece, identical step, completes the bat under the second shooting angle 5 and third shooting angle 6 according to this
It takes the photograph, wherein the optical center coordinate under the second shooting angle 5 is (- 1.5, -1,0.158) m, photo resolution is 1280 × 720 pixels,
Optical center coordinate under third shooting angle 6 is (- 1, -1.5,0.164) m, and photo resolution is 1280 × 800 pixels.
Five angle points (calibration point) are respectively selected in two calibration paper, obtain their coordinates under world coordinate system, then
With the corresponding pixel of calibration point each under TEMA motion analysis software three shooting angle of acquisition of Image Systems company of Sweden
Coordinate, specific value are as shown in table 1 below:
The corresponding pixel coordinate of each calibration point under 1 three shooting angle of table
The world coordinates of above-mentioned ten calibration points and pixel coordinate are substituted into the formula (1) of above-described embodiment 1, and arranges and is
Matrix form is as follows:
It is more than the number of unknown quantity, i.e. A for equation numbern×mxm×1=bn×1(n > m), if ATA is reversible, then equation group is deposited
In least square solution, x=(ATA)-1ATb。
Therefore, the present embodiment can solve corresponding [L under three angles1 L2 K L11]T:
The corresponding solution of first shooting angle:
[- 289.9,1729.4,4.2,549.2,337.6,222.6, -1658.5,775.0,0.8,0.5,0]
The corresponding solution of second shooting angle:
[- 321.1,1057.9, -3.1,573.7,162.6,140.2, -1052,542.3,0.5,0.3,0]
The corresponding solution of third shooting angle:
[- 681.4,935.4, -3.7,672.3,129.5,210.2, -1099.2,588.4,0.3,0.5,0]
11 obtained parameters will be solved to substitute into the matrix form arranged above, and it is orthogonal for combining spin matrix R
Matrix, i.e. each row of matrix R or each column are unit vector and pairwise orthogonal, can solve corresponding phase under three shooting angle
Machine inside and outside parameter, as shown in table 2 below:
Corresponding camera inside and outside parameter under 2 three shooting angle of table
The size sensor for the camera that the present embodiment uses is 25.6mm × 16.0mm, and resolution ratio is 1280 × 800 corresponding
Pixel size ku=kv=20um, ideal focal coordinates (u0, v0)=(640,400), resolution ratio are 1280 × 720 corresponding
Pixel size be ku=20um, kv=22.22um, ideal focal coordinates (u0, v0)=(640,360), to three angles
Under focal coordinates obtained by calibrating compared with ideal value, it is found that the maximum deviation of u direction is 5 pixels, the maximum in the direction v
Deviation is 27 pixels, is compared to the optical center coordinate obtained under three angles with obtained optical center coordinate is measured in advance, is sent out
The existing direction x maximum deviation is 8.32cm, and the direction y maximum deviation is 8cm, and the direction z maximum deviation is 2cm, the deviation in the direction x and y
It is why big, it is because it is difficult to ensure that optical center projects on the angle point of floor tile, but z coordinate measures when adjusting camera
It is more convenient, to sum up comparing result, it is seen that the calibration result obtained with the method is reliable.
As shown in figure 4, realizing that the measurement of coordinates space geometry of spatial point is illustrated using three angle of one camera for the present embodiment
Figure, subpoint of the spatial point P on the pixel planes of three angles are P1、P2、P3, the theoretically optical center of camera, picture point, space
Point-blank, but due to the presence of calibrated error, the line of optical center and picture point will not be by spatial point, that three angles for point
Three space lines generated two-by-two specifically ask using the midpoint of the common vertical line section of different surface beeline as spatial point coordinate solution by antarafacial
Steps are as follows for solution:
1) an angle point P is first chosen on the calibration paper for be pasted on iron sheet case 1, its coordinate under world coordinate system is
(0,0.125,0.175), picture point pixel coordinate of the P point under three angles are as follows: P1(725,484.50)、P2(679.25,
361.75)、P3(746,399) straight line L is determined by the coordinate of optical center and picture point under world coordinate system1、L2、L3Equation:
L1:
L2:
L3:
2) vector of common vertical line section can be determined by the vector product of two different surface beelines between different surface beeline, two different surface beeline difference
Can determine two planes with common vertical line, the normal vector of plane is determined by one of different surface beeline and the vector product of their common vertical line sections,
Then the common vertical line section of two different surface beelines is just the intersection of the two planes, and three space lines can determine three common vertical lines two-by-two
Section, common vertical line section equation are as follows:
3) midpoint coordinates for solving common vertical line, seeks the intersecting point coordinate of different surface beeline and common vertical line, then common vertical line section respectively
Midpoint coordinates is the half that the two intersection point respective coordinates are added, common vertical line midpoint M12、N13、F23It is expressed as follows:
M12(- 0.0005,0.1298,0.1818)
N13(- 0.0032,0.1143,0.1558)
F23(0.0001,0.1250,0.1659)
4) least square method is utilized, can determine that spatial point optimal solution meets the quadratic sum minimum to three point distances, the point
Coordinate is that the centre coordinate of 3 points of composition triangles is (M12+N13+F23)/3, i.e. (- 0.0012,0.1230,0.1678), it is required
The true coordinate (0,0.125,0.175) for obtaining coordinate and the point compares, and the direction x grid deviation is 1.2mm, the direction y grid deviation
For 2mm, the direction z grid deviation is 1cm, and calibration point pixel coordinate error and calibration point location error can all generate calibration result
It influences, so the coordinate measuring method of the present embodiment can there is a certain error, but can satisfy the measurement request of certain precision.
In conclusion the present invention realizes the measurement of spatial point coordinate, and measurement accuracy is 1cm, is multi-body mechanical system
Dimensional measurement, 3D modeling, emulation, verifying provide the foundation.
The above, only the invention patent preferred embodiment, but the scope of protection of the patent of the present invention is not limited to
This, anyone skilled in the art is in the range disclosed in the invention patent, according to the present invention the skill of patent
Art scheme and its inventive concept are subject to equivalent substitution or change, belong to the scope of protection of the patent of the present invention.