CN109544643B - Video camera image correction method and device - Google Patents
Video camera image correction method and device Download PDFInfo
- Publication number
- CN109544643B CN109544643B CN201811392635.5A CN201811392635A CN109544643B CN 109544643 B CN109544643 B CN 109544643B CN 201811392635 A CN201811392635 A CN 201811392635A CN 109544643 B CN109544643 B CN 109544643B
- Authority
- CN
- China
- Prior art keywords
- camera
- image
- coordinate system
- coordinates
- determining
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/80—Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Studio Devices (AREA)
Abstract
The embodiment of the application provides a camera image correction method and device, wherein the method comprises the following steps: determining the rotation amount and the translation amount of the camera by shooting the linear slope in the grid image obtained by the calibration plate through the camera, wherein the calibration plate is provided with grids; acquiring world coordinates of set points on the grid, and determining corresponding coordinates of the set points in a camera coordinate system according to the rotation amount and the translation amount of the camera; determining distortion parameters of the imaging of the camera based on corresponding coordinates of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relation between the camera coordinate system and an image coordinate system, a conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula; and correcting the camera image based on the distortion parameters. The embodiment of the application simplifies the correction process of the camera image.
Description
Technical Field
The application relates to the technical field of image processing, in particular to a camera image correction method and device.
Background
The wide application of image processing in the fields of intelligent video monitoring and precision machine vision puts higher demands on the calibration precision of cameras. However, the presence of geometric distortion of an image caused by an optical lens group, an image sensor, an image pickup circuit, and the like limits improvement in accuracy. Thus, solving the geometric distortion of the camera becomes a critical issue in vision applications.
At present, the camera image is corrected mainly by a camera calibration method, a parameterized camera model is generally adopted by a traditional calibration method, and all internal and external parameters of the camera are solved by the parameterized calibration method. For example, according to whether the calibration plates are coplanar, a direct linear transformation method or a perspective transformation method is used for solving most of external parameters of the camera, initial values of nonlinear optimization parameters are obtained, then the influence of radial distortion is considered, and the minimum parameter value of the objective function is obtained through optimization search.
Therefore, the current calibration method has the problems of high requirements on the position placement of the calibration plate, complex operation, complex parameterization calculation and the like.
Disclosure of Invention
In view of the above, the present application is directed to a method and an apparatus for correcting a camera image, so as to simplify the correction process of the camera image.
In a first aspect, an embodiment of the present application provides a method for correcting an image of a camera, including:
determining the rotation amount and the translation amount of the camera by shooting the linear slope in the grid image obtained by the calibration plate through the camera, wherein the calibration plate is provided with grids;
acquiring world coordinates of set points on the grid, and determining corresponding coordinates of the set points in a camera coordinate system according to the rotation amount and the translation amount of the camera;
determining distortion parameters of the imaging of the camera based on corresponding coordinates of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relation between the camera coordinate system and an image coordinate system, a conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula;
and correcting the camera image based on the distortion parameters.
With reference to the first aspect, an embodiment of the present application provides a first possible implementation manner of the first aspect, where the determining, by using a camera to capture a slope of a straight line in a grid image obtained by a calibration plate, an amount of translation of the camera includes:
acquiring image point coordinates on different straight lines in the X-axis direction and image coordinates on different straight lines in the Y-axis direction in the central area of the calibration plate grid image;
determining the slopes of the two straight lines in the X-axis direction according to the coordinates of the image points on the different straight lines in the X-axis direction, and determining the slopes of the two straight lines in the Y-axis direction according to the coordinates of the image points on the different straight lines in the Y-axis direction;
and determining horizontal translation components of the camera along the X-axis direction according to the slopes of the two straight lines in the X-axis direction, and determining vertical translation components of the camera along the Y-axis direction according to the slopes of the two straight lines in the Y-axis direction.
With reference to the first aspect, an embodiment of the present application provides a second possible implementation manner of the first aspect, where the determining, by using a camera to capture a slope of a straight line in a grid image obtained by a calibration plate, a rotation amount of the camera includes:
acquiring coordinates of image points on different straight lines in the X-axis direction in a central area of the calibration plate grid image;
determining the slopes of two straight lines in the X-axis direction according to the coordinates of the image points on different straight lines in the X-axis direction;
determining the rotation angle of the camera according to the slopes of the two straight lines in the X-axis direction;
and determining the rotation amount of the camera according to the rotation angle.
With reference to the first aspect, an embodiment of the present application provides a third possible implementation manner of the first aspect, the determining, based on a corresponding coordinate of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relationship between the camera coordinate system and an image coordinate system, a conversion relationship between the image coordinate system and a pixel coordinate system, and a camera distortion formula, a distortion parameter of imaging by the camera includes:
determining a first corresponding coordinate of the set point in an image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system;
determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system;
and determining distortion parameters of camera imaging according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and the camera distortion formula.
With reference to the third possible implementation manner of the first aspect, the embodiment of the present application provides a fourth possible implementation manner of the first aspect, the correcting the camera image based on the distortion parameter includes:
when an image to be corrected, which is shot by the camera, is obtained, obtaining image coordinates of points to be corrected in the image to be corrected;
obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula;
obtaining pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system;
and correcting the camera image based on pixel coordinates corresponding to the undistorted image.
In a second aspect, an embodiment of the present application provides a camera image correction apparatus, including:
the camera parameter determining module is used for determining the rotation amount and the translation amount of the camera according to the slope of a straight line in a grid image obtained by shooting a calibration plate through the camera, and the calibration plate is provided with grids;
the coordinate conversion module is used for acquiring world coordinates of set points on the grid, and determining corresponding coordinates of the set points in a camera coordinate system according to the rotation amount and the translation amount of the camera;
the distortion parameter determining module is used for determining distortion parameters of the imaging of the camera based on corresponding coordinates of the set point in a camera coordinate system, the focal length of the camera, the conversion relation between the camera coordinate system and an image coordinate system, the conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula;
and the image correction module is used for correcting the camera image based on the distortion parameters.
With reference to the second aspect, an embodiment of the present application provides a first possible implementation manner of the second aspect, where the camera parameter determining module is specifically configured to:
acquiring image point coordinates on different straight lines in the X-axis direction and image coordinates on different straight lines in the Y-axis direction in the central area of the calibration plate grid image;
determining the slopes of the two straight lines in the X-axis direction according to the coordinates of the image points on the different straight lines in the X-axis direction, and determining the slopes of the two straight lines in the Y-axis direction according to the coordinates of the image points on the different straight lines in the Y-axis direction;
and determining horizontal translation components of the camera along the X-axis direction according to the slopes of the two straight lines in the X-axis direction, and determining vertical translation components of the camera along the Y-axis direction according to the slopes of the two straight lines in the Y-axis direction.
With reference to the second aspect, an embodiment of the present application provides a second possible implementation manner of the second aspect, where the camera parameter determining module is specifically configured to:
acquiring coordinates of image points on different straight lines in the X-axis direction in a central area of the calibration plate grid image;
determining the slopes of two straight lines in the X-axis direction according to the coordinates of the image points on different straight lines in the X-axis direction;
determining the rotation angle of the camera according to the slopes of the two straight lines in the X-axis direction;
and determining the rotation amount of the camera according to the rotation angle.
With reference to the second aspect, an embodiment of the present application provides a third possible implementation manner of the second aspect, where the distortion parameter determining module is specifically configured to:
determining a first corresponding coordinate of the set point in an image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system;
determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system;
and determining distortion parameters of the imaging of the camera according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and a camera distortion formula.
With reference to the third possible implementation manner of the second aspect, an embodiment of the present application provides a fourth possible implementation manner of the second aspect, where the image correction module is specifically configured to:
when an image to be corrected, which is shot by the camera, is obtained, obtaining image coordinates of points to be corrected in the image to be corrected;
obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula;
obtaining pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system;
and correcting the camera image based on pixel coordinates corresponding to the undistorted image.
Compared with the prior art, the correction method of the camera image provided by the embodiment of the application has the advantages that the rotation amount and the translation amount of the camera are determined through the linear slope in the grid image obtained by the camera shooting calibration plate, and the calibration plate is provided with grids; world coordinates of the set points on the grid are obtained, and corresponding coordinates of the set points in a camera coordinate system are determined according to the rotation amount and the translation amount of the camera; determining distortion parameters of camera imaging based on corresponding coordinates of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relation between the camera coordinate system and an image coordinate system, a conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula; the camera image is corrected based on the distortion parameters.
Therefore, according to the image correction method provided by the embodiment of the application, the grid image in the calibration plate is acquired firstly, and the grid image can be preset according to a certain specification, so that the linear slope in the grid image can be conveniently obtained by utilizing the grid image, the rotation amount and the displacement amount of the camera are determined, and in addition, the points in the grid image are easier to determine, so that the distortion parameters imaged by the camera are also more convenient to determine, and the correction process of the camera image is simplified by the camera image correction method provided by the application.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a flow chart of a camera image correction method provided by an embodiment of the application;
FIG. 2 is a flow chart of a method for determining camera translation according to an embodiment of the present application;
FIG. 3 is a flow chart of a method for determining camera rotation provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a process for determining distortion parameters imaged by a camera according to an embodiment of the present application;
FIG. 5 shows a flowchart of a correction method for an image to be corrected according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a camera image correction device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of another camera image correction device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
In the embodiment of the application, a pixel coordinate system, an image coordinate system, a camera coordinate system and a world coordinate system are used, and the conversion relation between the camera coordinate system and the world coordinate system, the conversion relation between the camera coordinate system and the image coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system are used.
Pixel coordinate system: the image signal stored in the computer is a discrete digital signal in units of pixels. When sampling an image, if each row of M pixels and each column of M pixels is N pixels, the image is composed of an M×N matrix, and the value of each element in the matrix is the gray level of the pixel point. In the pixel coordinate system, the position of each pixel point is represented by (u, v).
Image coordinate system: the (u, v) in the pixel coordinate system represents only the position of the pixel point in the computer image in the two-dimensional matrix. An image coordinate system expressed in physical units can be established by the distance parameter between the horizontal direction and the vertical direction of the pixel point on the image.
Camera coordinate system: the origin of the camera coordinate system is the optical center, the x-axis and the y-axis are respectively parallel to the transverse and longitudinal axes of the image coordinate system, and the z-axis is the optical axis of the camera and is perpendicular to the image plane. The camera coordinate system may be obtained by a rotational and translational transformation of the world coordinate system.
World coordinate system: an arbitrary coordinate system is selected in the environment to represent the position of the camera, called the world coordinate system.
The following is a formulation for several coordinate system transformations:
(1) Description of the conversion relation between the world coordinate system and the camera coordinate system:
for the world coordinate system and the coordinates set at a point in the world coordinate system, the coordinate is (x w ,y w ,z w ) The point is subjected to rotation translation transformation and then has a coordinate (x) in the camera coordinate system c ,y c ,z c ). The origin of the camera coordinate system is the optical center of the camera, z c The axis coincides with the camera optical axis. The origin of the image coordinate system is the intersection of the camera optical axis and the image plane, and the coordinate plane is parallel to the camera coordinate system plane.
(2) Motion conversion relation between camera coordinate system and world coordinate system:
wherein, R in formula (1) is the rotation amount of the camera, which is a 3×3 matrix of rows and columns, specifically:
the orthogonal projection amounts of each component of the new coordinates after rotation on the X axis, the Y axis and the Z axis in the original coordinate system are shown.
T in formula (1) is the amount of translation of the camera, specifically:
T x ,T y ,T z the amounts of translation along the X, Y and Z axes are shown, respectively.
(3) For the conversion relation between the camera coordinate system and the image coordinate system, O' X is defined u Y u The plane is the imaging plane in the image coordinate system, the spatial point in the camera coordinate system is proportional to the perspective correspondence between the imaging planes, and the coordinates of the spatial point on the imaging plane are set as (X) u ,Y u ) The following steps are:
where f is the lens focal length of the camera.
(4) For the image coordinate system and pixel coordinate system conversion description, as shown in the following formula (3):
in the above formula: n (N) x 、N y The number of pixels per unit length in the horizontal and vertical directions on the image plane is shown by the camera manufacturer. It is generally considered that the image sensor is single in the horizontal and vertical directionsThe number of bit length pixels is equal. (u) 0 ,v 0 ) Is the center of the pixel coordinate system and is generally considered to be the pixel coordinate corresponding to the projection point of the origin of the image coordinate system in the pixel coordinate system. (X) d ,Y d ) Is the actual image coordinate in the pixel coordinate system.
Mathematical models of camera imaging distortion, including radial distortion, tangential distortion, and thin lens distortion, are typically small compared to radial distortion and tangential distortion, and therefore, the distortion model in embodiments of the present application does not take into account thin prism distortion.
Radial distortion formula:
tangential distortion formula:
where (x ', y') is the image coordinates of the distortion point, (x, y) is the image coordinates of the corresponding non-distortion point, r is the distance of the image point to the distortion center, r 2 =x 2 +y 2 。
Example 1
The embodiment 1 of the application provides a camera image correction method, as shown in fig. 1, comprising the following steps of S100-S103:
s100, determining the rotation and translation of the camera through the slope of a straight line in a grid image obtained by shooting a calibration plate by the camera, wherein the calibration plate is provided with grids.
The traditional calibration process considers that the camera and the calibration plate are coaxial and coplanar and meet the requirement, so that in actual operation, an image skew error caused by the relative positions of the camera and the calibration plate can be superimposed into distortion caused by tangential distortion, and the tangential distortion coefficient is calculated later to bring adverse effect, so that the final calibration precision is influenced.
The calibration plate image in the embodiment of the application adopts white background and black equidistant grid lines. The calibration plate is a two-dimensional plane, the z-direction thickness is 0, and the image of the central area is basically undistorted. Let y=kx+b be the linear equation, k be the slope, and b be the y-axis intercept. The camera translation is represented by the difference in the slope of two horizontal or vertical parallel lines on the image, and the camera rotation is represented by the slope of a horizontal line on the image being different from 0. The amount of translation and rotation in the x, y directions of the image can be determined by calculating the slope change in the x, y directions of the horizontal parallel lines and the vertical parallel lines.
Optionally, in step S100, the translation amount of the camera is determined by capturing the slope of the straight line in the grid image obtained by the calibration board by the camera, as shown in fig. 2, and the method includes the following specific steps S200 to S202:
s200, acquiring coordinates of image points on different straight lines in the X-axis direction and coordinates of images on different straight lines in the Y-axis direction in the central area of the calibration plate grid image.
The center of the calibration plate grid image is not greatly distorted, and the image center region image can be assumed to meet the imaging constraint condition, wherein a plurality of points of the center region of the calibration plate grid image are selected.
S201, determining the slopes of two straight lines in the X-axis direction according to the coordinates of image points on different straight lines in the X-axis direction, and determining the slopes of two straight lines in the Y-axis direction according to the coordinates of images on different straight lines in the Y-axis direction.
By the formula y=kx+b, the slopes K of two straight lines in the X-axis direction can be determined respectively by the coordinates of the image points on different straight lines in the X-axis direction and the coordinates of the image points on different straight lines in the Y-axis direction x1 And K x2 Determining the slope K of two straight lines in the Y-axis direction y1 And K y2 。
S202, determining horizontal translation components of the camera along the X-axis direction according to the slopes of the two straight lines in the X-axis direction, and determining vertical translation components of the camera along the Y-axis direction according to the slopes of the two straight lines in the Y-axis direction.
According to a translation matrix parameter formula: t (T) x =(K x1 -K x2 ) 2 and T y =(K y1 -K y2 )/2,The horizontal translational component of the camera in the X-axis direction and the vertical translational component in the Y-axis direction are determined, respectively.
Because z=0, then T z =0, so the translation of the camera
Optionally, in step S100, the rotation amount of the camera is determined by capturing the slope of the straight line in the grid image obtained by the calibration plate by the camera, as shown in fig. 3, and the method includes the following specific steps S300 to S303:
s300, acquiring coordinates of image points on different straight lines in the X-axis direction in the central area of the calibration plate grid image.
S301, determining the slopes of two straight lines in the X-axis direction according to the coordinates of image points on different straight lines in the X-axis direction.
Similarly, by the formula y=kx+b, the coordinates of the image points on different straight lines in the X-axis direction can be determined respectively as the slopes K of the two straight lines in the X-axis direction x1 And K x2 。
S302, determining the rotation angle of the camera according to the slopes of the two straight lines in the X-axis direction.
Let K x =(K x1 +K x2 ) From the trigonometric function relation, the rotation angle θ=tan can be calculated -1 Kx。
S303, determining the rotation amount of the camera according to the rotation angle.
Because z=0, and the rotation matrix R in equation (1) is an orthogonal matrix, the rotation matrix can be calculated from the coordinate system rotation orthogonal projection relationship as:
s101, world coordinates of the set points on the grid are obtained, and corresponding coordinates of the set points in a camera coordinate system are determined according to the rotation amount and the translation amount of the camera.
The world coordinates of the set points on the grid are then determined according to equation (1) and aboveThe amount of translation and rotation of the camera is fixed, i.e. the setpoint (x w ,y w ,z w ) Corresponding coordinates (x c ,y c ,z c )。
S102, determining distortion parameters of camera imaging based on corresponding coordinates of the set point in a camera coordinate system, lens focal length of the camera, conversion relation between the camera coordinate system and an image coordinate system, conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula.
Optionally, in step S102, based on the corresponding coordinates of the set point in the camera coordinate system, the focal length of the lens of the camera, the conversion relationship between the camera coordinate system and the image coordinate system, the conversion relationship between the image coordinate system and the pixel coordinate system, and the camera distortion formula, the distortion parameters of the imaging of the camera are determined, as shown in fig. 4, and specifically include the following steps S400 to S402:
s400, determining a first corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system.
According to formula (2)A setpoint (x w ,y w ,z w ) A first corresponding coordinate (X u ,Y u )。
S401, determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system.
Determining the corresponding coordinates (u, v) of the set point in the pixel coordinate system, and equation (3), the set point (x) can be determined inversely w ,y w ,z w ) A second corresponding coordinate (X in the image coordinate system d ,Y d )
S402, determining distortion parameters of camera imaging according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and a camera distortion formula.
Solving the equation consisting of the equation (2), the equation (4) and the equation (5) can obtain the following camera distortion equation:
where r is the distance from the image point to the center of distortion, r 2 =x 2 +y 2 。
Then, the process is carried out,known as X d ,Y d Instead of x and y, the distortion parameter k can be determined by at least four sets of setpoints 1 ,k 2 ,p 1 ,p 2 。
And S103, correcting the camera image based on the distortion parameters.
Optionally, in step S103, the camera image is corrected based on the distortion parameter, as shown in fig. 5, including the following specific steps S500 to S503:
s500, when the image to be corrected, which is shot by the camera, is obtained, the image coordinates of the point to be corrected in the image to be corrected are obtained.
S501, obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula.
S502, obtaining pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system.
And S503, correcting the camera image based on pixel coordinates corresponding to the undistorted image.
When a new image to be corrected is shot, the image coordinates of the point to be corrected in the image to be corrected can be obtained, and then the undistorted image coordinates are reversely calculated through the formula (6). And then obtaining the pixel coordinates corresponding to the undistorted image through the conversion relation between the image coordinate system and the pixel coordinate system. Image pixels typically require interpolation processing, and embodiments of the present application may employ linear interpolation.
Example 2
An embodiment of the present application provides a camera image correction apparatus 600, as shown in fig. 6, including:
the camera parameter determining module 601 is configured to determine a rotation amount and a translation amount of the camera by using a slope of a straight line in a grid image obtained by shooting a calibration board by the camera, where the calibration board is provided with grids;
the coordinate conversion module 602 is configured to obtain world coordinates of a set point on the grid, and determine a corresponding coordinate of the set point in a camera coordinate system according to the rotation amount and the translation amount of the camera;
a distortion parameter determining module 603, configured to determine a distortion parameter of the camera imaging based on a corresponding coordinate of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relationship between the camera coordinate system and an image coordinate system, a conversion relationship between the image coordinate system and a pixel coordinate system, and a camera distortion formula;
an image correction module 604 is configured to correct the camera image based on the distortion parameter.
Optionally, the camera parameter determining module 601 is specifically configured to:
acquiring image point coordinates on different straight lines in the X-axis direction and image coordinates on different straight lines in the Y-axis direction in the central area of the calibration plate grid image;
determining the slopes of the two straight lines in the X-axis direction according to the coordinates of the image points on the different straight lines in the X-axis direction, and determining the slopes of the two straight lines in the Y-axis direction according to the coordinates of the image points on the different straight lines in the Y-axis direction;
and determining horizontal translation components of the camera along the X-axis direction according to the slopes of the two straight lines in the X-axis direction, and determining vertical translation components of the camera along the Y-axis direction according to the slopes of the two straight lines in the Y-axis direction.
Optionally, the camera parameter determining module 601 is specifically configured to:
acquiring coordinates of image points on different straight lines in the X-axis direction in a central area of the calibration plate grid image;
determining the slopes of two straight lines in the X-axis direction according to the coordinates of the image points on different straight lines in the X-axis direction;
determining the rotation angle of the camera according to the slopes of the two straight lines in the X-axis direction;
and determining the rotation amount of the camera according to the rotation angle.
Optionally, the distortion parameter determining module 603 is specifically configured to:
determining a first corresponding coordinate of the set point in an image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system;
determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system;
and determining distortion parameters of the imaging of the camera according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and a camera distortion formula.
Optionally, the image correction module 604 is specifically configured to:
when an image to be corrected, which is shot by the camera, is obtained, obtaining image coordinates of points to be corrected in the image to be corrected;
obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula;
obtaining pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system;
and correcting the camera image based on pixel coordinates corresponding to the undistorted image.
Example 3
Embodiment 3 of the present application further provides a camera image correction apparatus 700, as shown in fig. 7, the camera image correction apparatus 700 includes: a processor 701, a memory 702, and a bus 703, the memory 702 storing execution instructions, the processor 701 and the memory 702 communicating through the bus 703 when the device is running, the processor 701 executing the following execution instructions stored in the memory 702:
the rotation and translation of the camera are determined by the slope of a straight line in the grid image obtained by shooting the calibration plate through the camera, and the calibration plate is provided with grids.
World coordinates of the set points on the grid are obtained, and corresponding coordinates of the set points in a camera coordinate system are determined according to the rotation amount and the translation amount of the camera.
And determining distortion parameters of camera imaging based on corresponding coordinates of the set point in a camera coordinate system, lens focal length of the camera, conversion relation between the camera coordinate system and an image coordinate system, conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula.
The camera image is corrected based on the distortion parameters.
Optionally, the execution instructions executed by the processor 701 specifically include:
and acquiring image point coordinates on different straight lines in the X-axis direction and image coordinates on different straight lines in the Y-axis direction in the central area of the calibration plate grid image.
The slopes of the two straight lines in the X-axis direction are determined according to the coordinates of the image points on the different straight lines in the X-axis direction, and the slopes of the two straight lines in the Y-axis direction are determined according to the coordinates of the image points on the different straight lines in the Y-axis direction.
The horizontal translation component of the camera along the X-axis direction is determined according to the slopes of the two straight lines in the X-axis direction, and the vertical translation component of the camera along the Y-axis direction is determined according to the slopes of the two straight lines in the Y-axis direction.
Optionally, the execution instructions executed by the processor 701 specifically include:
and acquiring coordinates of image points on different straight lines in the X-axis direction in the central area of the calibration plate grid image.
And determining the slopes of the two straight lines in the X-axis direction according to the coordinates of the image points on the different straight lines in the X-axis direction.
And determining the rotation angle of the camera according to the slopes of the two straight lines in the X-axis direction.
The rotation amount of the camera is determined according to the rotation angle.
Optionally, the execution instructions executed by the processor 701 specifically include:
and determining a first corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system.
And determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system.
And determining distortion parameters of camera imaging according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and the camera distortion formula.
Optionally, the execution instructions executed by the processor 701 specifically include:
when an image to be corrected, which is shot by a camera, is acquired, image coordinates of points to be corrected in the image to be corrected are acquired.
And obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula.
And obtaining the pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system.
And correcting the camera image based on the pixel coordinates corresponding to the undistorted image.
Corresponding to the camera image correction method of fig. 1 to 5, an embodiment of the present application further provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor performs the steps of the camera image correction method described above.
Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and the like, and when a computer program on the storage medium is run, the camera image correction method can be executed, so that the problems of high positioning requirements on a calibration plate, complex operation, complex parameterization calculation, and the like in the calibration method in the prior art are solved.
Compared with the prior art, the correction method of the camera image provided by the embodiment of the application has the advantages that the rotation amount and the translation amount of the camera are determined through the linear slope in the grid image obtained by the camera shooting calibration plate, and the calibration plate is provided with grids; world coordinates of the set points on the grid are obtained, and corresponding coordinates of the set points in a camera coordinate system are determined according to the rotation amount and the translation amount of the camera; determining distortion parameters of camera imaging based on corresponding coordinates of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relation between the camera coordinate system and an image coordinate system, a conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula; the camera image is corrected based on the distortion parameters.
Therefore, according to the image correction method provided by the embodiment of the application, the grid image in the calibration plate is acquired firstly, and the grid image can be preset according to a certain specification, so that the linear slope in the grid image can be conveniently obtained by utilizing the grid image, the rotation amount and the displacement amount of the camera are determined, and in addition, the points in the grid image are easier to determine, so that the distortion parameters imaged by the camera are also more convenient to determine, and the correction process of the camera image is simplified by the camera image correction method provided by the application.
The computer program product for performing the camera image correction method according to the embodiment of the present application includes a computer readable storage medium storing program codes, where the instructions included in the program codes may be used to perform the method described in the foregoing method embodiment, and specific implementation may refer to the method embodiment and will not be described herein.
The camera image correction device provided by the embodiment of the application can be specific hardware on equipment or software or firmware installed on the equipment. The device provided by the embodiment of the present application has the same implementation principle and technical effects as those of the foregoing method embodiment, and for the sake of brevity, reference may be made to the corresponding content in the foregoing method embodiment where the device embodiment is not mentioned. It will be clear to those skilled in the art that, for convenience and brevity, the specific operation of the system, apparatus and unit described above may refer to the corresponding process in the above method embodiment, which is not described in detail herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments provided in the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: like reference numerals and letters in the following figures denote like items, and thus once an item is defined in one figure, no further definition or explanation of it is required in the following figures, and furthermore, the terms "first," "second," "third," etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present application, and are not intended to limit the scope of the present application, but it should be understood by those skilled in the art that the present application is not limited thereto, and that the present application is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the corresponding technical solutions. Are intended to be encompassed within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (6)
1. A camera image correction method, comprising:
determining the rotation amount and the translation amount of the camera by shooting the linear slope in the grid image obtained by the calibration plate through the camera, wherein the calibration plate is provided with grids; wherein the amount of translation and the amount of rotation of the camera is determined by:
acquiring image point coordinates on different straight lines in the X-axis direction and image coordinates on different straight lines in the Y-axis direction in the central area of the calibration plate grid image;
according to the formula y=kx+b, the slopes K of the two straight lines in the X-axis direction are respectively determined according to the coordinates of the image points on the different straight lines in the X-axis direction and the coordinates of the image points on the different straight lines in the Y-axis direction x1 And K x2 Determining the slope K of two straight lines in the Y-axis direction y1 And K y2 The method comprises the steps of carrying out a first treatment on the surface of the Wherein k is the slope and b is the y-axis intercept;
according to a translation matrix parameter formula T x =(K x1 -K x2 ) 2 and T y =(K y1 -K y2 ) And 2, respectively determining the horizontal translation component of the camera along the X-axis direction and the vertical translation component along the Y-axis direction to obtain the translation amount of the cameraWherein T is z =0;
The rotation angle θ=tan can be calculated from the trigonometric function relation -1 Kx, where K x =(K x1 +K x2 ) 2, and calculating the rotation amount of the camera according to the coordinate system rotation orthogonal projection relation by using the rotation angle
Acquiring world coordinates of set points on the grid, and determining corresponding coordinates of the set points in a camera coordinate system according to the rotation amount and the translation amount of the camera;
determining distortion parameters of the imaging of the camera based on corresponding coordinates of the set point in a camera coordinate system, a lens focal length of the camera, a conversion relation between the camera coordinate system and an image coordinate system, a conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula;
and correcting the camera image based on the distortion parameters.
2. The method of claim 1, wherein the determining distortion parameters of the camera imaging based on corresponding coordinates of the setpoint in a camera coordinate system, a lens focal length of the camera, a camera coordinate system to image coordinate system conversion relationship, an image coordinate system to pixel coordinate system conversion relationship, and a camera distortion formula comprises:
determining a first corresponding coordinate of the set point in an image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system;
determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system;
and determining distortion parameters of the imaging of the camera according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and a camera distortion formula.
3. The method of claim 2, wherein the correcting the camera image based on the distortion parameters comprises:
when an image to be corrected, which is shot by the camera, is obtained, obtaining image coordinates of points to be corrected in the image to be corrected;
obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula;
obtaining pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system;
and correcting the camera image based on pixel coordinates corresponding to the undistorted image.
4. A camera image correction apparatus, comprising:
the camera parameter determining module is used for determining the rotation amount and the translation amount of the camera according to the slope of a straight line in a grid image obtained by shooting a calibration plate through the camera, and the calibration plate is provided with grids; wherein the amount of translation and the amount of rotation of the camera is determined by:
acquiring image point coordinates on different straight lines in the X-axis direction and image coordinates on different straight lines in the Y-axis direction in the central area of the calibration plate grid image;
according to the formula y=kx+b, the slopes K of the two straight lines in the X-axis direction are respectively determined according to the coordinates of the image points on the different straight lines in the X-axis direction and the coordinates of the image points on the different straight lines in the Y-axis direction x1 And K x2 Determining the slope K of two straight lines in the Y-axis direction y1 And K y2 The method comprises the steps of carrying out a first treatment on the surface of the Wherein k is the slope and b is the y-axis intercept;
according to a translation matrix parameter formula T x =(K x1 -K x2 ) 2 and T y =(K y1 -K y2 ) And 2, respectively determining the horizontal translation component of the camera along the X-axis direction and the vertical translation component along the Y-axis direction to obtain the translation amount of the cameraWherein T is z =0;
The rotation angle θ=tan can be calculated from the trigonometric function relation -1 Kx, where K x =(K x1 +K x2 ) 2, and calculating the rotation amount of the camera according to the coordinate system rotation orthogonal projection relation by using the rotation angle
The coordinate conversion module is used for acquiring world coordinates of set points on the grid, and determining corresponding coordinates of the set points in a camera coordinate system according to the rotation amount and the translation amount of the camera;
the distortion parameter determining module is used for determining distortion parameters of the imaging of the camera based on corresponding coordinates of the set point in a camera coordinate system, the focal length of the camera, the conversion relation between the camera coordinate system and an image coordinate system, the conversion relation between the image coordinate system and a pixel coordinate system and a camera distortion formula;
and the image correction module is used for correcting the camera image based on the distortion parameters.
5. The apparatus of claim 4, wherein the distortion parameter determination module is specifically configured to:
determining a first corresponding coordinate of the set point in an image coordinate system according to the corresponding coordinate of the set point in the camera coordinate system, the lens focal length of the camera and the conversion relation between the camera coordinate system and the image coordinate system;
determining a second corresponding coordinate of the set point in the image coordinate system according to the corresponding coordinate of the set point in the pixel coordinate system and the conversion relation between the image coordinate system and the pixel coordinate system;
and determining distortion parameters of the imaging of the camera according to the first corresponding coordinates, the second corresponding coordinates, the conversion relation between the camera coordinate system and the image coordinate system and a camera distortion formula.
6. The apparatus of claim 5, wherein the image correction module is specifically configured to:
when an image to be corrected, which is shot by the camera, is obtained, obtaining image coordinates of points to be corrected in the image to be corrected;
obtaining undistorted image coordinates corresponding to the image coordinates of the point to be corrected according to the image coordinates of the point to be corrected, the distortion parameters imaged by the camera and the camera distortion formula;
obtaining pixel coordinates corresponding to the undistorted image according to the undistorted image coordinates and the conversion relation between the image coordinate system and the pixel coordinate system;
and correcting the camera image based on pixel coordinates corresponding to the undistorted image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811392635.5A CN109544643B (en) | 2018-11-21 | 2018-11-21 | Video camera image correction method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811392635.5A CN109544643B (en) | 2018-11-21 | 2018-11-21 | Video camera image correction method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109544643A CN109544643A (en) | 2019-03-29 |
CN109544643B true CN109544643B (en) | 2023-08-11 |
Family
ID=65848739
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811392635.5A Active CN109544643B (en) | 2018-11-21 | 2018-11-21 | Video camera image correction method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109544643B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110503691B (en) * | 2019-07-01 | 2024-02-20 | 广州超音速自动化科技股份有限公司 | Pole piece lamination calibration method of lithium battery, terminal equipment and storage device |
CN111178317A (en) * | 2020-01-06 | 2020-05-19 | 广东博智林机器人有限公司 | Detection positioning method, system, device, electronic equipment and storage medium |
CN111783597B (en) * | 2020-06-24 | 2022-12-13 | 中国第一汽车股份有限公司 | Method and device for calibrating driving trajectory, computer equipment and storage medium |
CN112614075B (en) * | 2020-12-29 | 2024-03-08 | 凌云光技术股份有限公司 | Distortion correction method and equipment for surface structured light 3D system |
CN113160333B (en) * | 2021-04-28 | 2023-03-07 | 天津大学 | Parameter optimization camera calibration method |
CN115694720A (en) * | 2021-07-29 | 2023-02-03 | 华为技术有限公司 | Data transmission method and related device |
CN113916128A (en) * | 2021-10-11 | 2022-01-11 | 齐鲁工业大学 | Method for improving precision based on optical pen type vision measurement system |
CN114466173A (en) * | 2021-11-16 | 2022-05-10 | 海信视像科技股份有限公司 | Projection equipment and projection display control method for automatically throwing screen area |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6618494B1 (en) * | 1998-11-27 | 2003-09-09 | Wuestec Medical, Inc. | Optical distortion correction in digital imaging |
CN101021947A (en) * | 2006-09-22 | 2007-08-22 | 东南大学 | Double-camera calibrating method in three-dimensional scanning system |
CN102156970A (en) * | 2011-04-14 | 2011-08-17 | 复旦大学 | Fisheye image correction method based on distorted straight slope calculation |
CN104574419A (en) * | 2015-01-28 | 2015-04-29 | 深圳市安健科技有限公司 | Lens distortion parameter calibration method and system |
CN104820973A (en) * | 2015-05-07 | 2015-08-05 | 河海大学 | Image correction method for distortion curve radian detection template |
-
2018
- 2018-11-21 CN CN201811392635.5A patent/CN109544643B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6618494B1 (en) * | 1998-11-27 | 2003-09-09 | Wuestec Medical, Inc. | Optical distortion correction in digital imaging |
CN101021947A (en) * | 2006-09-22 | 2007-08-22 | 东南大学 | Double-camera calibrating method in three-dimensional scanning system |
CN102156970A (en) * | 2011-04-14 | 2011-08-17 | 复旦大学 | Fisheye image correction method based on distorted straight slope calculation |
CN104574419A (en) * | 2015-01-28 | 2015-04-29 | 深圳市安健科技有限公司 | Lens distortion parameter calibration method and system |
CN104820973A (en) * | 2015-05-07 | 2015-08-05 | 河海大学 | Image correction method for distortion curve radian detection template |
Also Published As
Publication number | Publication date |
---|---|
CN109544643A (en) | 2019-03-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109544643B (en) | Video camera image correction method and device | |
CN107633536B (en) | Camera calibration method and system based on two-dimensional plane template | |
CN111263142B (en) | Method, device, equipment and medium for testing optical anti-shake of camera module | |
CN111127422A (en) | Image annotation method, device, system and host | |
CN112070845A (en) | Calibration method and device of binocular camera and terminal equipment | |
WO2019232793A1 (en) | Two-camera calibration method, electronic device and computer-readable storage medium | |
CN107993266A (en) | Light-field camera intrinsic parameter caliberating device and method | |
CN110738707A (en) | Distortion correction method, device, equipment and storage medium for cameras | |
CN114841862B (en) | Image splicing method and system based on hundred million pixel array type camera | |
CN110345875B (en) | Calibration and ranging method, device, electronic equipment and computer readable storage medium | |
CN106570907B (en) | Camera calibration method and device | |
CN111445537B (en) | Calibration method and system of camera | |
CN116433737A (en) | Method and device for registering laser radar point cloud and image and intelligent terminal | |
CN117173254A (en) | Camera calibration method, system, device and electronic equipment | |
CN112365421A (en) | Image correction processing method and device | |
CN115965697A (en) | Projector calibration method, calibration system and device based on Samm's law | |
CN107256563B (en) | Underwater three-dimensional reconstruction system and method based on difference liquid level image sequence | |
CN111353945B (en) | Fisheye image correction method, device and storage medium | |
CN115100225B (en) | Method and device for determining error field of camera view field, electronic equipment and medium | |
CN116051634A (en) | Visual positioning method, terminal and storage medium | |
CN112894154B (en) | Laser marking method and device | |
CN115631099A (en) | Radial distortion parameter measuring method and device and electronic equipment | |
CN115661258A (en) | Calibration method and device, distortion correction method and device, storage medium and terminal | |
CN117994359B (en) | Linear array camera calibration method and related device based on auxiliary camera | |
CN112446928B (en) | External parameter determining system and method for shooting device |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |