CN-116309090-B - Fisheye image correction method and storage medium applied to vehicle-mounted splicing system
Abstract
The application discloses a fisheye image correction method applied to a vehicle-mounted splicing system, which comprises the steps of collecting a fisheye image F by using a vehicle-mounted fisheye lens, determining the edge of a black edge in the fisheye image F, performing curve fitting on pixel points of the edge of the black edge, mapping and correcting the fitted curve to the image boundary of the fisheye image F to obtain a correction mapping relation, obtaining a fisheye image T to be corrected by using the vehicle-mounted fisheye lens, and mapping and correcting the corrected fisheye image T by using the correction mapping relation. The application also provides a computer readable storage medium.
Inventors
- CHEN YUQUAN
- XU BO
- ZHU GUANGQIANG
- OUYANG YICUN
- WANG HEPING
- LUO FUZHANG
- CHEN YAQIONG
Assignees
- 盛视科技股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20220909
Claims (7)
- 1. A fisheye image correction method applied to a vehicle-mounted stitching system, comprising: The method for determining the edge of the black edge in the fisheye image F comprises the following steps: Binarizing the fisheye image F to obtain a binarized image B, wherein the pixel value of a foreground area of the fisheye image F is 255, and the pixel value of a distorted black area is 0; extracting outline points of black edges in the binarized image B; dividing the outline into a left black edge, a right black edge and a lower black edge; Wherein, the upper left corner of the fish-eye image F is taken as the origin of an image coordinate system, the abscissa range of the pixel point on the left black edge is [0, W/2] and the ordinate range is [0, H/2], the abscissa range of the pixel point on the right black edge is (W/2, W) and the ordinate range is [0, H/2], the abscissa range of the pixel point on the lower black edge is (0, W) and the ordinate range is (H/2, H ] whereinW is the width of the fish-eye image F on the X axis, H is the height of the fish-eye image on the Y axis; Performing curve fitting on pixel points of the edge of the black edge, namely performing curve fitting on pixel points of the left black edge, pixel points of the right black edge and pixel points of the lower black edge respectively by utilizing a polyfit function of opencv to obtain a left black edge curve y 1 =SL(x 1 ), a right black edge curve y 2 =SR(x 2 ) and a lower black edge curve y 3 =SD(x 3 ); Wherein X 1 is represented as the coordinate on the Y-axis of any point of the left black edge curve Y 1 =SL(x 1 ) and X 1 ∈[0,H/2],x 2 is represented as the coordinate on the Y-axis of any point of the right black edge curve Y 2 =SR(x 2 ) and X 2 ∈[0,H/2],x 3 is represented as the coordinate on the X-axis of any point of the lower black edge curve Y 3 =SD(x 3 ) and X 3 e (0, w); Dividing the fisheye image F into a left half image, a right half image and a lower half image with a straight line y=h/2 and a straight line composed of two points (W/2, 0) and (W/2, H/2), wherein the step of correcting the fitted curve map to the image boundary of the fisheye image F to obtain the corrected map relationship comprises: Obtaining a left mapping relation MapL for eliminating the left black edge, wherein y=j ((j=0, 1,2,.. The pixel points (W/2, j) of the fisheye image F to the edge points (SL (j), j) on the left black edge curve are linearly stretched into line segments between the pixel points (W/2, j) of the fisheye image F and the left boundary points (0, j) of the fisheye image F, and then the left mapping relation MapL (i, j) =j (W/2)/(W/2-SL (j)) (i=0, 1.. W/2;j =0, 1.. H/2); Obtaining a right mapping relation MapR for eliminating a right black edge, wherein y=j ((j=0, 1,2,) traverses along the Y-axis direction, linear stretches line segments from a pixel point (W/2, j) of a fisheye image F to an edge point (SR (j), j) on the right black edge curve to line segments from the pixel point (W/2, j) of the fisheye image F to a right boundary point (W, j) of the fisheye image F, and then a left mapping relation MapR (i, j) = (j-W/2) = (W/2)/(SR (j) -W/2) +W/2 (i=0, 1,) W/2;j =0, 1,., H/2); Obtaining a lower mapping relation MapD for eliminating the lower black edge, traversing x=i (i=0, 1,2,.. W) along the X-axis direction, linearly stretching a line segment between a pixel point (i, 0) of the fisheye image F and an edge point (i, SD (i)) on the lower black edge curve into a line segment between the pixel point (i, 0) of the fisheye image F and a lower boundary point (i, H) of the fisheye image F, and then obtaining a lower mapping relation MapD (i, j) =j (H/SD (i)) (i=0, 1.. W; j=0, 1.. H); Correcting the fitted curve map to the image boundary of the fish-eye image F to obtain a corrected map relationship, and And acquiring a fisheye image T to be corrected by using the vehicle-mounted fisheye lens, and carrying out mapping correction on the corrected fisheye image T by using a correction mapping relation.
- 2. The fish-eye image correction method for vehicle-mounted stitching system according to claim 1, wherein the step of extracting the black edge contour point in the binary image B is to traverse from the image boundary of the binary image B to the image center to find black-and-white demarcation points, and all black-and-white demarcation points form the black edge contour.
- 3. The fisheye image correction method applied to the vehicle-mounted stitching system according to claim 2, wherein the corrected fisheye image T is mapped and corrected by using the correction mapping relationship to form the corrected image R by mapping the fisheye image T three times by using the left mapping relationship MapL, the right mapping relationship MapR, and the lower mapping relationship MapD.
- 4. A fisheye image correction method applied to an on-vehicle mosaic system as set forth in claim 3 wherein after the mapping correction of the corrected fisheye image T, the fisheye image correction method further comprises interpolating the blank point in the mapping correction forming corrected image R.
- 5. The method for correcting the fisheye image applied to the vehicle-mounted stitching system according to claim 1, wherein the step of binarizing the fisheye image F to obtain the binarized image R is performed if F (x 0 ,y 0 )≥T,B(x 0 ,y 0 ) =255, if not, B (x 0 ,y 0 ) =0, wherein F (x 0 ,y 0 ) is a pixel value of the fisheye image F at any pixel point (x 0 ,y 0 ), F (x 0 ,y 0 ) is a pixel value of the binarized image at the pixel point (x 0 ,y 0 ), and T is a binarized threshold.
- 6. The method for correcting fish-eye images in a vehicle-mounted stitching system according to claim 5, wherein T takes a value of 20.
- 7. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the fisheye image correction method of any one of claims 1-6 for use in a vehicle-mounted stitching system.
Description
Fisheye image correction method and storage medium applied to vehicle-mounted splicing system Technical Field The application relates to the field of image processing, in particular to a fisheye image correction method and a storage medium applied to a vehicle-mounted splicing system. Background When the vehicle-mounted all-round view stitching is carried out, the vehicle-mounted camera is usually a fisheye lens, but the image inevitably generates distortion phenomenon due to an overlarge view angle of the fisheye lens, the distortion is usually most obvious at the edge of the image, under normal conditions, a spherical image is adopted when the fisheye lens collects the image, a circle of black edges exist at the periphery of the image, and distortion correction is needed for the fisheye image in order to adapt to the observation habit of eyes of a driver. In the existing correction method, correction is often performed on the central part, so that not only is greater distortion generated on the edge part, but also partial edge vision is lost, which is the phenomenon of vision loss generated in subsequent panoramic stitching, so that a monitoring blind area is caused. In addition, some existing correction methods are performed in a circular unfolding mode, but because the main monitoring direction of the vehicle-mounted fisheye lens is the ground and the front is considered, the installation angle is always 45 degrees downwards, the lower half part of the visual field of the lens is black due to the installation angle, and the lower half part of the visual field of the lens is not in a regular circular shape, so that the correction mode of finding the circle center and the radius according to the circular unfolding is not suitable for correction of the vehicle-mounted fisheye image. Disclosure of Invention Aiming at the prior art, the application solves the technical problem of providing a fisheye image correction method and a storage medium which are applied to a vehicle-mounted splicing system and can keep all fields of view in the correction process. In order to solve the technical problems, the application provides a fisheye image correction method applied to a vehicle-mounted splicing system, which comprises the following steps: collecting a fisheye image F by using a vehicle-mounted fisheye lens, and determining the edge of a black edge in the fisheye image F; Performing curve fitting on pixel points at the edge of the black edge; Correcting the fitted curve map to the image boundary of the fish-eye image F to obtain a corrected map relationship, and And acquiring a fisheye image T to be corrected by using the vehicle-mounted fisheye lens, and carrying out mapping correction on the corrected fisheye image T by using a correction mapping relation. In one possible implementation, the step of determining the edge of the black border within the fisheye image F comprises: Binarizing the fisheye image F to obtain a binarized image B, wherein the pixel value of a foreground area of the fisheye image F is 255, and the pixel value of a distorted black area is 0; extracting outline points of black edges in the binarized image B; dividing the outline into a left black edge, a right black edge and a lower black edge; The left upper corner of the fisheye image F is taken as an origin of an image coordinate system, the abscissa range of the pixel point on the left black edge is [0, W/2] and the ordinate range of the pixel point on the right black edge is [0, H/2], the abscissa range of the pixel point on the right black edge is (W/2, W) and the ordinate range of the pixel point on the lower black edge is [0, W) and the ordinate range of the pixel point on the lower black edge is (H/2, H ], wherein W is the width of the fisheye image F on the X axis, and H is the height of the fisheye image on the Y axis. In one possible implementation, the step of extracting the contour points of the black border within the binary image B is to traverse from the image boundary of the binary image B to the image center to find black-and-white demarcation points, all of which constitute the contour of the black border. In one possible implementation manner, the curve fitting is performed on the black edge, specifically, the left black edge curve y 1=SL(x1), the right black edge curve y 2=SR(x2) and the lower black edge curve y 3=SD(x3 are respectively obtained by performing curve fitting on the pixel points of the left black edge, the pixel points of the right black edge and the pixel points of the lower black edge by using a polyfit function of opencv); Where X 1 is represented as the coordinate on the Y-axis of any point of the left black edge curve Y 1=SL(x1) and X 1∈[0,H/2],x2 is represented as the coordinate on the Y-axis of any point of the right black edge curve Y 2=SR(x2) and X 2∈[0,H/2],x3 is represented as the coordinate on the X-axis of any point of the lower black edge curve Y 3=SD(x3) and X 3 e (0, w). In one possible i