CN115439548A - Camera calibration method, image splicing method, device, medium, camera and vehicle - Google Patents

Camera calibration method, image splicing method, device, medium, camera and vehicle Download PDF

Info

Publication number
CN115439548A
CN115439548A CN202110948787.4A CN202110948787A CN115439548A CN 115439548 A CN115439548 A CN 115439548A CN 202110948787 A CN202110948787 A CN 202110948787A CN 115439548 A CN115439548 A CN 115439548A
Authority
CN
China
Prior art keywords
image
target
camera
resolution
calibrated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110948787.4A
Other languages
Chinese (zh)
Inventor
刘锋
夏晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing CHJ Automotive Information Technology Co Ltd
Original Assignee
Beijing CHJ Automotive Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing CHJ Automotive Information Technology Co Ltd filed Critical Beijing CHJ Automotive Information Technology Co Ltd
Priority to CN202110948787.4A priority Critical patent/CN115439548A/en
Publication of CN115439548A publication Critical patent/CN115439548A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • G06T3/4038Scaling the whole image or part thereof for image mosaicing, i.e. plane images composed of plane sub-images
    • G06T5/80

Abstract

The disclosure relates to a camera calibration method, an image splicing device, a medium, a camera and a vehicle, wherein the calibration method comprises the following steps: acquiring a first image acquired by a camera to be calibrated; the first image has an original image resolution; carrying out distortion correction on the first image, and determining target area parameters and target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image; determining target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution; acquiring a second image acquired by a camera to be calibrated, and converting reference position information in the second image into target position information corresponding to the resolution of the target image; and determining external parameters of the camera to be calibrated based on the target internal parameters and the target position information. Therefore, by setting a larger target image resolution, a larger effective area can be reserved for the camera to be calibrated, so that the problem of splicing blind areas is favorably solved.

Description

Camera calibration method, image splicing method, device, medium, camera and vehicle
Technical Field
The present disclosure relates to the field of camera calibration technologies, and in particular, to a camera calibration method, an image stitching device, a medium, a camera, and a vehicle.
Background
With the development of vehicle electronic technology, people have more and more strong requirements on the driving assistance function. The vehicle panoramic all-around view function is a basic function in vehicle auxiliary driving and can be realized by using a vehicle-mounted panoramic all-around view system.
In an on-board panoramic all-round system, the external parameter (i.e. external parameter) calibration of the camera in the system is usually performed by using a specific scene calibration pattern to provide a reference point, therefore, the registration of the video images acquired by 4 to 8 cameras (namely cameras) arranged around the vehicle body is realized, and the purpose of panoramic all-around stitching is achieved. When the vehicle-mounted panoramic all-around viewing system is applied to a vehicle with a larger vehicle size, the correspondingly reserved effective area is relatively limited due to the limitation of the internal parameters and the external parameters of each camera; at this time, a stitched image obtained based on the distortion-corrected image and the parameters of the camera, including the internal reference and the external reference, may have a defect, resulting in a blind area in the obtained stitched image.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the present disclosure provides a camera calibration method, an image stitching device, a medium, a camera, and a vehicle, which can improve the problem of stitching blind areas.
The present disclosure provides a camera calibration method, which includes:
acquiring a first image acquired by a camera to be calibrated; the first image has an original image resolution;
carrying out distortion correction on the first image, and determining a target area parameter and a target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image;
determining target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution;
acquiring a second image acquired by a camera to be calibrated, and converting reference position information in the second image into target position information corresponding to the resolution of the target image;
and determining external parameters of the camera to be calibrated based on the internal parameters of the target and the position information of the target.
In some embodiments, prior to performing the distortion correction on the first image and determining the target region parameter and the target image resolution for the distortion correction, the method further comprises:
acquiring internal parameters and distortion parameters of a camera to be calibrated;
wherein, carry out distortion correction to first image to confirm distortion corrected target region parameter and target image resolution, include:
based on the internal parameters and the distortion parameters, converting pixel points on the first image into pixel points after distortion correction;
determining a target area for distortion correction based on a reference area corresponding to the pixel point after the distortion correction; the target area is a rectangular area in a reference area defined by target area parameters;
carrying out distortion correction on a first image corresponding to the target area to obtain an image subjected to distortion correction and a target image resolution;
and the ratio of the first direction pixel data to the second direction pixel data in the target image resolution is equal to the ratio of the first direction pixel data to the second direction pixel data in the target area parameter, and the first direction is crossed with the second direction.
In some embodiments, the distortion correction of the first image corresponding to the target region includes:
carrying out distortion correction on a first image corresponding to a target area by adopting an open image library;
the vertex attributes of the computer graphics corresponding to the first image comprise: vertex coordinates and texture coordinates; the vertex coordinates are: (m/W-1.0, n/H-1.0), texture coordinates are: (X/X, Y/Y), inputting the texture coordinate corresponding to the first image into a built-in function of an open image library, and rendering the obtained image as output, namely the image after distortion correction;
wherein, (X, Y) represents any pixel point in the first image, (m, n) represents a pixel point (X, Y) after distortion correction is carried out by utilizing internal parameters and distortion parameters, X multiplied by Y represents the resolution of the original image, and W and H represent half of the side length of the target area along the first direction and the second direction respectively.
In some embodiments, the target image resolution is M × N; the method further comprises the following steps:
adjusting the resolution of the target image and/or adjusting the parameters of the target area so that the ratio of the pixel data in the first direction to the pixel data in the second direction in the resolution of the target image is equal to the ratio of the pixel data in the first direction to the pixel data in the second direction in the parameters of the target area, includes:
adjusting at least one of M, N, W and H such that M: N = W: H.
In some embodiments, determining the target internal reference of the camera to be calibrated corresponding to the target image resolution based on the target area parameter and the target image resolution comprises:
determining a target image center point of a camera to be calibrated corresponding to the target image resolution based on the target image resolution;
determining a target focal length of the camera to be calibrated corresponding to the target image resolution by combining the focal length of the camera to be calibrated based on the target area parameters and the target image resolution;
wherein U0= M/2, V0= N/2; (U0, V0) represents the pixel coordinates of the center point of the target image of the camera to be calibrated;
wherein Fx = Fx/(W/M), fy = Fy/(H/N); fx and Fy respectively represent the focal length of the camera to be calibrated, and Fx and Fy respectively represent the target focal length of the camera to be calibrated;
the method further comprises the following steps:
the distortion parameter is changed to 0.
In some embodiments, converting the reference position information in the second image to target position information corresponding to a target image resolution comprises:
carrying out distortion correction on the reference position information by using the internal reference and distortion parameters of the camera to be calibrated;
converting the distortion-corrected reference position information into target position information corresponding to the resolution of a target image;
wherein, the target position information is a target position coordinate:
(M×[Xdst-(U-W)]/(2W),N×[Ydst-(V-H)]/(2H));
wherein, (Xdst, ydst) represents coordinates corresponding to the reference position information after the distortion correction.
In some embodiments, the second image includes a checkerboard, and the reference position information is coordinates of corner points of the checkerboard;
converting the reference position information in the second image into target position information corresponding to a target image resolution, comprising:
identifying coordinates of corner points of the checkerboard in the second image;
carrying out distortion correction on coordinates of the angular points by utilizing internal parameters and distortion parameters of a camera to be calibrated;
and scaling the coordinates of the corner points after the distortion correction according to the proportion between the target area parameters and the target image resolution.
In some embodiments, the target region parameter and the target image resolution satisfy: m is less than or equal to W, and N is less than or equal to H.
The present disclosure also provides a camera calibration device, which includes:
the first acquisition module is used for acquiring a first image acquired by a camera to be calibrated; the first image has an original image resolution;
the distortion correction module is used for carrying out distortion correction on the first image and determining target area parameters and target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image;
the internal parameter determining module is used for determining target internal parameters of the camera to be calibrated, which correspond to the target image resolution, based on the target area parameters and the target image resolution;
the position conversion module is used for acquiring a second image acquired by the camera to be calibrated and converting reference position information in the second image into target position information corresponding to the resolution of the target image;
and the external parameter solving module is used for determining the external parameters of the camera to be calibrated based on the target internal parameters and the target position information.
In some embodiments, the apparatus further comprises:
the auxiliary acquisition module is used for acquiring internal parameters and distortion parameters of the camera to be calibrated;
wherein, the distortion correction module includes:
the pixel point transformation submodule is used for converting pixel points on the first image into pixel points after distortion correction based on the internal parameters and the distortion parameters;
the area determining submodule is used for determining a target area for distortion correction based on a reference area corresponding to the pixel point after the distortion correction; the target area is a rectangular area in a reference area defined by target area parameters;
the image correction submodule is used for carrying out distortion correction on the first image corresponding to the target area to obtain an image subjected to distortion correction and a target image resolution;
the ratio of the first direction pixel data to the second direction pixel data in the target image resolution is equal to the ratio of the first direction pixel data to the second direction pixel data in the target area parameter; wherein the first direction intersects the second direction.
In some embodiments, the image rectification sub-module is configured to perform distortion rectification on a first image corresponding to the target region, and specifically includes:
carrying out distortion correction on a first image corresponding to a target area by adopting an open image library;
the vertex attributes of the computer graphics corresponding to the first image comprise: vertex coordinates and texture coordinates; the vertex coordinates are: (m/W-1.0, n/H-1.0), texture coordinates are: (X/X, Y/Y), inputting the texture coordinate corresponding to the first image into a built-in function of an open image library, and rendering the obtained image as output, namely the image after distortion correction;
wherein, (X, Y) represents any pixel in the first image, (m, n) represents the pixel after distortion correction of the pixel (X, Y) by using internal parameters and distortion parameters, X × Y represents the resolution of the original image, and W and H represent half of the side length of the target area along the first direction and the second direction, respectively.
In some embodiments, the target image resolution is M × N; the device still includes:
the parameter adjusting sub-module is configured to adjust a resolution of the target image and/or adjust a parameter of the target area, so that a ratio of first-direction pixel data to second-direction pixel data in the resolution of the target image is equal to a ratio of first-direction pixel data to second-direction pixel data of the parameter of the target area, and specifically includes:
adjusting at least one of M, N, W and H such that M: N = W: H.
In some embodiments, the internal reference determination module comprises:
the central point determining submodule is used for determining a target image central point of the camera to be calibrated, which corresponds to the target image resolution, based on the target image resolution;
the focal length determining submodule is used for determining a target focal length of the camera to be calibrated corresponding to the target image resolution by combining the focal length of the camera to be calibrated based on the target area parameter and the target image resolution;
wherein U0= M/2, V0= N/2; (U0, V0) represents the pixel coordinates of the center point of the target image of the camera to be calibrated;
wherein Fx = Fx/(W/M), fy = Fy/(H/N); fx and Fy respectively represent the focal length of the camera to be calibrated, and Fx and Fy respectively represent the target focal length of the camera to be calibrated;
the device also includes:
and a distortion parameter determination submodule for changing the distortion parameter to 0.
In some embodiments, the position transformation module is configured to convert the reference position information in the second image into the target position information corresponding to the resolution of the target image, and specifically includes:
carrying out distortion correction on the reference position information by using the internal reference and distortion parameters of the camera to be calibrated;
converting the distortion-corrected reference position information into target position information corresponding to the resolution of a target image;
wherein, the target position information is a target position coordinate:
(M×[Xdst-(U-W)]/(2W),N×[Ydst-(V-H)]/(2H));
wherein, (Xdst, ydst) represents coordinates corresponding to the reference position information after the distortion correction.
In some embodiments, the second image includes a checkerboard, and the reference position information is coordinates of corner points of the checkerboard;
the position conversion module is configured to convert the reference position information in the second image into target position information corresponding to a resolution of the target image, and specifically includes:
identifying coordinates of corner points of the checkerboard in the second image;
carrying out distortion correction on the coordinates of the angular points by using the internal parameters and distortion parameters of the camera to be calibrated;
and scaling the coordinates of the corner points after the distortion correction according to the proportion between the target area parameters and the target image resolution.
In some embodiments, the target region parameter and the target image resolution satisfy: m is less than or equal to W, and N is less than or equal to H.
The present disclosure also provides an image stitching method, including:
acquiring images to be spliced by utilizing at least two cameras;
calibrating the at least two cameras by adopting any one of the steps of the method;
and splicing the images to be spliced based on the calibrated camera parameters.
The present disclosure also provides an image stitching device, including:
the image acquisition module is used for acquiring images to be spliced by utilizing at least two cameras;
a camera calibration module, configured to calibrate the at least two cameras by using any of the above steps;
and the image splicing module is used for splicing the images to be spliced based on the calibrated camera parameters.
The present disclosure also provides a non-transitory computer readable storage medium storing a program or instructions that causes a computer to perform the steps of any of the methods described above.
The present disclosure also provides a surround view camera comprising a processor and a memory;
the processor is used for executing the steps of any one of the camera calibration methods by calling the program or the instruction stored in the memory so as to calibrate the camera;
or the processor is used for executing any of the steps of the image stitching method by calling the program or the instruction stored in the memory so as to stitch the all-around images.
The present disclosure also provides a vehicle comprising any of the above-described look-around cameras.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the camera calibration method provided by the embodiment of the disclosure comprises the following steps: acquiring a first image acquired by a camera to be calibrated; the first image has an original image resolution; carrying out distortion correction on the first image, and determining target area parameters and target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image; determining target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution; acquiring a second image acquired by a camera to be calibrated, and converting reference position information in the second image into target position information corresponding to the resolution of the target image; and determining external parameters of the camera to be calibrated based on the target internal parameters and the target position information. After the image distortion is corrected, the size of the reserved effective area is in positive correlation with the size of the resolution of the target image, namely the larger the resolution of the target image is, the larger the reserved effective area is; the larger the reserved effective area is, the easier the images spliced with each other are to be connected, namely, the easier the image splicing is, the occurrence of a blind area in the spliced images is avoided; based on the method, the internal parameters of the camera are adjusted, namely the target internal parameters are determined based on the target area parameters and the target image resolution, and the target image resolution is set to be greater than the original resolution, namely the target image resolution of the camera to be calibrated is increased, so that the external parameters of the camera to be calibrated can be calibrated based on the target internal parameters and the target position information corresponding to the large reserved effective area, the image splicing deficiency can be reduced, and the problem of splicing blind areas can be solved. Specifically, the method comprises the following steps: by setting the resolution of the target image after the distortion correction to be larger than the resolution of the original image, the image after the distortion correction under the higher resolution can be obtained, so that the reserved effective area of the image after the distortion correction is enlarged; based on the method, the target internal parameters of the camera to be calibrated are further determined, and the external parameters of the camera to be calibrated can be calibrated by combining the target position information under the target image resolution, so that the external parameters with small (even no) blind area around the all-round spliced automobile body can be obtained; therefore, the image area corresponding to the image for splicing can be enlarged, thereby being beneficial to reducing the loss of the image and further improving or even avoiding the problem of splicing blind areas.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a camera calibration method according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a camera calibration apparatus according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of an image stitching method according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an image stitching apparatus provided in an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a panoramic camera according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
In the embodiments of the present disclosure, key terms are first explained.
Intrinsic parameters of a camera, also called intrinsic parameters or intrinsic parameters, are parameters related to the characteristics of the camera itself, such as parameters of the focal length, pixel size, etc. of the camera; generally, the method participates in operation and representation in the form of 3 × 3 internal reference matrix.
The extrinsic parameters of the camera, also called extrinsic parameters or extrinsic parameters, are parameters in a world coordinate system, such as the position, rotation direction, etc. of the camera. Generally, the method participates in operation and representation in the form of 4 × 4 external parameter matrix.
Distortion parameters: and the coefficient of the conversion relation between the theoretical pixel point and the actual pixel point.
And (3) distortion correction: and (5) a process of restoring the actual pixel point to the position of the theoretical pixel point.
3D:3Dimensions means three Dimensions, three coordinates, namely length, width and height, and is three-dimensional. 3D is a concept of space, which is a space consisting of three axes X, Y, Z, relative to a plane (2D) that is only long and wide.
OpenGL: open Graphics Library, refers to an Open Graphics Library.
OpenCV: open Source Computer Vision Library is a software Library for Computer Vision and machine learning.
The camera calibration method and the image stitching method provided by the embodiment of the disclosure can be applied to a vehicle-mounted panoramic all-around system, for example, can be applied to auxiliary driving; but also can be applied to other panoramic scenes, and is not limited in the description.
Taking the vehicle-mounted panoramic looking-around system as an example, in a camera calibration process of the vehicle-mounted panoramic looking-around system, external parameters of the camera need to be calibrated, for example, external parameters of the camera can be calibrated by using a conversion function (e.g., solvePnP function) in a computer vision and machine learning software library (e.g., openCV). Generally, the SolvePnP function in OpenCV cannot directly act on the original image of the fisheye camera to solve the external parameters; instead, the distortion parameter is used to remove the image distortion and then solve the external parameter. Meanwhile, images of the vehicle-mounted panoramic all-round looking system are generally obtained by splicing images based on 4-8 cameras, so that the all-round looking effect is achieved. At present, when some vehicles are large in size, if the vehicles are spliced according to external parameters marked by distortion correction images in the related technology, because the distortion correction images in the related technology keep the original resolution (namely the resolution of the original images), the reserved effective areas of the corresponding images are limited; at this time, a portion of the stitched image based on the distortion corrected image and the calibrated external reference may be missing, which may cause a blind area in the stitched image for observing the scene around the vehicle. Namely, the camera is calibrated according to a calibration method in the related technology, and when the obtained camera internal parameter and external parameter are used for image splicing, a more complete spliced all-round video image cannot be obtained.
In view of the above, the embodiments of the present disclosure provide a camera calibration method, which can calibrate external parameters under a large reserved effective area by adjusting internal parameters of a camera to be calibrated (hereinafter, may be referred to as a "camera") and setting a resolution of a target image to be greater than a resolution of an original image, so as to reduce image stitching loss and improve the problem of stitching blind areas. Specifically, the method comprises the following steps: the resolution of the target image after the distortion correction is set to be larger than the resolution of the original image, so that an image with a larger image resolution can be obtained, and the reserved effective area is larger as the image resolution is larger, so that the reserved effective area of the image after the distortion correction is equivalently enlarged; based on the method, the internal reference of the camera is modified by combining the target area parameter and the target image resolution, namely the target internal reference is determined, and then the external reference of the camera is calibrated, so that the external parameter with small (even no) blind area around the all-round spliced vehicle body is correspondingly obtained. In other words, the region corresponding to the image for stitching can be enlarged, thereby reducing the image loss and improving the blind area problem.
The following describes, with reference to fig. 1 to 5, a camera calibration method, a camera calibration device, an image stitching method, an image stitching device, a computer-readable storage medium, a panoramic camera, and a vehicle, which are provided in the embodiments of the present disclosure.
Fig. 1 illustrates a camera calibration method provided in an embodiment of the present disclosure. As shown in fig. 1, the camera calibration method may include the following steps:
s101, acquiring a first image acquired by a camera to be calibrated.
The method comprises the following steps that a camera to be calibrated is used for collecting a first image and transmitting the first image to a camera calibration device; correspondingly, the camera calibration device acquires a first image, and the first image has the resolution of the original image.
Exemplarily, taking a camera to be calibrated as an onboard fisheye camera as an example, the first image has distortion, and distortion correction is required in subsequent steps to remove the distortion.
S102, distortion correction is carried out on the first image, and target area parameters and target image resolution of the distortion correction are determined.
Wherein the target area parameter is used to define the target area. The target area parameter is, for example, a width value characterizing two intersecting directions of the target area, and may be represented by a physical length value or a number of pixels, which is described as an example in the following, and is not limited herein; correspondingly, the target area may be a rectangular area defined by target area parameters.
The resolution of the target image is larger than that of the original image so as to increase the reserved effective area after distortion correction.
In the step, distortion correction can be performed on the first image acquired in the step S101 by using the internal reference and the distortion parameter of the camera to be calibrated, so as to obtain an image in the camera coordinate system after distortion removal.
Meanwhile, the resolution of the target image is set to be greater than that of the original image. The image resolution can represent the size of the image, and the larger the image resolution is, the larger the image is, namely, the larger the reserved effective area of the image after the distortion correction is. Therefore, the resolution of the target image is set to be larger than that of the original image, so that the resolution of the target image is increased, the reserved effective area is increased, the image missing is reduced, and the problem of a blind area during image splicing is solved.
In some embodiments, this step may be preceded by:
and acquiring internal parameters and distortion parameters of the camera to be calibrated.
For example, the internal parameters and distortion parameters of the camera to be calibrated may be built in the camera calibration device, and may be directly retrieved in this step.
Or the internal parameters and distortion parameters of the camera to be calibrated can be obtained through calibration and are called in the external parameter calibration process.
For example, the calibration step of the internal parameter and distortion parameter of the camera to be calibrated may include:
acquiring an initial image;
thereafter, the internal parameters and distortion parameters of the camera to be calibrated may be solved based on the variation relationship between the image coordinate system and the camera coordinate system in any manner known to those skilled in the art.
In an exemplary case, a camera to be calibrated is taken as a vehicle fisheye camera, and the calibration of the vehicle fisheye camera includes solving internal parameters and distortion parameters of the vehicle fisheye camera.
For example, the internal parameters of the camera to be calibrated may include fx, fy, u0, and v0; wherein fx and fy are focal lengths of the camera to be calibrated, and can be pixel focal lengths converted from physical length units according to pixels on unit size, so as to keep consistent with units of other parameters; u0 and v0 are the center point pixel coordinates of the image. The distortion parameter may be a polynomial corresponding to a camera model of the camera to be calibrated, and the coefficients of the calculated polynomial may include corresponding coefficients of different secondary terms in the polynomial, which may be represented by k1, k2, k3, k4, and the like, for example, and is not limited herein.
It can be understood that the initial image obtained in the process of solving the intrinsic and distortion parameters may be the same as or different from the first image in S101, and is not limited herein.
S103, determining target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution.
The target internal parameter is the internal parameter of the camera to be calibrated under the resolution of the target image, and is obtained by conversion based on the inherent internal parameter of the camera to be calibrated, the target area parameter and the resolution of the target image. That is, in this step, based on the target image resolution and the target region parameter of distortion correction, the internal parameters of the camera to be calibrated are adjusted, that is, the internal parameters in the original image resolution are converted into the target internal parameters in the target image resolution, so that the adjusted internal parameters can correspond to the size of the reserved effective region corresponding to the target image resolution, so as to calculate the external parameters of the camera to be calibrated in the larger reserved effective region in the subsequent step, and facilitate to realize more accurate calibration of the external parameters of the camera to be calibrated.
And S104, acquiring a second image acquired by the camera to be calibrated, and converting the reference position information in the second image into target position information corresponding to the resolution of the target image.
The second image is an image used for external reference calibration of the camera to be calibrated.
Illustratively, when there are at least two cameras to be calibrated and their images are used for stitching, the steps may be: and respectively acquiring images including calibration objects under the same world coordinate system acquired by each camera to be calibrated, and converting reference point coordinates in the calibration objects into coordinates corresponding to the target image resolution. The method and the device have the advantages that the images in the same world coordinate system are obtained, so that at least two cameras to be calibrated can be conveniently registered in the same world coordinate system, and image splicing among different cameras to be calibrated is realized.
In this step, by converting the reference position information (for example, the reference point coordinates in the calibration object) into the target position information (for example, the reference position information may be represented by coordinates) corresponding to the target image resolution, the reference position information in the image coordinate system corresponding to the second image can be converted into the position information in the image coordinate system after the distortion is removed, and the position information is enlarged to obtain the target position information after the distortion correction and the enlargement, so as to be conveniently combined with the target internal reference of the camera to be calibrated determined in the foregoing S103 to obtain the external reference of the camera to be calibrated at the target image resolution, that is, the external reference corresponding to the camera to be calibrated at the larger reserved effective area, that is, the following S105.
It can be understood that the second image in this step may be the same as or different from the first image in S101 and the initial image, and is not limited herein.
And S105, determining external parameters of the camera to be calibrated based on the target internal parameters and the target position information.
And solving the external parameters of the camera to be calibrated based on the changed internal parameters of the camera to be calibrated and the target position information corresponding to the target image resolution.
Exemplarily, in this step, in combination with the above, the 3D coordinates of the reference point of the calibration object in the world coordinate system are known, the camera intrinsic parameters and distortion parameters after modification are determined in the foregoing S103, the coordinates of the corresponding distortion-corrected and enlarged reference point in the image coordinate system are determined in the foregoing S104, and they are combined, that is, the coordinates in the camera coordinate system and the transformation relation matrix between the world coordinate system and the camera coordinate system, that is, the camera extrinsic parameters, are solved.
Illustratively, the camera extrinsic parameters can be solved using the SolvePNP function in OpenCV. For example, for four cameras on board a vehicle, the calibration of the camera external parameters can be performed with respect to the same world coordinate system.
In the camera calibration method provided by the embodiment of the disclosure, a first image acquired by a camera to be calibrated is acquired; the first image has an original image resolution; carrying out distortion correction on the first image, and determining target area parameters and target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image; determining target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution; acquiring a second image acquired by a camera to be calibrated, and converting reference position information in the second image into target position information corresponding to the resolution of the target image; and determining external parameters of the camera to be calibrated based on the target internal parameters and the target position information. After the image distortion is corrected, the size of the reserved effective area is in positive correlation with the size of the resolution of the target image, namely the larger the resolution of the target image is, the larger the reserved effective area is; the larger the reserved effective area is, the easier the images spliced with each other are to be connected, namely, the easier the image splicing is, the occurrence of a blind area in the spliced images is avoided; based on the method, the internal parameters of the camera are adjusted, namely the target internal parameters are determined based on the target area parameters and the target image resolution, and the target image resolution is set to be greater than the original resolution, namely the target image resolution of the camera to be calibrated is increased, so that the external parameters of the camera to be calibrated can be calibrated based on the target internal parameters and the target position information corresponding to the large reserved effective area, the image splicing deficiency can be reduced, and the problem of splicing blind areas can be solved. Specifically, the method comprises the following steps: by setting the resolution of the target image after the distortion correction to be larger than the resolution of the original image, the image after the distortion correction under the higher resolution can be obtained, so that the reserved effective area of the image after the distortion correction is enlarged; based on the method, the target internal parameters of the camera to be calibrated are further determined, and the external parameters of the camera to be calibrated can be calibrated by combining the target position information under the target image resolution, so that the external parameters with small (even no) blind area around the all-round spliced automobile body can be obtained; therefore, the image area corresponding to the image for splicing can be enlarged, thereby being beneficial to reducing the loss of the image and further improving or even avoiding the problem of splicing blind areas.
The following describes an exemplary implementation of the steps in the camera calibration method.
In some embodiments, with reference to fig. 1, S102 may specifically include:
based on the internal parameters and the distortion parameters, converting pixel points on the first image into pixel points after distortion correction;
determining a target area for distortion correction based on a reference area corresponding to the pixel point after the distortion correction; the target area is a rectangular area in a reference area defined by target area parameters;
carrying out distortion correction on a first image corresponding to the target area to obtain an image subjected to distortion correction and a target image resolution;
and the ratio of the first direction pixel data to the second direction pixel data in the target image resolution is equal to the ratio of the first direction pixel data to the second direction pixel data in the target area parameter, and the first direction is crossed with the second direction. Optionally, the first direction and the second direction are perpendicular, and are respectively a transverse direction (for example, an X-axis direction) and a longitudinal direction (for example, a Y-axis direction), so as to define a rectangular target region parameter.
Further, in the above embodiments, the distortion correction of the first image may include implementing image distortion correction by OpenGL or other manners known to those skilled in the art, and the image distortion correction by OpenGL is exemplified below.
In some embodiments, the "performing distortion correction on the first image corresponding to the target region" may specifically include:
and performing distortion correction on the first image corresponding to the target area by using an open image library (namely OpenGL).
The vertex attributes of the computer graphics corresponding to the first image comprise: vertex coordinates and texture coordinates; the vertex coordinates are: (m/W-1.0, n/H-1.0), texture coordinates are: (X/X, Y/Y), inputting the texture coordinate corresponding to the first image into a built-in function of an open image library, and rendering the obtained image as output, namely the image after distortion correction;
wherein, (X, Y) represents any pixel point in the first image, and (m, n) represents a pixel point (X, Y) after distortion correction is performed by using internal parameters and distortion parameters, X × Y represents the resolution of the original image, W and H represent half of the side length of the target region along the first direction and the second direction respectively, that is, W and H represent the unilateral half side length of the target region along the first direction and the second direction respectively.
In the embodiment of the present disclosure, distortion correction is performed on the first image corresponding to the target area according to the following scheme.
Wherein, any pixel point (x, y) on the first image is transformed according to the internal parameter and distortion parameter of the camera to be calibrated, and the corresponding pixel point (m, n) after distortion correction is obtained; selecting the range of the rectangular area of the original image as follows: transverse (xmin, xmax), longitudinal (ymin, ymax); and obtaining the rectangular area range corresponding to the distortion-corrected pixel points as follows: transverse (mmin, mmax), longitudinal (nmin, nmax). And the pixel point coordinate (U, V) obtained by correspondingly correcting the distortion of the pixel coordinate (U0, V0) of the central line point on the first image is (U, V). At this time, (U, V) may be made the center point of the distortion correction. The method comprises the following specific steps: the transverse half side length of the target area parameter is W, and W = min (U-mmin, mmax-U) is met, namely, the smaller one of the left half side length and the right half side length is taken as the transverse half side length; the length of the longitudinal half side of the target region parameter is H, and H = min (V-nmin, nmax-V) is satisfied, namely, the smaller one of the length of the upper half side and the length of the lower half side is taken as the length of the longitudinal half side; and determining a reserved area for distortion correction based on the determined transverse half side length and longitudinal half side length, wherein the transverse pixel area is (U-W, U + W), and the longitudinal pixel area is (V-H, V + H). Thus, W and H define the target area, which is a rectangular area, and the reference area may be a circular area or polygonal irregular area that is the same as the center of the rectangular area and is greater than or equal to the target area, or a circular or polygonal irregular area that is understood to circumscribe the target area, which is not limited herein.
Exemplarily, performing distortion correction on the first image by using OpenGL, wherein the vertex attributes are vertex coordinates and texture coordinates, the vertex coordinates are (m/W-1.0, n/H-1.0), the corresponding texture coordinates are (X/X, Y/Y), namely the vertex coordinates correspond to normalization processing, and the horizontal and vertical coordinates range is-1 to 1; correspondingly normalizing the texture coordinates, and taking X and Y as normalization reference; then, texture coordinates corresponding to the first image, for example, a fisheye video image, are input into a built-in function of an open image library, and an image video obtained by rendering is a distortion correction result, namely, an image after distortion correction is obtained.
In some embodiments, the target image resolution is M × N.
In the embodiment of the present disclosure, the resolution of the image after distortion correction is set, that is, which portions of the image are reserved are determined, for example: the original image resolution was 1280 × 720, written as: x is Y; the target image resolution is 2160 × 1440 or other resolutions greater than 1280 × 720, which may be written as mxn depending on the image stitching effect.
It can be understood that the upper limit of the resolution of the target image is at most the maximum inscribed rectangle of the image boundary resulting from the distortion correction; meanwhile, factors such as image accuracy, definition, data processing speed and the like are considered, the maximum inscribed rectangle can be collapsed, namely, a small rectangle is taken, so that the blind area is improved, the image is ensured to be accurate and clear, and better image quality is ensured.
Based on this, the method further comprises: adjusting the resolution of the target image and/or adjusting the parameters of the target area to make the ratio of the first direction pixel data to the second direction pixel data in the resolution of the target image equal to the ratio of the first direction pixel data to the second direction pixel data of the parameters of the target area, and may specifically include:
adjusting at least one of M, N, W and H such that M: N = W: H.
The target image resolution is M × N, and M: N = W: H must be ensured in the embodiment of the present disclosure to ensure that the aspect ratio of the image is fixed, so that the image is not distorted, which is beneficial to ensuring a good image display effect. And specifically, the value of W or H may be altered while ensuring that M: N is unchanged; when more image content is retained, the value of W or H may be increased; or the value of M or N may be changed with the assurance that W: H is unchanged. That is, as long as the ratio of M to N set in the foregoing step does not match the ratio of W to H in this step, at least one of M, N, W and H is directly changed to ensure that M: N = W: H, which is not limited herein.
In some embodiments, the target region parameter and the target image resolution satisfy between: m is less than or equal to W, and N is less than or equal to H.
By the arrangement, the data processing amount can be reduced, the data processing speed is increased, and the external reference calibration speed of the camera to be calibrated is increased. When the system is applied to a vehicle-mounted all-round system, the timeliness and the real-time property of obtaining the scene around the vehicle body are improved.
In some embodiments, with reference to fig. 1, S103 may specifically include:
determining a target image center point of a camera to be calibrated corresponding to the target image resolution based on the target image resolution;
determining a target focal length of the camera to be calibrated corresponding to the target image resolution by combining the focal length of the camera to be calibrated based on the target area parameters and the target image resolution;
wherein U0= M/2, V0= N/2; (U0, V0) represents the pixel coordinates of the center point of the target image of the camera to be calibrated;
wherein Fx = Fx/(W/M), fy = Fy/(H/N); fx and Fy represent the focal length of the camera to be calibrated respectively, and Fx and Fy represent the target focal length of the camera to be calibrated respectively.
Further, the camera calibration method may further include: the distortion parameter is changed to 0.
Thus, the determination of the internal parameters and distortion parameters of the camera to be calibrated is realized, the central point of the image is ensured to be unchanged, and the focal length is changed in proportion; therefore, the method is suitable for solving the external parameters of the camera to be calibrated in a large reserved effective area corresponding to the resolution of the target image.
In some embodiments, with reference to fig. 1, the "converting the reference position information in the second image into the target position information corresponding to the resolution of the target image" in S104 may specifically include:
carrying out distortion correction on the reference position information by using the internal reference and distortion parameters of the camera to be calibrated;
converting the distortion-corrected reference position information into target position information corresponding to the resolution of a target image;
wherein, the target position information is a target position coordinate:
(M×[Xdst-(U-W)]/(2W),N×[Ydst-(V-H)]/(2H));
wherein, (Xdst, ydst) represents coordinates corresponding to the reference position information after the distortion correction.
Thereby, the reference position information is converted into the target position information. For example, the coordinates of the reference point in the calibration object are transformed into coordinates which are corrected for distortion and enlarged corresponding to the resolution of the target image, so that the solution of the camera external parameters can be performed corresponding to a larger reserved effective area.
In some embodiments, the second image includes a checkerboard, and the reference position information is coordinates of corner points of the checkerboard;
converting the reference position information in the second image into target position information corresponding to a target image resolution, comprising:
identifying coordinates of corner points of the checkerboard in the second image;
carrying out distortion correction on the coordinates of the angular points by using the internal parameters and distortion parameters of the camera to be calibrated;
and scaling the coordinates of the corner points after the distortion correction according to the proportion between the target area parameters and the target image resolution.
In the embodiment of the present disclosure, a checkerboard may be laid or drawn on the ground (e.g., a plane surrounding a vehicle), and then a camera to be calibrated, such as a fish-eye camera, is used to acquire a fish-eye image including the checkerboard, and the fish-eye image with the checkerboard is processed as follows:
A. extracting coordinates of the corner points (Xsrc, ysrc);
B. distortion correction is carried out on the coordinates of the angular points according to the internal parameters fx, fy, u0 and v0 and the distortion parameters acquired in the step S1011, and the coordinates of the angular points after the distortion correction are expressed as (Xdst, ydst);
C. further transformation is as follows: (M x [ Xdst- (U-W) ]/(2W), N x [ Ydst- (V-H) ]/(2H));
thus obtaining the coordinates after distortion correction and magnification; in the subsequent steps, the external parameters of the camera can be solved by combining the changed internal parameters and the changed distortion parameters, so that the external parameter calibration is realized.
The camera calibration method provided by the embodiment of the disclosure is applicable to external parameter calibration of a fisheye camera, more effective areas are reserved during image distortion processing, reference point coordinates in an image are proportionally transformed based on the resolution of a target image, and internal parameters and distortion parameters of the camera are correspondingly changed, so that the external parameters of the camera can be calculated by modifying the internal parameters, the distortion parameters and a corresponding formula for removing distortion of pixel points while the effective areas are larger than those of the fisheye image distortion removal in the related technology; the method has the advantages that the external parameter calculation of the camera is accurate, the image loss is less, and the blind area of vehicle-mounted all-round view image splicing can be reduced.
It can be understood that when the camera to be calibrated is a vehicle-mounted camera, the size of the target image resolution corresponding to the reserved effective area is related to factors such as the size of the vehicle, the position of the camera, the visual angle of the camera and the like; qualitatively, the larger the vehicle size is, the farther the camera is from the center of the vehicle, the smaller the camera angle is, the larger the effective area should be reserved, and the larger the corresponding image resolution after distortion correction should be, so as to reserve as many pictures as possible and reduce the splicing blind area.
The embodiments of the present disclosure further provide a camera calibration apparatus, which is capable of performing any of the steps of the camera calibration method provided in the embodiments of the present disclosure to achieve corresponding beneficial effects, and the same points can be understood with reference to the explanation of the camera calibration method in the foregoing, which is not repeated herein.
Hereinafter, a camera calibration apparatus provided in an embodiment of the present disclosure is exemplarily described with reference to fig. 2.
Fig. 2 shows a schematic structural diagram of a camera calibration device provided in an embodiment of the present disclosure.
As shown in fig. 2, the camera calibration device 20 may include:
a first obtaining module 210, configured to obtain a first image collected by a camera to be calibrated; the first image has an original image resolution;
the distortion correction module 220 is configured to perform distortion correction on the first image, and determine a target area parameter and a target image resolution for the distortion correction; wherein the resolution of the target image is greater than that of the original image;
an internal reference determining module 230, configured to determine, based on the target region parameter and the target image resolution, a target internal reference of the camera to be calibrated, where the target internal reference corresponds to the target image resolution;
the position conversion module 240 is configured to obtain a second image acquired by the camera to be calibrated, and convert reference position information in the second image into target position information corresponding to a resolution of the target image;
and the external parameter solving module 250 is configured to determine an external parameter of the camera to be calibrated based on the target internal parameter and the target position information.
In the camera calibration device 20 provided by the embodiment of the present disclosure, through cooperation among the above functional modules, a first image acquired by a camera to be calibrated can be acquired; the first image has an original image resolution; carrying out distortion correction on the first image, and determining target area parameters and target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image; determining target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution; acquiring a second image acquired by a camera to be calibrated, and converting reference position information in the second image into target position information corresponding to the resolution of the target image; and determining external parameters of the camera to be calibrated based on the target internal parameters and the target position information. After the image distortion is corrected, the size of the reserved effective area is in positive correlation with the size of the resolution of the target image, namely the larger the resolution of the target image is, the larger the reserved effective area is; the larger the reserved effective area is, the easier the images spliced with each other are to be connected, namely, the easier the image splicing is, the occurrence of a blind area in the spliced images is avoided; based on the method, the internal parameters of the camera are adjusted, namely the target internal parameters are determined based on the target area parameters and the target image resolution, and the target image resolution is set to be greater than the original resolution, namely the target image resolution of the camera to be calibrated is increased, so that the external parameters of the camera to be calibrated can be calibrated based on the target internal parameters and the target position information corresponding to the large reserved effective area, the image splicing deficiency can be reduced, and the problem of splicing blind areas can be solved. Specifically, the method comprises the following steps: by setting the resolution of the target image after the distortion correction to be larger than the resolution of the original image, the image after the distortion correction under a larger resolution can be obtained, so that the reserved effective area of the image after the distortion correction is enlarged; based on the method, the target internal parameters of the camera to be calibrated are further determined, and the external parameters of the camera to be calibrated can be calibrated by combining the target position information under the target image resolution, so that the external parameters with small (even no) blind area around the all-round spliced automobile body can be obtained; therefore, the image area corresponding to the image for splicing can be enlarged, thereby being beneficial to reducing the loss of the image and further improving or even avoiding the problem of splicing blind areas.
In some embodiments, the apparatus further comprises:
the auxiliary acquisition module is used for acquiring internal parameters and distortion parameters of the camera to be calibrated;
wherein, the distortion correcting module 220 comprises:
the pixel point transformation submodule is used for converting pixel points on the first image into pixel points after distortion correction based on the internal parameters and the distortion parameters;
the area determination submodule is used for determining a target area of the distortion correction based on a reference area corresponding to the pixel point after the distortion correction; the target area is a rectangular area in a reference area defined by target area parameters;
the image correction submodule is used for carrying out distortion correction on the first image corresponding to the target area to obtain an image subjected to distortion correction and a target image resolution;
the ratio of the first direction pixel data to the second direction pixel data in the target image resolution is equal to the ratio of the first direction pixel data to the second direction pixel data in the target area parameter; wherein the first direction intersects the second direction.
In some embodiments, the image rectification sub-module is configured to perform distortion rectification on a first image corresponding to the target region, and specifically includes:
carrying out distortion correction on a first image corresponding to a target area by adopting an open image library;
the vertex attributes of the computer graphics corresponding to the first image comprise: vertex coordinates and texture coordinates; the vertex coordinates are: (m/W-1.0, n/H-1.0), texture coordinates are: (X/X, Y/Y), inputting texture coordinates corresponding to the first image into a built-in function of an open image library, and rendering the obtained image as output, namely the image after distortion correction;
wherein, (X, Y) represents any pixel point in the first image, (m, n) represents a pixel point (X, Y) after distortion correction is carried out by utilizing internal parameters and distortion parameters, X multiplied by Y represents the resolution of the original image, and W and H represent half of the side length of the target area along the first direction and the second direction respectively.
In some embodiments, the target image resolution is M × N; the device still includes:
the parameter adjusting sub-module is configured to adjust a resolution of the target image and/or adjust a parameter of the target area, so that a ratio of first-direction pixel data to second-direction pixel data in the resolution of the target image is equal to a ratio of first-direction pixel data to second-direction pixel data of the parameter of the target area, and specifically includes:
adjusting at least one of M, N, W and H such that M: N = W: H.
In some embodiments, the internal reference determination module 230 includes:
the center point determining submodule is used for determining the center point of the target image of the camera to be calibrated corresponding to the resolution of the target image based on the resolution of the target image;
the focal length determining submodule is used for determining a target focal length of the camera to be calibrated corresponding to the target image resolution by combining the focal length of the camera to be calibrated based on the target area parameter and the target image resolution;
wherein U0= M/2 and V0= N/2; (U0, V0) represents the pixel coordinates of the center point of the target image of the camera to be calibrated;
wherein Fx = Fx/(W/M), fy = Fy/(H/N); fx and Fy respectively represent the focal length of the camera to be calibrated, and Fx and Fy respectively represent the target focal length of the camera to be calibrated;
the device also includes:
and a distortion parameter determination submodule for changing the distortion parameter to 0.
In some embodiments, the position transformation module 240 is configured to convert the reference position information in the second image into the target position information corresponding to the resolution of the target image, and specifically includes:
carrying out distortion correction on the reference position information by using the internal reference and distortion parameters of the camera to be calibrated;
converting the distortion-corrected reference position information into target position information corresponding to the resolution of a target image;
wherein, the target position information is a target position coordinate:
(M×[Xdst-(U-W)]/(2W),N×[Ydst-(V-H)]/(2H));
wherein, (Xdst, ydst) represents coordinates corresponding to the reference position information after the distortion correction.
In some embodiments, the second image includes a checkerboard, and the reference position information is coordinates of corner points of the checkerboard;
the position transformation module 240 is configured to convert the reference position information in the second image into target position information corresponding to a resolution of the target image, and specifically includes:
identifying coordinates of corner points of the checkerboard in the second image;
carrying out distortion correction on coordinates of the angular points by utilizing internal parameters and distortion parameters of a camera to be calibrated;
and scaling the coordinates of the corner points after the distortion correction according to the proportion between the target area parameters and the target image resolution.
In some embodiments, the target region parameter and the target image resolution satisfy: m is less than or equal to W, and N is less than or equal to H.
It should be noted that the camera calibration apparatus 20 shown in fig. 2 may perform each step in the method embodiment shown in fig. 1, and implement each process and effect in the method embodiment shown in fig. 1, which are not described herein again.
On the basis of the above embodiment, the embodiment of the present disclosure further provides an image stitching method, where the image stitching method includes any one of the camera calibration methods provided in the above embodiments, and the stitching blind area can be reduced, so as to improve the image stitching effect.
Hereinafter, an image stitching method provided by the embodiment of the present disclosure is exemplarily described with reference to fig. 3.
Fig. 3 shows a flowchart of an image stitching method according to an embodiment of the present disclosure.
As shown in fig. 3, the image stitching method may include the following steps:
s301, acquiring images to be spliced by using at least two cameras.
S302, calibrating at least two cameras by adopting the camera calibration method.
In the embodiment of the present disclosure, the camera calibration method may adopt any one of the camera calibration methods in the above embodiments.
And S303, splicing the images to be spliced based on the calibrated camera parameters.
In the image stitching method provided by the embodiment of the disclosure, any one of the camera calibration methods in the above embodiments is adopted, and external parameters under a larger reserved effective area can be calibrated by adjusting internal parameters of the camera and increasing the resolution of a target image, so that the image stitching loss is reduced, and the problem of stitching blind areas is solved.
On the basis of the foregoing embodiment, an embodiment of the present disclosure further provides an image stitching device, where the image stitching device is capable of performing any step of the image stitching method provided in the embodiment of the present disclosure, so as to achieve corresponding beneficial effects, and the same points may be understood with reference to the above explanation of the image stitching method, which is not repeated herein.
Hereinafter, an image stitching apparatus provided by an embodiment of the present disclosure is exemplarily described with reference to fig. 4.
Fig. 4 shows a schematic structural diagram of an image stitching device provided by an embodiment of the present disclosure.
As shown in fig. 4, the image stitching device 40 may include:
an image obtaining module 410, configured to obtain images to be stitched by using at least two cameras;
a camera calibration module 420, configured to calibrate at least two cameras by using any of the above steps of the method;
and the image stitching module 430 is configured to perform stitching on the images to be stitched based on the calibrated camera parameters.
In the image stitching device 40 provided in the embodiment of the present disclosure, since the functional module thereof can implement any one of the camera calibration methods in the foregoing embodiments, calibration of external parameters under a large reserved effective area can be implemented by adjusting internal parameters of the camera and increasing the resolution of the target image, thereby reducing image stitching loss and improving the problem of stitching blind areas.
The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium, where a program or an instruction is stored, and the program or the instruction causes a computer to execute the steps of any of the above methods, so as to achieve corresponding beneficial effects, and in order to avoid repeated description, details are not repeated here.
The embodiment of the present disclosure also provides a panoramic camera, which includes a processor and a memory; the processor is used for executing the steps of any one of the camera calibration methods by calling the program or the instruction stored in the memory so as to calibrate the camera; or the processor is used for executing the steps of any one of the image splicing methods by calling a program or an instruction stored in the memory so as to splice the all-round images. The calibration of the external parameters under a large reserved effective area can be realized by adjusting the internal parameters of the camera and increasing the resolution of the target image, so that the image splicing deficiency is reduced, and the problem of splicing blind areas is solved.
Illustratively, the look-around camera may be a vehicle-mounted look-around camera.
Exemplarily, fig. 5 illustrates a schematic structural diagram of a vehicle-mounted all-around camera provided by an embodiment of the present disclosure.
As shown in fig. 5, the around view camera may include: at least one processor 501, at least one memory 502, and at least one communication interface 503. The various components in the surround view camera are coupled together by a bus system 504. A communication interface 503 for information transmission with an external device. It is understood that the bus system 504 is used to enable communications among the components. The bus system 504 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, the various buses are labeled as bus system 504 in figure 5.
It will be appreciated that the memory 502 in this embodiment can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory.
In some embodiments, memory 502 stores elements, executable units or data structures, or a subset thereof, or an expanded set thereof as follows: an operating system and an application program.
The operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application programs, including various application programs such as a Media Player (Media Player), a Browser (Browser), etc., are used to implement various application services. The program for implementing the method provided by the embodiment of the present disclosure may be included in an application program.
In the embodiment of the present disclosure, the processor 501 is configured to execute the steps of the embodiments of the method provided by the embodiment of the present disclosure by calling a program or an instruction stored in the memory 502, which may be specifically a program or an instruction stored in an application program.
The method provided by the embodiment of the present disclosure may be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 501. The Processor 501 may be a general-purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The steps of the method provided by the embodiment of the present disclosure may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and performs the steps of the method in combination with its hardware.
The disclosed embodiment also provides a vehicle comprising any one of the above all-round cameras. The panoramic all-around camera can be applied to a vehicle-mounted panoramic all-around system, the problem of a blind area of image splicing is solved, the image splicing effect is good, the vehicle-mounted panoramic all-around system can accurately identify the environment around a vehicle body, and accurate image information can be provided for automatic driving or auxiliary driving.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The previous description is only for the purpose of describing particular embodiments of the present disclosure, so as to enable those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (15)

1. A camera calibration method is characterized by comprising the following steps:
acquiring a first image acquired by a camera to be calibrated; the first image has an original image resolution;
carrying out distortion correction on the first image, and determining a target area parameter and a target image resolution of the distortion correction; wherein the resolution of the target image is greater than that of the original image;
determining a target internal reference of the camera to be calibrated, which corresponds to the target image resolution, based on the target area parameter and the target image resolution;
acquiring a second image acquired by the camera to be calibrated, and converting reference position information in the second image into target position information corresponding to the resolution of the target image;
and determining external parameters of the camera to be calibrated based on the target internal parameters and the target position information.
2. The method of claim 1, wherein prior to performing distortion correction on the first image and determining a target region parameter and a target image resolution for distortion correction, the method further comprises:
acquiring internal parameters and distortion parameters of the camera to be calibrated;
wherein, carrying out distortion correction on the first image, and determining the target area parameter and the target image resolution of the distortion correction comprises the following steps:
based on the internal parameters and the distortion parameters, converting pixel points on the first image into pixel points after distortion correction;
determining a target area for distortion correction based on the reference area corresponding to the pixel point after distortion correction; the target region is a rectangular region within the reference region defined by the target region parameters;
carrying out distortion correction on the first image corresponding to the target area to obtain an image subjected to distortion correction and a target image resolution;
wherein a ratio of first-direction pixel data to second-direction pixel data in the target image resolution is equal to a ratio of first-direction pixel data to second-direction pixel data in the target area parameter, and the first direction intersects with the second direction.
3. The method of claim 2, wherein performing distortion correction on the first image corresponding to the target region comprises:
carrying out distortion correction on the first image corresponding to the target area by adopting an open image library;
the vertex attribute of the computer graph corresponding to the first image comprises: vertex coordinates and texture coordinates; the vertex coordinates are: (m/W-1.0, n/H-1.0), texture coordinates are: (X/X, Y/Y), inputting the texture coordinates corresponding to the first image into a built-in function of the open image library, and rendering the obtained image as output, namely the image after distortion correction;
wherein, (X, Y) represents any pixel point in the first image, (m, n) represents a pixel point (X, Y) after distortion correction is carried out by utilizing internal parameters and distortion parameters, X multiplied by Y represents the resolution of the original image, and W and H represent half of the side length of the target area along the first direction and the second direction respectively.
4. The method of claim 3, wherein the target image resolution is M x N; the method further comprises the following steps:
adjusting the target image resolution and/or adjusting the target area parameter so that a ratio of first-direction pixel data to second-direction pixel data in the target image resolution is equal to a ratio of first-direction pixel data to second-direction pixel data in the target area parameter, includes:
adjusting at least one of M, N, W and H such that M: N = W: H.
5. The method of claim 4, wherein determining the target internal parameter of the camera to be calibrated corresponding to the target image resolution based on the target area parameter and the target image resolution comprises:
determining a target image center point of the camera to be calibrated corresponding to the target image resolution based on the target image resolution;
determining a target focal length of the camera to be calibrated corresponding to the target image resolution based on the target area parameter and the target image resolution in combination with the focal length of the camera to be calibrated;
wherein U0= M/2, V0= N/2; (U0, V0) represents the pixel coordinates of the center point of the target image of the camera to be calibrated;
wherein Fx = Fx/(W/M), fy = Fy/(H/N); fx and Fy respectively represent the focal length of the camera to be calibrated, and Fx and Fy respectively represent the target focal length of the camera to be calibrated;
the method further comprises the following steps:
the distortion parameter is changed to 0.
6. The method of claim 4, wherein converting the reference position information in the second image into target position information corresponding to the target image resolution comprises:
carrying out distortion correction on the reference position information by using the internal reference and distortion parameters of the camera to be calibrated;
converting the distortion-corrected reference position information into target position information corresponding to the resolution of the target image;
wherein, the target position information is a target position coordinate:
(M×[Xdst-(U-W)]/(2W),N×[Ydst-(V-H)]/(2H));
wherein, (Xdst, ydst) represents coordinates corresponding to the reference position information after the distortion correction.
7. The method according to claim 4, wherein the second image includes a checkerboard, and the reference position information is coordinates of corner points of the checkerboard;
converting the reference position information in the second image into target position information corresponding to the target image resolution, including:
identifying coordinates of corner points of the checkerboard in the second image;
carrying out distortion correction on the coordinates of the angular points by using the internal parameters and distortion parameters of the camera to be calibrated;
and scaling the coordinates of the corner points after the distortion correction according to the proportion between the target area parameters and the target image resolution.
8. The method according to any one of claims 4-7, wherein the target region parameter and the target image resolution satisfy: m is less than or equal to W, and N is less than or equal to H.
9. A camera calibration device is characterized by comprising:
the first acquisition module is used for acquiring a first image acquired by a camera to be calibrated; the first image has an original image resolution;
the distortion correction module is used for carrying out distortion correction on the first image and determining a target area parameter and a target image resolution ratio of the distortion correction; wherein the resolution of the target image is greater than that of the original image;
the internal parameter determining module is used for determining the target internal parameters of the camera to be calibrated corresponding to the target image resolution based on the target area parameters and the target image resolution;
the position conversion module is used for acquiring a second image acquired by the camera to be calibrated and converting reference position information in the second image into target position information corresponding to the resolution of the target image;
and the external parameter solving module is used for determining the external parameters of the camera to be calibrated based on the target internal parameters and the target position information.
10. The apparatus of claim 9, further comprising:
the auxiliary acquisition module is used for acquiring the internal parameters and distortion parameters of the camera to be calibrated;
wherein the aberration correction module comprises:
the pixel point transformation submodule is used for converting pixel points on the first image into pixel points after distortion correction based on the internal parameters and the distortion parameters;
the area determination submodule is used for determining a target area for distortion correction based on the reference area corresponding to the pixel point after the distortion correction; the target region is a rectangular region within the reference region defined by the target region parameters;
the image correction submodule is used for carrying out distortion correction on the first image corresponding to the target area to obtain an image subjected to distortion correction and a target image resolution;
wherein a ratio of first direction pixel data to second direction pixel data in the target image resolution is equal to a ratio of first direction pixel data to second direction pixel data in the target area parameter; wherein the first direction intersects the second direction.
11. An image stitching method, comprising:
acquiring images to be spliced by utilizing at least two cameras;
calibrating the at least two cameras using the steps of the method of any one of claims 1 to 8;
and splicing the images to be spliced based on the calibrated camera parameters.
12. An image stitching device, comprising:
the image acquisition module is used for acquiring images to be spliced by utilizing at least two cameras;
a camera calibration module for calibrating the at least two cameras using the steps of the method of any one of claims 1 to 8;
and the image splicing module is used for splicing the images to be spliced based on the calibrated camera parameters.
13. A non-transitory computer-readable storage medium storing a program or instructions for causing a computer to perform the steps of the method according to any one of claims 1 to 8.
14. A panoramic camera comprising a processor and a memory;
the processor is configured to perform the steps of the method according to any one of claims 1 to 8 by calling a program or instructions stored in the memory to perform the calibration of the camera;
alternatively, the processor is configured to perform the steps of the method of claim 11 by calling a program or instructions stored in the memory to perform the stitching of the panoramic image.
15. A vehicle comprising the look-around camera of claim 14.
CN202110948787.4A 2021-08-18 2021-08-18 Camera calibration method, image splicing method, device, medium, camera and vehicle Pending CN115439548A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110948787.4A CN115439548A (en) 2021-08-18 2021-08-18 Camera calibration method, image splicing method, device, medium, camera and vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110948787.4A CN115439548A (en) 2021-08-18 2021-08-18 Camera calibration method, image splicing method, device, medium, camera and vehicle

Publications (1)

Publication Number Publication Date
CN115439548A true CN115439548A (en) 2022-12-06

Family

ID=84240024

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110948787.4A Pending CN115439548A (en) 2021-08-18 2021-08-18 Camera calibration method, image splicing method, device, medium, camera and vehicle

Country Status (1)

Country Link
CN (1) CN115439548A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116433535A (en) * 2023-06-12 2023-07-14 合肥埃科光电科技股份有限公司 Point coordinate de-distortion method, system and storage medium for quadratic curve fitting

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116433535A (en) * 2023-06-12 2023-07-14 合肥埃科光电科技股份有限公司 Point coordinate de-distortion method, system and storage medium for quadratic curve fitting
CN116433535B (en) * 2023-06-12 2023-09-05 合肥埃科光电科技股份有限公司 Point coordinate de-distortion method, system and storage medium for quadratic curve fitting

Similar Documents

Publication Publication Date Title
CN109741455B (en) Vehicle-mounted stereoscopic panoramic display method, computer readable storage medium and system
CN106952311B (en) Auxiliary parking system and method based on panoramic stitching data mapping table
KR100914211B1 (en) Distorted image correction apparatus and method
CN110728638A (en) Image distortion correction method, vehicle machine and vehicle
CN111179168B (en) Vehicle-mounted 360-degree panoramic all-around monitoring system and method
CN110264395B (en) Lens calibration method and related device of vehicle-mounted monocular panoramic system
CN112070886B (en) Image monitoring method and related equipment for mining dump truck
JP2010103730A (en) Calibration device and calibration method of car-mounted camera
US20170358056A1 (en) Image generation device, coordinate converison table creation device and creation method
CN113870161A (en) Vehicle-mounted 3D (three-dimensional) panoramic stitching method and device based on artificial intelligence
CN107492125A (en) The processing method of automobile fish eye lens panoramic view picture
CN113362228A (en) Method and system for splicing panoramic images based on improved distortion correction and mark splicing
DE102020131267A1 (en) CALIBRATE CAMERAS AND CALCULATE POINT PROJECTIONS USING AN AXIAL VIEWPOINT SHIFT, NON-CENTRAL CAMERA MODEL
CN114972023A (en) Image splicing processing method, device and equipment and computer storage medium
CN114549666B (en) AGV-based panoramic image splicing calibration method
CN115936995A (en) Panoramic splicing method for four-way fisheye cameras of vehicle
TWI443604B (en) Image correction method and image correction apparatus
CN113034616A (en) Camera external reference calibration method and system for vehicle all-round looking system and all-round looking system
CN115439548A (en) Camera calibration method, image splicing method, device, medium, camera and vehicle
CN111815752B (en) Image processing method and device and electronic equipment
CN110400255B (en) Vehicle panoramic image generation method and system and vehicle
CN113658262A (en) Camera external parameter calibration method, device, system and storage medium
CN113610927B (en) AVM camera parameter calibration method and device and electronic equipment
KR20130134086A (en) Video system and method using cameras with a wide angle
CN114663521A (en) All-round-view splicing processing method for assisting parking

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination