Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Please refer to fig. 1, which is a block diagram of a monocular distance measuring device according to an embodiment of the present invention. The monocular distance measuring device 1 is used for determining the distance from the fisheye camera to the plane where the checkerboards are located according to the fisheye image with the checkerboards and the fisheye image with the larger distortion obtained by the fisheye camera. The monocular distance measuring device 1 comprises an acquisition device 10, an extraction device 20, a corner coordinate determination device 30, a correction device 40, a length determination device 50 and a distance determination device 60.
The acquiring device 10 is used for acquiring the fisheye image containing the checkerboard, which is shot by the fisheye camera.
The fisheye camera has a short focal length and a large viewing angle, and takes a fisheye image with a larger viewing range than an image taken by a common camera, and the taken image (as shown in fig. 2) has larger distortion.
The extracting device 20 is configured to extract an effective region from the obtained fisheye image.
In this embodiment, the shape of the effective region of the fisheye image is a circle-like shape formed by cutting off a portion of the top and bottom of the circle. In other embodiments, the shape of the effective region of the fisheye image may be a circle or a circle-like shape formed by cutting off a portion of the left end and the right end of the circle. The region outside the effective region of the fisheye image is black. The extraction of the effective region can adopt a least square fitting method, a line-by-line and column-by-column scanning algorithm, or an area statistical algorithm and the like. The least square fitting method, the row-by-row scanning algorithm, and the area statistical algorithm are prior art, and are not described herein again. In this embodiment, the checkerboard in the active area occupies the entire active area. In other embodiments, the checkerboard in the active area may occupy a portion of the entire active area, such as 10%, 20%, 30%, 40%, or 70% of the entire active area, etc.
The corner coordinate determination device 30 is configured to determine the corner coordinates of the checkerboard in the active area through corner detection.
In this embodiment, the corner coordinate determining apparatus 30 is specifically configured to:
establishing a fisheye image coordinate system by taking the upper left corner point of the effective area as a coordinate origin, taking the horizontal right direction as the positive direction of an X axis and taking the vertical downward direction as the positive direction of a Y axis;
as shown in fig. 3, a fisheye image coordinate system is established with the upper left corner point a of the effective area as the origin of coordinates, the horizontal right direction as the positive direction of the X axis, and the vertical downward direction as the positive direction of the Y axis; the area of the circle or the shape similar to the circle is an effective area, and the upper left corner point A is a square upper left corner point tangent to the effective area.
And determining coordinates of the corner points of the checkerboard in the effective area in a fisheye image coordinate system through corner point detection.
The corner detection may be a Harris detection algorithm, a growth-based checkerboard corner detection algorithm, or a SUSAN detection algorithm, etc. The Harris detection algorithm, the growth-based checkerboard corner detection algorithm, and the SUSAN detection algorithm are prior art, and are not described herein again.
The correcting device 40 is configured to convert the coordinates of the corner points of the checkerboard in the effective area into the coordinates of the corner points of the undistorted checkerboard according to a stereoscopic projection correction algorithm.
The correction device 40 is specifically configured to:
determining the height of the effective area, the width of the effective area, the center of the effective area and the radius of the effective area according to the obtained effective area;
determining the radius of a projection spherical surface projected by the corner points of the checkerboard in the effective area according to the radius of the effective area and the prestored view field angle of the fisheye camera;
determining the included angle between the connection line of the projection sphere center and the projection sphere center of the angular points of the checkerboards in the effective area and the optical axis of the fisheye camera according to the stereoscopic projection model function, the center of the effective area, the radius of the projection sphere and the angular point coordinates of the checkerboards in the effective area;
and determining the corner coordinates of the undistorted checkerboard according to the included angle between the connecting line of the projection point of the corner points of the checkerboard in the effective area on the projection spherical surface and the center of the projection sphere and the optical axis of the fisheye camera, the center of the effective area and the corner coordinates of the checkerboard in the effective area.
Since the shape of the effective region of the fisheye image is a circle or a circle-like shape, and the diameter of the effective region is the larger value of the height and the width of the effective region, determining the height of the effective region, the width of the effective region, the center of the effective region, and the radius of the effective region according to the obtained effective region includes:
determining the height of the effective area as m 'and the width as n' according to the obtained effective area;
and determining that the center of the effective area is (n '/2, m'/2) and the radius R of the effective area is max (m '/2, n'/2) according to the height m 'and the width n' of the effective area.
Referring to fig. 4, fig. 4 is a schematic plan view of a fisheye camera according to an embodiment of the invention. As shown in fig. 4, a semicircle b in the drawing is a plane view of the projected hemisphere of the fisheye image, a plane c is an imaging plane, a point Q is a three-dimensional space point, a point P 'is a projected point of the three-dimensional space point Q on the projected hemisphere, a point P is a projected point of the point P' on the projection sphere on the imaging plane,
is the angle between OP' and the optical axis of the fisheye camera.
In this embodiment, the imaging process of the fisheye camera and the calibration process of the fisheye camera are inverse processes to each other. And the fisheye camera is corrected by converting the coordinates of the corner points of the checkerboard in the effective area into the coordinates of the corner points of the undistorted checkerboard.
Referring to fig. 5, fig. 5 is a perspective view of a fisheye correction process according to an embodiment of the invention, in fig. 5, a projection sphere κ is a projection sphere projected by a fisheye image, O is a sphere center of the projection sphere κ, and a three-dimensional spatial coordinate system XYZ of the projection sphere κ is shown, a point P 'is a projection of a point P (not shown) in the fisheye image on the projection sphere κ, a plane α is a correction plane parallel to an XOY plane and tangential to the projection sphere κ (a is a tangent point), an extension line of OP' intersects a plane α at a point Q, and the point Q is a correction point corresponding to a point P in the fisheye image.
Since the model followed by the fisheye camera during imaging can be approximated to a unit spherical projection model, when the view field angle of the fisheye camera is pi, any diameter on the fisheye image is a circular arc passing through a point a on the projection spherical surface κ and connecting the diameters of the projection spherical surfaces when being mapped onto the spherical surface. According to the circumference formula, the radius of the projection spherical surface
Wherein R is the radius of the effective area. When the view field angle of the fisheye camera is epsilon, determining a projection spherical surface projected by the angular point of the checkerboard in the effective area according to the radius of the effective area and the prestored view field angle of the fisheye cameraRadius of
Wherein R is the projected spherical radius projected by the corner points of the checkerboard in the effective area, epsilon is the pre-stored view field angle of the fisheye camera, and R is the radius of the effective area.
The monocular
distance measuring device 1 is calibrated by using a stereoscopic projection calibration algorithm, and the stereoscopic projection model function is
Wherein r is
1Is the distance from the angular point P of the checkerboard in the effective area to the center of the effective area, r is the radius of the projection sphere,
is the angle between OP' and the optical axis of the fisheye camera.
Determining an included angle between a connecting line of a projection point of an angular point in the checkerboards in the effective region on the projection spherical surface and a projection spherical center and an optical axis of the fisheye camera according to the stereoscopic projection model function, the center of the effective region, the radius of the projection spherical surface and the angular point coordinates of the checkerboards in the effective region, wherein the included angle comprises:
in the correction process, in order to facilitate subsequent calculation, the coordinate origin of the effective region needs to be moved to the center of the effective region, that is, the coordinate origin of the fisheye image is moved to the right by n '/2 and moved to the down by m'/2, and similarly, the corner point coordinates of the checkerboard in the effective region also need to be moved correspondingly.
Ith corner point P of checkerboard in active area
iCoordinates of the object
Point p 'obtained after the translation'
iCoordinates of the object
The following relation is satisfied:
up'i=uPi-n'/2; equation 1
vp'i=vPi-m'/2; equation 2
Wherein the content of the first and second substances,
is the abscissa of the ith corner point of the checkerboard in the effective area after translation,
is the ordinate of the ith angle point of the checkerboard in the effective area after translation,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, n 'is the width of the effective area, and m' is the height of the effective area.
According to the stereoscopic projection model function, the following conditions are known:
wherein the content of the first and second substances,
is the abscissa of the ith corner point of the checkerboard in the effective area after translation,
is the ordinate of the ith angle point of the checkerboard in the effective area after translation,
is the ith corner point P of the checkerboard in the effective area
iThe distance from the center of the effective area, r is the radius of the projected spherical surface,
is OP
i' angle to the optical axis of the fisheye camera.
Then, according to formula 1, formula 2 and formula 3, it can be known that:
wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
is the abscissa of the ith corner point of the checkerboard in the effective area after translation,
is the ordinate of the ith angle point of the checkerboard in the effective area after translation,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, n 'is the width of the effective area, m' is the height of the effective area, and r is the radius of the projection sphere.
Determining the corner coordinates of the undistorted checkerboard according to the included angle between the connecting line of the projection point of the corner points of the checkerboard in the effective area on the projection spherical surface and the center of the projection spherical surface and the optical axis of the fisheye camera, the center of the effective area and the corner coordinates of the checkerboard in the effective area, and the method comprises the following steps:
determining correction point coordinates corresponding to the angular points of the checkerboards in the effective area according to the included angle between the connecting line of the projection point of the angular points of the checkerboards in the effective area on the projection spherical surface and the center of the projection sphere and the optical axis of the fisheye camera, the center of the effective area and the angular point coordinates of the checkerboards in the effective area;
and determining the coordinates of the corner points of the undistorted checkerboard according to the coordinates of the correction points corresponding to the corner points of the checkerboard in the effective area.
Determining the coordinates of the correction points corresponding to the angular points of the checkerboards in the effective area according to the included angle between the connecting line of the projection points of the angular points of the checkerboards in the effective area on the projection spherical surface and the center of the projection sphere and the optical axis of the fisheye camera, the center of the effective area and the angular point coordinates of the checkerboards in the effective area, wherein the step of determining the coordinates of the correction points corresponding to the angular points of the checkerboards in:
please refer to fig. 5, which is composed ofIf plane α is a plane parallel to the XOY plane and tangent to the projection sphere κ (tangent point is a), and Q is a point on plane α and is a correction point corresponding to corner point P of the checkerboard in the active area, QA ⊥ AO. is the correction point Q corresponding to the ith corner point of the checkerboard in the active areaiFrom the tangent function, it can be seen that:
wherein the content of the first and second substances,
uQ
iis the abscissa of the correction point corresponding to the ith corner point of the checkerboard in the effective area,
vQ
iis the ordinate of the correction point corresponding to the ith angle point of the checkerboard in the effective area, r is the radius of the projection spherical surface,
is OP
i' angle to the optical axis of the fisheye camera.
Referring to fig. 6, fig. 6 is a schematic diagram illustrating a relationship between coordinates of a calibration point corresponding to a corner point of a checkerboard in an effective area determined according to a stereoscopic projection model and a projection point of the corner point of the checkerboard in the effective area on a projection sphere according to an embodiment of the present invention, in fig. 6, a point a is a center of a plane α, an axis u '(horizontal axis) parallel to an X axis is drawn through the point a, an axis v' (vertical axis) parallel to a Y axis is drawn through the point a, a first straight line parallel to the axis v 'is drawn from the point Q, the first straight line intersects the axis u' at a point C, a second straight line parallel to the axis u 'is drawn from the point Q, the second straight line intersects the axis v' at a ', and the lengths of a' Q and AC are both equal to an absolute value of a horizontal coordinate of the point QuQiThe length of AA' and the length of CQ are equal to the absolute value of the ordinate of the point QvQi|。
In FIG. 6, an axis u "parallel to axis u ' (horizontal axis) is drawn, and the plane formed by axis u" and point P ' is parallel to plane α A third line parallel to axis v ' is drawn from point P ', the third line intersects axis u "at point C ', a fourth line perpendicular to the fisheye camera optical axis (vertical axis) is drawn from point P ', the fourth line intersects fisheye camera optical axis at point B, and a line v" (not shown) parallel to v ' and perpendicular to u "is drawn through point BThe length of C 'P' is the absolute value of the ordinate of the point P-vP'iThe length of BC is the absolute value of the abscissa of P-uP'i|。
In fig. 6, since BP '// AQ, u'// u ", and ∠ ACQ ∠ BC 'P' is 90 °, Δ ACQ Δ BC 'P'.
|uQi|/|uP'i|=|vQi|/|vP'i|
Wherein the content of the first and second substances,uQiis the abscissa of the correction point corresponding to the ith corner point of the checkerboard in the effective area,vQiis the ordinate of the correction point corresponding to the ith corner point of the checkerboard in the effective area,uP'iis the abscissa of the projection point of the ith corner point of the checkerboard on the projection spherical surface in the effective area,vP'iis the ordinate of the projection point of the ith angular point of the checkerboard in the effective area on the projection spherical surface.
It is clear that the invention is not limited to the third line parallel to the axis v ' from the point P ', but also to a line parallel to the axis u ', intersecting the axis v ' (not shown) parallel to the axis v ' at a point D (not shown), Δ AQA ' to Δ BP ' D, the above relations being equally obtainable.
Making a perpendicular line from the point P ' to a plane w where the sphere center of the projection spherical surface is located, and intersecting the plane w with a point E, wherein the point E can be understood as a point P ' after the ith angular point of the checkerboard in the active area is translated for the convenience of understanding 'i. And (3) making a fifth straight line parallel to the Y axis from the point E, wherein the fifth straight line intersects the X axis at the point F, and the point F is from to the point BC 'P', and then the relationship between the coordinates of the correction points corresponding to the angular points of the checkerboards in the effective area and the coordinates of the angular points of the checkerboards in the effective area after translation satisfies the following conditions:
wherein the content of the first and second substances,
uQ
iis the abscissa of the correction point corresponding to the ith corner point of the checkerboard in the effective area,
vQ
iis the ordinate of the correction point corresponding to the ith corner point of the checkerboard in the effective area,
is the abscissa of the ith corner point of the checkerboard in the effective area after translation,
the ith angle point of the checkerboard in the effective area is the ordinate after translation.
It is obvious that the present invention is not limited to the fifth line parallel to the Y axis from the point E, but can also be a line parallel to the X axis (not shown), which intersects the Y axis at the point G (not shown), Δ OGE to Δ BC 'P', and the above equation 6 can be obtained.
According to formula 1, formula 2, formula 4, formula 5, and formula 6, the coordinates of the correction points corresponding to the corner points of the checkerboard in the effective area can be determined, specifically:
1) when in use
At non-specified values (e.g., not approaching zero):
wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
uQ
iis the abscissa of the correction point corresponding to the ith corner point of the checkerboard in the effective area,
vQ
iis the ordinate of the correction point corresponding to the ith corner point of the checkerboard in the effective area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, n 'is the width of the effective area, m' is the height of the effective area, and r is the radius of the projection sphere.
2) When in use
The method comprises the following steps:
due to the fact that
Then:
wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
uQ
iis the abscissa of the correction point corresponding to the ith corner point of the checkerboard in the effective area,
vqi is the ordinate of the correction point corresponding to the ith corner point of the checkerboard in the effective region,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, m 'is the height of the effective area, n' is the width of the effective area, and r is the radius of the projection sphere.
The determining the corner coordinates of the undistorted checkerboard according to the correction point coordinates corresponding to the corners of the checkerboard in the effective area includes: because the projection spherical surface is involved in the correction process, and the image center is used as the origin for correction, the upper left corner of the image is used as the origin when determining the coordinates of the corners of the undistorted checkerboard, that is, the origin of coordinates of the undistorted fisheye image needs to be moved from the center of the undistorted fisheye image to the upper left corner of the undistorted fisheye image. Thus:
ui=uQi+ n/2 equation 9
vi=vQi+ m/2 equation 10
Wherein u isiAbscissa, v, of the i-th corner point of the undistorted checkerboardiThe ordinate of the i-th corner point of the undistorted checkerboard,uQicorresponding to the ith corner of the checkerboard in the active areaThe abscissa of the correction point is plotted against the axis of the correction point,vQithe correction point is the ordinate of the correction point corresponding to the ith corner point of the checkerboard in the effective area, m is the height of the undistorted fisheye image, n is the width of the undistorted fisheye image, and the values of m and n can be set according to the requirements of users.
The corner coordinates of the undistorted checkerboard may be determined according to equations 7, 8, 9, and 10, specifically:
1) when in use
At non-specified values (e.g., not approaching zero):
wherein the content of the first and second substances,
wherein the content of the first and second substances,
is OP
i' Angle from the optical axis of the fisheye camera, u
iAbscissa, v, of the i-th corner point of the undistorted checkerboard
iThe ordinate of the i-th corner point of the undistorted checkerboard,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
ithe value of m and n can be set according to the requirement of a user.
2) When in use
The method comprises the following steps:
ui=(uPi-n'/2)+n/2
vi=(vPi-m'/2)+m/2
wherein the content of the first and second substances,
is OP
i' Angle from the optical axis of the fisheye camera, u
iAbscissa, v, of the i-th corner point of the undistorted checkerboard
iThe ordinate of the i-th corner point of the undistorted checkerboard,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
ithe value of m and n can be set according to the requirement of a user.
Wherein i is any one of the corner points of the checkerboard, and is not limited to a specific corner point of the checkerboard. Wherein, the ith corner point P of the checkerboard in the effective areaiThe translated point is p'iI-th corner point P of the checkerboard in the active areaiThe point projected on the projection sphere is Pi'。
The length determining device 50 is configured to determine an average value of lengths of all the squares in the undistorted checkerboard in the image according to the corner coordinates of the undistorted checkerboard.
In this embodiment, the length determining apparatus 50 is specifically configured to:
determining the length of each grid in the undistorted checkerboards in the image according to the corner point coordinates of the undistorted checkerboards;
the average of the lengths of all the squares in the undistorted checkerboard in the image is determined.
The determining the length of each square in the undistorted checkerboards in the image comprises:
determining the distance between the (i + 1) th corner point of the undistorted checkerboard and the (i) th corner point of the undistorted checkerboard in the image, wherein i is 1, 2.
The distance between the (i + 1) th corner of the undistorted checkerboard and the ith corner of the undistorted checkerboard in the image is determined as follows:
1) when in use
And is
The method comprises the following steps:
wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
is OP
i+1' Angle from the optical axis of the fisheye camera, d
iIs the distance between the (i + 1) th corner of the undistorted checkerboard and the (i) th corner of the undistorted checkerboard in the image, u
i+1Is the abscissa, v, of the i +1 st corner point of the undistorted checkerboard
i+1Is the ordinate, u, of the i +1 st corner of the undistorted checkerboard
iAbscissa, v, of the i-th corner point of the undistorted checkerboard
iThe ordinate of the i-th corner point of the undistorted checkerboard,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th corner point of the checkerboard in the active area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the active area.
2) When in use
And is
At non-specified values (e.g., not approaching zero):
Wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
is OP
i+1' Angle from the optical axis of the fisheye camera, d
iIs the distance between the (i + 1) th corner of the undistorted checkerboard and the (i) th corner of the undistorted checkerboard in the image, u
i+1Is the abscissa, v, of the i +1 st corner point of the undistorted checkerboard
i+1Is the ordinate, u, of the i +1 st corner of the undistorted checkerboard
iAbscissa, v, of the i-th corner point of the undistorted checkerboard
iThe ordinate of the i-th corner point of the undistorted checkerboard,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th corner point of the checkerboard in the active area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, m 'is the height of the effective area, n' is the width of the effective area, and r is the radius of the projection sphere.
3) When in use
And is
At non-specified values (e.g., not approaching zero):
Wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
is OP
i+1' Angle from the optical axis of the fisheye camera, d
iIs the distance between the (i + 1) th corner of the undistorted checkerboard and the (i) th corner of the undistorted checkerboard in the image, u
i+1Is the abscissa, v, of the i +1 st corner point of the undistorted checkerboard
i+1Is the ordinate, u, of the i +1 st corner of the undistorted checkerboard
iAbscissa, v, of the i-th corner point of the undistorted checkerboard
iThe ordinate of the i-th corner point of the undistorted checkerboard,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th corner point of the checkerboard in the active area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, m 'is the height of the effective area, n' is the width of the effective area, r is the projection ballThe radius of the face.
4) When in use
And
when both are unspecified values (e.g., neither approaches zero):
Wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
is OP
i+1' Angle from the optical axis of the fisheye camera, d
iIs the distance between the (i + 1) th corner of the undistorted checkerboard and the (i) th corner of the undistorted checkerboard in the image, u
i+1Is the abscissa, v, of the i +1 st corner point of the undistorted checkerboard
i+1Is the ordinate, u, of the i +1 st corner of the undistorted checkerboard
iAbscissa, v, of the i-th corner point of the undistorted checkerboard
iThe ordinate of the i-th corner point of the undistorted checkerboard,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th corner point of the checkerboard in the active area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
iis the ordinate of the ith corner point of the checkerboard in the effective area, m 'is the height of the effective area, n' is the width of the effective area, and r is the radius of the projection sphere.
The determining the average of the lengths of all the squares in the undistorted checkerboard in the image comprises:
determining the total number L of squares in the undistorted checkerboard;
and determining the average value of the lengths of all the squares in the undistorted checkerboards in the image according to the lengths of the squares in the undistorted checkerboards in the image and the total number L of the squares in the undistorted checkerboards.
Determining the average value of the lengths of all the squares in the undistorted checkerboards in the image according to the lengths of the squares in the undistorted checkerboards in the image and the total number L of the squares in the undistorted checkerboards so as to obtain the length of the squares in the image
And
the calculation process is illustrated by taking a non-special value (e.g. not approaching zero) as an example:
Wherein the content of the first and second substances,
is OP
i+1' angle to the optical axis of the fisheye camera,
is OP
iThe included angle between the grid and the optical axis of the fisheye camera, d is the average value of the lengths of all the squares in the undistorted checkerboard in the image, L is the total number of the squares in the undistorted checkerboard, d
iIs the distance between the (i + 1) th corner of the undistorted checkerboard and the (i) th corner of the undistorted checkerboard in the image,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
ias the ordinate of the ith corner point of the checkerboard in the active area,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th angular point of the checkerboard in the effective area, m 'is the height of the effective area, n' is the width of the effective area, and r is the radius of the projection sphere.
The distance determining device 60 is configured to determine the distance between the fisheye camera and the plane of the checkerboard according to the pre-stored focal length of the fisheye camera, the pre-stored actual lengths of the squares in the checkerboard, and the average length of all the squares in the undistorted checkerboard in the image.
As shown in fig. 7, point a is the fisheye camera, AE is the focal length of the fisheye camera, AB is the distance between the fisheye camera and the plane of the checkerboard, GF is the average of the lengths of all the squares in the undistorted checkerboard in the image, and DC is the actual length of the squares in the checkerboard. After the average length of all the squares in the undistorted checkerboard in the image is determined according to the coordinates of the corner points of the checkerboard in the effective area, the imaging principle of the undistorted checkerboard is the imaging principle adopted by a common camera. Thus, Δ AEF Δ ABC, and Δ AGF Δ ADC, the equations can be derived: AB × GF ═ DC × AE.
The distance determining device 60 is specifically configured to:
according to the formula
And determining the distance between the fisheye camera and the plane of the checkerboard, wherein DC is the actual length of the grids in the prestored checkerboard, AE is the focal length of the prestored fisheye camera, and GF is the average value of the lengths of all grids in the undistorted checkerboard in the image. Where DC is the actual length of the squares in the grid that is pre-measured before the present invention is performed.
In particular, to
And
the calculation process is illustrated for a non-special value (e.g. not approaching zero):
Wherein the content of the first and second substances,
is OP
i' angle to the optical axis of the fisheye camera,
is OP
i+1' angle to optical axis of fisheye camera, AB is distance between fisheye camera and plane of checkerboard, DC is actual length of grid in prestored checkerboard, AE is focal length of prestored fisheye camera, GF is graph of all grids in undistorted checkerboardThe average length in the image, L is the total number of squares in the undistorted checkerboard, r is the projection spherical radius, n 'is the width of the effective area, m' is the height of the effective area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
ias the ordinate of the ith corner point of the checkerboard in the active area,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th corner point of the checkerboard in the active area.
In the present embodiment, the pre-stored focal length of the fisheye camera is obtained by the distance determination device 60 in advance before the present invention is implemented. In other embodiments, the focal length of the pre-stored fisheye camera is obtained from a merchant or other known methods.
The distance determining means 60 is further configured to:
as shown in fig. 7, after determining the average length of all the squares in the undistorted checkerboard in the image according to the coordinates of the corner points of the checkerboard in the effective area, the imaging principle of the undistorted checkerboard is the imaging principle adopted by the common camera. Thus, Δ AEF Δ ABC, and Δ AGF Δ ADC, the equations can be given: AB × GF ═ DC × AE, and
wherein AE is the focal length of the fisheye camera, AB is the distance between the prestored fisheye camera and the plane where the checkerboard is located, GF is the average value of the lengths of all the squares in the undistorted checkerboard in the image, and DC is the actual length of the squares in the prestored checkerboard. Wherein, the AB and the DC are distances between the fisheye camera and the plane of the checkerboard and actual lengths of the squares in the checkerboard, which are obtained and stored in advance by measurement before the implementation of the present invention. Therefore, the focal length of the fisheye camera can be determined through the pre-stored distance between the fisheye camera and the plane where the checkerboard is located, the average value of the lengths of all the squares in the undistorted checkerboard in the image and the pre-stored actual length of the squares in the checkerboard. In particular, to
The calculation process is illustrated for a non-special value as an example:
Wherein the content of the first and second substances,
is OP
i' the angle to the optical axis of the camera,
is OP
i+1' an included angle with an optical axis of the camera, AE is a focal length of the fisheye camera, AB is a distance between the prestored fisheye camera and a plane where the checkerboard is located, GF is an average value of lengths of all squares in the undistorted checkerboard in an image, DC is an actual length of the squares in the prestored checkerboard, L is a total number of the squares in the undistorted checkerboard, r is a projection spherical radius, m ' is a height of an effective area, n ' is a width of the effective area,
uP
ibeing the abscissa of the ith corner point of the checkerboard in the active area,
vP
ias the ordinate of the ith corner point of the checkerboard in the active area,
uP
i+1is the abscissa of the (i + 1) th corner point of the checkerboard in the active area,
vP
i+1is the ordinate of the (i + 1) th corner point of the checkerboard in the active area.
According to the invention, after the fisheye image containing the checkerboard is obtained from the fisheye camera, the effective area is firstly extracted, then the angular point detection is carried out, and the angular point coordinate information in the effective area is corrected by adopting a stereoscopic projection correction algorithm, so that the whole distorted image is not required to be corrected, and the calculated amount is reduced to a certain extent; according to the obtained undistorted angular point coordinates, the length of each square in the checkerboards in the image is calculated, and the average value is calculated and used as the length of the square in the image, so that the precision of the length of the square in the image is improved to a certain extent; and finally, the distance measurement is carried out through the mean value, so that the monocular distance measurement precision is improved to a certain extent.
Although the present invention has been described in detail with reference to the preferred embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted without departing from the spirit and scope of the invention. Those skilled in the art can also make other changes and the like in the design of the present invention within the spirit of the present invention as long as they do not depart from the technical effects of the present invention. Such variations are intended to be included within the scope of the invention as claimed.