Image perspective correction method and device based on camera perspective transformation
Through the image perspective correction method of camera viewpoint transformation, camera calibration and perspective mapping matrix are used to solve the perspective distortion problem in industrial camera imaging, and achieve high-precision and high-speed positioning and detection of solar cells.
Patent Information
- Application Number
- CN202210850793.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-07-20
AI Technical Summary
Existing perspective correction methods have perspective distortion when industrial cameras are used for imaging, resulting in inaccurate solar cell outlines, affecting positioning and detection accuracy, and are computationally intensive and slow.
Through camera calibration, external parameters, internal parameters and distortion parameters are obtained, a perspective mapping matrix is constructed, and image correction is performed using camera perspective transformation, including distortion correction and perspective correction.
It achieves high-precision and high-speed image perspective correction, reduces the amount of calculation, and improves the accuracy and speed of solar cell positioning and detection.
Smart Images

Figure CN115115550B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an image perspective correction method and device based on camera view angle transformation, belonging to the field of digital image technology. Background Art
[0002] When the optical axis of an industrial camera is not strictly perpendicular to the platform on which the solar cell is placed, the solar cell in the image will be deformed, with the image appearing larger near and smaller far away due to the perspective projection model of the imaging. This perspective distortion causes the cell outlines or grid lines in the image to be non-parallel to each other, resulting in inaccurate positioning of the cell using the outlines or grid lines. This affects the accuracy of laser scribing and may also cause the detection probe to sometimes fail to contact the cell electrodes, making electrical performance testing impossible. In addition, hand-eye calibration is often required before the robot moves the cell. This is usually a two-dimensional nine-point calibration between the image coordinate system and the robot coordinate system. Perspective deformation can affect the accuracy of the hand-eye calibration results, thereby increasing the positional error of the robot moving the cell. Industrial cameras are often fixedly installed on certain workstations in photovoltaic module production equipment, and it is almost impossible to ensure that their optical axes are strictly perpendicular to the product plane during installation.
[0003] Currently, commonly used perspective correction methods include angle detection and control point transformation. The angle detection method typically first uses Hough or Radon transforms to detect the tilt angle of the solar cell in the image and then performs rotation correction based on the angle. This method only performs affine transformations, ignoring image perspective distortion and has certain limitations. The control point transformation method typically first performs Hough line detection on the cell outline or busbars and extracts corner points. A linear relationship is established between four or more control points and their corresponding standard points, and a homography matrix is calculated. The distorted original image is then perspective transformed. However, this method requires precise control point coordinates and is difficult to restore the image coordinates of the standard points, resulting in poor correction results and a high computational complexity. Summary of the Invention
[0004] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a method and device for image perspective correction based on camera perspective transformation, which can accurately and quickly realize image perspective correction of solar cells, thereby meeting the positioning and detection needs in the production process.
[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions:
[0006] In a first aspect, the present invention provides an image perspective correction method based on camera perspective transformation, comprising:
[0007] Calibrate the camera to obtain camera extrinsic parameters, camera intrinsic parameters and distortion parameters;
[0008] Acquire images through the calibrated camera and perform distortion correction based on the distortion parameters;
[0009] Construct a perspective mapping matrix based on camera extrinsic parameters and camera intrinsic parameters;
[0010] The distortion-corrected image is perspective corrected using the transmission mapping matrix.
[0011] Optionally, calibrating the camera includes:
[0012] Using a camera to capture at least three images of a checkerboard calibration plate at different positions at a preset position, and each of the checkerboard calibration plates is superimposed to cover the entire field of view of the camera;
[0013] Extract sub-pixel corner points and corresponding image coordinates of each image;
[0014] Initialize the world coordinates of the sub-pixel corner points, and calculate the camera extrinsic parameters, camera intrinsic parameters, and distortion parameters based on the Zhang Zhengyou calibration algorithm according to the correspondence between the world coordinates and image coordinates of the sub-pixel corner points.
[0015] Optionally, the distortion correction based on the distortion parameter is:
[0016]
[0017] Where (u, v) and (u′, v′) are the coordinates of the image points before and after distortion correction, respectively; [k1, k2, k3] and [p1, p2] are the radial and tangential distortion parameters in the distortion parameters, respectively; k1, k2, k3 are the elements in the radial distortion parameters, and p1 and p2 are the elements in the tangential distortion parameters;
[0018] Optionally, constructing a perspective mapping matrix based on camera extrinsic parameters and camera intrinsic parameters includes:
[0019] Solve the object distance of the spatial point relative to the camera based on the camera extrinsic parameters and camera intrinsic parameters, and obtain the Z-axis projection value of the spatial point relative to the camera coordinate system;
[0020] Construct the transformation relationship from the image coordinate system to the camera coordinate system and from the camera coordinate system to the image coordinate system based on the Z-axis projection value and the camera intrinsic parameters;
[0021] Obtain the axis rotation angle when converting the world coordinate system to the camera coordinate system based on the camera external parameters;
[0022] Construct the camera perspective transformation relationship from the camera coordinate system to the target camera coordinate system based on the axis rotation angle and the camera external parameters;
[0023] The perspective mapping matrix is constructed according to the transformation relationship from the image coordinate system to the camera coordinate system, the transformation relationship from the camera coordinate system to the camera perspective of the target camera coordinate system, and the transformation relationship from the camera coordinate system to the image coordinate system.
[0024] Optionally, obtaining a Z-axis projection value of a spatial point relative to a camera coordinate system includes:
[0025] Obtain the transformation relationship from the world coordinate system to the camera coordinate system based on the camera external parameters:
[0026]
[0027] Where, is the rotation matrix R of the camera extrinsic parameter, r 11 、r 12 、r 13 、r 21 、r 22 、r 23 、r 31 、r 32 、r 33 is the element in the rotation matrix R of the camera external parameter; [t1, t2, t3] is the translation vector T of the camera external parameter, t1, t2, t3 are the elements in the translation vector T of the camera internal parameter; (X w ,Y w ,Z w )、(X c ,Y c ,Z c ) is the coordinate point of the space point in the world coordinate system and the camera coordinate system;
[0028] Obtain the transformation relationship from the camera coordinate system to the image coordinate system based on the camera intrinsic parameters:
[0029]
[0030] Where (u, v) is the coordinate point of the space point in the image coordinate system; [f x ,f y ,u0,v0] is the camera internal parameter, f x 、f y , u0, v0 are elements in the camera intrinsic parameters;
[0031] Let Z w =0, we can get:
[0032]
[0033] Eliminate X c 、Y c 、X w 、Y w Get the Z-axis projection value:
[0034]
[0035] Optionally, the transformation relationship from the image coordinate system to the camera coordinate system is:
[0036]
[0037] The transformation relationship from the camera coordinate system to the image coordinate system is:
[0038]
[0039] In the formula, [f x ,f y ,u0,v0] is the camera internal parameter, Z c is the Z-axis projection value of the space point relative to the camera coordinate system, (X c ,Y c ,Z c ), (u,v) are the coordinate points in the camera coordinate system and the image coordinate system respectively.
[0040] Optionally, obtaining the axis rotation angle when converting the world coordinate system to the camera coordinate system according to the camera external parameters includes:
[0041] Let R x 、R y 、R z These are the rotation components of the X, Y, and Z axes by angles α, β, and θ when the world coordinate system is converted to the camera coordinate system:
[0042]
[0043] Then the rotation matrix of the camera extrinsic parameter is It can be expressed as:
[0044] R=R x R y R z
[0045] but:
[0046]
[0047] By the corresponding equality method we can get:
[0048]
[0049] Solving the above equation yields the axis rotation angle:
[0050]
[0051] Optionally, the transformation relationship of the camera perspective from the camera coordinate system to the target camera coordinate system constructed according to the axis rotation angle and the camera extrinsic parameters includes:
[0052] Get the transformation relationship from the original view to the vertical view in the camera coordinate system based on the axis rotation angle:
[0053]
[0054] Where α and β are the axis rotation angles, (X c ,Y c ,Z c ),(X′ c ,Y′ c ,Z′ c ) are the coordinates of the midpoint of the original viewing angle and the vertical viewing angle in the camera coordinate system respectively;
[0055] The transformation relationship from the camera coordinate system to the target camera coordinate system is derived based on the axis rotation angle and the translation vector in the camera external parameters:
[0056]
[0057] Where t3 is the parameter of the translation vector T = [t1, t2, t3] in the camera extrinsic parameters; Z3 is the distance between the camera optical center and the plane of the photographed object along the optical axis in the camera coordinate system;
[0058] The transformation relationship of the camera perspective is obtained based on the transformation relationship from the original perspective to the vertical perspective in the camera coordinate system and the transformation relationship from the camera coordinate system to the target camera coordinate system:
[0059]
[0060] Written in homogeneous form:
[0061]
[0062] Where, (X″ c ,Y″ c ,Z″ c ) is the coordinate of the midpoint of the target camera coordinate system after the camera perspective is transformed.
[0063] Optionally, the perspective mapping matrix is:
[0064]
[0065] In the formula, [f x ,f y ,u0,v0] is the camera internal parameter, Z cis the Z-axis projection value of the spatial point relative to the camera coordinate system, Z3 is the distance between the optical center of the camera and the plane of the photographed object along the optical axis in the camera coordinate system, α and β are the axis rotation angles, and [T1, T2, T3] is the transformation relationship from the camera coordinate system to the target camera coordinate system.
[0066] In a second aspect, the present invention provides an image perspective correction device based on camera perspective transformation, characterized in that it includes a processor and a storage medium;
[0067] The storage medium is used to store instructions;
[0068] The processor is configured to operate according to the instructions to execute the steps of the above method.
[0069] Compared with the prior art, the present invention has the following beneficial effects:
[0070] The present invention provides a method and device for image perspective correction based on camera perspective transformation. By deriving the perspective mapping relationship between an image viewed from the original camera's perspective and an image viewed from a camera with its optical axis perpendicular to the object plane, the method uses camera perspective transformation to achieve image perspective correction. By analyzing and calculating from the perspective of camera lens imaging, the present invention can achieve more accurate perspective correction, reduce computational complexity, and increase correction speed. This method can be effectively applied to the positioning and inspection of solar cells in photovoltaic module production equipment, meeting the high-precision and high-speed requirements for solar cell image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 This is a flowchart of an image perspective correction method based on camera perspective transformation provided by the first embodiment of the present invention;
[0072] Figure 2 This is a flowchart of constructing a perspective mapping matrix based on camera extrinsic parameters and camera intrinsic parameters provided in the first embodiment of the present invention;
[0073] Figure 3 Schematic diagram of the transformation of the camera perspective from the camera coordinate system to the target camera coordinate system provided in the first embodiment of the present invention;
[0074] Figure 4 is an image of a solar cell taken by the camera provided in the first embodiment of the present invention;
[0075] Figure 5 This is an image of a solar cell after perspective correction according to the method provided in Example 1 of the present invention;
[0076] Figure 6 The solar cell image after perspective correction using the traditional method provided in the first embodiment of the present invention;
[0077] Figure 7 3 is a comparison diagram of angle tests between the conventional method provided in Example 1 of the present invention and the method of this embodiment;
[0078] Figure 8 This is a comparison chart of the correction running time between the traditional method provided in Example 1 of the present invention and the method of this embodiment. DETAILED DESCRIPTION
[0079] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention.
[0080] Example 1:
[0081] like Figure 1 As shown, an embodiment of the present invention provides an image perspective correction method based on camera perspective transformation, comprising the following steps:
[0082] 1. Calibrate the camera to obtain camera extrinsic parameters, camera intrinsic parameters and distortion parameters;
[0083] The camera is calibrated using the currently more mature calibration technology "Zhang Zhengyou Calibration Method". Its main process includes:
[0084] 1.1. Use the camera to capture at least three images of the checkerboard calibration plate at different positions at the preset position, and each checkerboard calibration plate should cover the entire field of view of the camera after superposition;
[0085] 1.2. Extract the sub-pixel corner points and corresponding image coordinates of each image;
[0086] 1.3. Initialize the world coordinates of the sub-pixel corner points (set the Z-axis coordinate to 0). Based on the correspondence between the world coordinates of the sub-pixel corner points and the image coordinates, the camera extrinsic parameters, camera intrinsic parameters, and distortion parameters are calculated using the Zhang Zhengyou calibration algorithm. Because the calculation process of the Zhang Zhengyou calibration algorithm is relatively lengthy and mature, it will not be described in detail here.
[0087] The camera external parameters include the rotation matrix R and the translation matrix T:
[0088]
[0089] Where r 11 、r 12 、r 13 、r 21 、r 22 、r 23 、r 31 、r 32 、r 33 is the element in the rotation matrix R of the camera external parameter; t1, t2, t3 are the elements in the translation vector T of the camera internal parameter;
[0090] The camera internal parameter is [f x ,f y ,u0,v0],f x 、f y , u0, v0 are elements in the camera intrinsic parameters;
[0091] The distortion parameters include radial distortion parameters [k1, k2, k3] and tangential distortion parameters [p1, p2]. k1, k2, k3 are elements in the radial distortion parameters, and p1 and p2 are elements in the tangential distortion parameters.
[0092] 2. Acquire images through the calibrated camera and perform distortion correction based on the distortion parameters;
[0093] The correction formula is:
[0094]
[0095] Where (u, v) and (u′, v′) are the coordinates of the image points before and after distortion correction, respectively.
[0096] 3. Construct a perspective mapping matrix based on camera external parameters and camera internal parameters; such as Figure 2 As shown, specifically including:
[0097] 3.1. Solve the object distance of the spatial point relative to the camera based on the camera's extrinsic parameters and intrinsic parameters, and obtain the Z-axis projection value of the spatial point relative to the camera coordinate system; specifically including:
[0098] 3.1.1. Obtain the transformation relationship from the world coordinate system to the camera coordinate system based on the camera external parameters:
[0099]
[0100] Where, (X w ,Y w ,Z w )、(X c ,Y c ,Z c ) is the coordinate point of the space point in the world coordinate system and the camera coordinate system;
[0101] 3.1.2. Obtain the transformation relationship from the camera coordinate system to the image coordinate system based on the camera intrinsic parameters:
[0102]
[0103] Where (u, v) is the coordinate point of the space point in the image coordinate system;
[0104] 3.1.3, let Z w=0, we can get:
[0105]
[0106] 3.1.4 Eliminate X c 、Y c 、X w 、Y w Get the Z-axis projection value:
[0107]
[0108] 3.2. Construct the transformation relationship from the image coordinate system to the camera coordinate system and from the camera coordinate system to the image coordinate system based on the Z-axis projection value and the camera intrinsic parameters;
[0109] The transformation relationship from the image coordinate system to the camera coordinate system is:
[0110]
[0111] The transformation relationship from the camera coordinate system to the image coordinate system is:
[0112]
[0113] 3.3. Obtain the axis rotation angle when converting the world coordinate system to the camera coordinate system based on the camera external parameters; specifically including:
[0114] 3.3.1, let R x 、R y 、R z These are the rotation components of the X, Y, and Z axes by angles α, β, and θ when the world coordinate system is converted to the camera coordinate system:
[0115]
[0116] 3.3.2, the rotation matrix of the camera extrinsic parameters It can be expressed as:
[0117] R=R x R y R z
[0118] 3.3.3, then:
[0119]
[0120] 3.3.4, through the corresponding equality method we can get:
[0121]
[0122] 3.3.5 Solving the above equation yields the axis rotation angle:
[0123]
[0124] 3.4. Construct the camera perspective transformation relationship from the camera coordinate system to the target camera coordinate system based on the axis rotation angle and the camera external parameters. This step is the key step. If perspective correction is to be achieved, the original image must be converted into a front view, such as Figure 3 As shown, O c -X c Y c Z c is the (original) camera coordinate system, rotate it to O′ c -X′ c Y′ c Z′ c Make the camera optical axis (Z axis) perpendicular to the object plane. The image obtained at this time is the front view. At the same time, to ensure that the intersection of the optical axis and the object plane remains unchanged, the camera coordinate system needs to be translated to O″ c -X″ c Y″ c Z″ c .
[0125] Since the Z axis of the world coordinate system is set to be perpendicular to the object plane during calibration, it is only necessary to rotate the original camera coordinate system α degrees in the opposite direction of the X axis and then β degrees in the opposite direction of the Y axis to make the optical axis parallel to the Z axis of the world coordinate system and thus perpendicular to the object plane. Since the world coordinate system is a left-handed coordinate system and the camera coordinate system is a right-handed coordinate system during setting, the Y and Z axes of the rotated camera coordinate system are in opposite directions, thereby obtaining the rotation transformation relationship of the camera coordinate system; specifically, the following:
[0126] 3.4.1. Obtain the transformation relationship from the original view to the vertical view in the camera coordinate system based on the axis rotation angle:
[0127]
[0128] Where α and β are the axis rotation angles, (X c ,Y c ,Z c ),(X′ c ,Y′ c ,Z′ c ) are the coordinates of the midpoint of the original viewing angle and the vertical viewing angle in the camera coordinate system respectively;
[0129] 3.4.2. Based on the axis rotation angle and the translation vector in the camera extrinsic parameters, the transformation relationship from the camera coordinate system to the target camera coordinate system is derived:
[0130]
[0131] Where Z3 is the distance between the optical center of the camera and the plane of the photographed object along the optical axis in the camera coordinate system;
[0132] 3.4.3. Based on the transformation relationship from the original view to the vertical view in the camera coordinate system and the transformation relationship from the camera coordinate system to the target camera coordinate system, the transformation relationship of the camera view is obtained:
[0133]
[0134] 3.4.4, written in homogeneous form:
[0135]
[0136] Where, (X″ c ,Y″ c ,Z″ c ) is the coordinate of the midpoint of the target camera coordinate system after the camera perspective is transformed.
[0137] 3.5. Construct a perspective mapping matrix based on the transformation relationship from the image coordinate system to the camera coordinate system, the camera perspective transformation relationship from the camera coordinate system to the target camera coordinate system, and the camera coordinate system to the image coordinate system. This involves converting the image coordinates to the original camera coordinate system, then to the camera coordinate system after the perspective transformation, and then converting them back to two-dimensional pixel coordinates to complete perspective correction.
[0138] The perspective mapping matrix is:
[0139]
[0140] After finishing, we can get:
[0141]
[0142] 4. Perform perspective correction on the distortion-corrected image through the transmission mapping matrix; its expression is:
[0143]
[0144] Where (u′, v′) is the coordinate of the image point after distortion correction, and (u″, v″) is the coordinate of the image point after perspective correction.
[0145] In order to verify the above method, industrial cameras, lenses, and light sources were selected and fixedly installed to build an imaging platform. 300 solar cell images were taken, such as Figure 4 The image shown is a cell image taken by a camera. The image obtained after perspective correction using the above method is as follows: Figure 5At the same time, the traditional control point transformation method is used to correct the perspective of the 300 cell images after distortion correction as a comparison. The same cell image obtained after the traditional method correction is as shown in Figure 6 As shown. Among them, the traditional control point transformation method first performs Hough line detection on the cell image to extract the four edges of the cell outline, calculates the coordinates of the four intersection points, and calculates the pixel coordinates of the four corner points of the standard rectangle based on the camera accuracy. The homography matrix is calculated using four pairs of control points, and finally the original image is corrected by perspective transformation. Figure 4 、 Figure 5 、 Figure 6 The comparison shows that the correction method of the present invention has better effect.
[0146] Because the solar cell is a standard rectangle, the four edges of the cell outline after correction are detected and the difference between the average angle of the adjacent edges and 90 degrees is calculated. The correction effect of the method of the present invention and the traditional method can be quantitatively compared by the difference. The results are as follows: Figure 7 The angle test results clearly show that the proposed method has a better perspective correction effect. After calculation, the average angle error of the four sides of the cell after correction using the traditional method is 1.6692 degrees, while the average angle error after perspective correction using the proposed method is 0.4973 degrees. Furthermore, it can be seen that the proposed method has smaller fluctuations and is more stable.
[0147] In addition, the processing runtime of the two perspective correction methods was also compared and tested. The results are as follows: Figure 8 As shown in the figure, the traditional method runs in approximately 145 milliseconds, while the perspective correction method in this paper takes approximately 25 milliseconds. The traditional method requires image edge detection followed by Hough line detection, which increases the correction time. However, the perspective correction method described in this paper is approximately 120 milliseconds faster than the traditional method, significantly reducing the inspection time for solar cells.
[0148] This method calculates the perspective mapping relationship between the original camera's perspective image and the camera's perspective image with the optical axis perpendicular to the object plane, thereby achieving perspective correction of solar cell images using camera perspective transformation. Compared to traditional methods, this method analyzes and calculates from the perspective of the camera lens imaging model, resulting in more accurate perspective correction, reduced computational effort, and increased correction speed. This method can be effectively applied to the positioning and inspection of solar cells in photovoltaic module production equipment, meeting the high-precision and high-speed requirements for solar cell image processing.
[0149] In a second aspect, the present invention provides an image perspective correction device based on camera perspective transformation, characterized in that it includes a processor and a storage medium;
[0150] The storage medium is used to store instructions;
[0151] The processor is configured to operate according to the instructions to execute the steps of the above method.
[0152] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0153] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0154] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0155] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0156] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An image perspective correction method based on camera perspective transformation, characterized in that: include: Calibrate the camera to obtain camera extrinsic parameters, camera intrinsic parameters and distortion parameters; Acquire images through the calibrated camera and perform distortion correction based on the distortion parameters; Construct a perspective mapping matrix based on camera extrinsic parameters and camera intrinsic parameters; Perform perspective correction on the distortion-corrected image through the transmission mapping matrix; The step of constructing a perspective mapping matrix based on camera extrinsic parameters and camera intrinsic parameters includes: Solve the object distance of the spatial point relative to the camera based on the camera extrinsic parameters and camera intrinsic parameters, and obtain the Z-axis projection value of the spatial point relative to the camera coordinate system; Construct the transformation relationship from the image coordinate system to the camera coordinate system and from the camera coordinate system to the image coordinate system based on the Z-axis projection value and the camera intrinsic parameters; Obtain the axis rotation angle when converting the world coordinate system to the camera coordinate system based on the camera external parameters; Construct the camera perspective transformation relationship from the camera coordinate system to the target camera coordinate system based on the axis rotation angle and the camera external parameters; Construct a perspective mapping matrix based on the transformation relationship from the image coordinate system to the camera coordinate system, the transformation relationship from the camera coordinate system to the target camera coordinate system, and the transformation relationship from the camera coordinate system to the image coordinate system; Obtaining the Z-axis projection value of the spatial point relative to the camera coordinate system includes: Obtain the transformation relationship from the world coordinate system to the camera coordinate system based on the camera external parameters: Where, is the rotation matrix R of the camera extrinsic parameter, r 11 、r 12 、r 13 、r 21 、r 22 、r 23 、r 31 、r 32 、r 33 is the element in the rotation matrix R of the camera external parameter; [t1, t2, t3] is the translation vector T of the camera external parameter, t1, t2, t3 are the elements in the translation vector T of the camera internal parameter; (X w ,Y w ,Z w )、(X c ,Y c ,Z c ) is the coordinate point of the space point in the world coordinate system and the camera coordinate system; Obtain the transformation relationship from the camera coordinate system to the image coordinate system based on the camera intrinsic parameters: Where (u, v) is the coordinate point of the space point in the image coordinate system; [f x ,f y ,u0,v0] is the camera internal parameter, f x 、f y , u0, v0 are elements in the camera intrinsic parameters; Let Z w =0, we can get: Eliminate X c 、Y c 、X w 、Y w Get the Z-axis projection value: The transformation relationship from the image coordinate system to the camera coordinate system is: The transformation relationship from the camera coordinate system to the image coordinate system is: In the formula, [f x ,f y ,u0,v0] is the camera internal parameter, Z c is the Z-axis projection value of the space point relative to the camera coordinate system, (X c ,Y c ,Z c ), (u,v) are coordinate points in the camera coordinate system and image coordinate system respectively; The axis rotation angle when converting the world coordinate system to the camera coordinate system according to the camera external parameters includes: Let R x 、R y 、R z These are the rotation components of the X, Y, and Z axes by angles α, β, and θ when the world coordinate system is converted to the camera coordinate system: Then the rotation matrix of the camera extrinsic parameter is It can be expressed as: R=R x R y R z but: By the corresponding equality method we can get: Solving the above equation yields the axis rotation angle: The transformation relationship of the camera perspective from the camera coordinate system to the target camera coordinate system constructed according to the axis rotation angle and the camera external parameters includes: Get the transformation relationship from the original view to the vertical view in the camera coordinate system based on the axis rotation angle: Where α and β are the axis rotation angles, (X c ,Y c ,Z c ),(X′ c ,Y′ c ,Z′ c ) are the coordinates of the midpoint of the original viewing angle and the vertical viewing angle in the camera coordinate system respectively; The transformation relationship from the camera coordinate system to the target camera coordinate system is derived based on the axis rotation angle and the translation vector in the camera external parameters: Where t3 is the parameter of the translation vector T = [t1, t2, t3] in the camera extrinsic parameters; Z3 is the distance between the camera optical center and the plane of the photographed object along the optical axis in the camera coordinate system; The transformation relationship of the camera perspective is obtained based on the transformation relationship from the original perspective to the vertical perspective in the camera coordinate system and the transformation relationship from the camera coordinate system to the target camera coordinate system: Written in homogeneous form: Where, (X" c ,Y" c ,Z" c ) is the coordinate of the midpoint of the target camera coordinate system after the camera perspective transformation; The perspective mapping matrix is: In the formula, [f x ,f y ,u0,v0] is the camera internal parameter, Z c is the Z-axis projection value of the spatial point relative to the camera coordinate system, Z3 is the distance between the optical center of the camera and the plane of the photographed object along the optical axis in the camera coordinate system, α and β are the axis rotation angles, and [T1, T2, T3] is the transformation relationship from the camera coordinate system to the target camera coordinate system.
2. The image perspective correction method based on camera perspective transformation according to claim 1, characterized in that: The camera calibration comprises: Using a camera to capture at least three images of a checkerboard calibration plate at different positions at a preset position, and each of the checkerboard calibration plates, after being superimposed, covers the entire field of view of the camera; Extract sub-pixel corner points and corresponding image coordinates of each image; Initialize the world coordinates of the sub-pixel corner points, and calculate the camera extrinsic parameters, camera intrinsic parameters, and distortion parameters based on the Zhang Zhengyou calibration algorithm according to the correspondence between the world coordinates and image coordinates of the sub-pixel corner points.
3. The image perspective correction method based on camera view angle transformation according to claim 1, characterized in that: The distortion correction based on the distortion parameters is as follows: In the formula, (u,v), (u ′ ,v ′ ) are the coordinates of the image points before and after distortion correction, [k1, k2, k3] and [p1, p2] are the radial and tangential distortion parameters in the distortion parameters, k1, k2, k3 are the elements in the radial distortion parameters, and p1 and p2 are the elements in the tangential distortion parameters; 4. An image perspective correction device based on camera perspective transformation, characterized in that: including processors and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Image-based correction method and crack vision measurement method
CN118674661A