[go: up one dir, main page]

CN115115550B - Image perspective correction method and device based on camera visual angle transformation - Google Patents

Image perspective correction method and device based on camera visual angle transformation

Info

Publication number
CN115115550B
CN115115550B CN202210850793.0A CN202210850793A CN115115550B CN 115115550 B CN115115550 B CN 115115550B CN 202210850793 A CN202210850793 A CN 202210850793A CN 115115550 B CN115115550 B CN 115115550B
Authority
CN
China
Prior art keywords
camera
coordinate system
image
perspective
parameters
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
Application number
CN202210850793.0A
Other languages
Chinese (zh)
Other versions
CN115115550A (en
Inventor
赵腾
朱栋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changzhou University
Original Assignee
Changzhou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changzhou University filed Critical Changzhou University
Priority to CN202210850793.0A priority Critical patent/CN115115550B/en
Publication of CN115115550A publication Critical patent/CN115115550A/en
Application granted granted Critical
Publication of CN115115550B publication Critical patent/CN115115550B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker
    • G06T2207/30208Marker matrix
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E10/00Energy generation through renewable energy sources
    • Y02E10/50Photovoltaic [PV] energy

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种基于相机视角变换的图像透视校正方法及装置,其方法包括:对相机进行标定,获取相机外参、相机内参以及畸变参数;通过标定后的相机获取图像,并基于畸变参数进行畸变校正;基于相机外参和相机内参构建透视映射矩阵;通过透射映射矩阵对畸变校正后的图像进行透视校正。本发明通过推导得到原相机视角下图像到光轴垂直于物体平面的相机视角下图像的透视映射关系,以利用相机视角变换的方法实现图像的透视校正;本发明从相机镜头成像的角度分析计算,可使得透视校正效果更加准确,能够降低计算量,提高校正速度,可有效应用于光伏组件生产设备中对太阳能电池片的定位及检测中,以满足其对图像处理的高精度、高速性要求。

The present invention discloses a method and device for image perspective correction based on camera perspective transformation, the method comprising: calibrating a camera to obtain camera extrinsic parameters, camera intrinsic parameters, and distortion parameters; acquiring an image through the calibrated camera and performing distortion correction based on the distortion parameters; constructing a perspective mapping matrix based on the camera extrinsic parameters and camera intrinsic parameters; and performing perspective correction on the distortion-corrected image through the transmission mapping matrix. The present invention derives the perspective mapping relationship from the image under the original camera perspective to the image under the camera perspective with the optical axis perpendicular to the object plane, thereby realizing image perspective correction using the camera perspective transformation method; the present invention analyzes and calculates from the perspective of camera lens imaging, which can make the perspective correction effect more accurate, reduce the amount of calculation, and increase the correction speed. The method can be effectively applied to the positioning and detection of solar cells in photovoltaic module production equipment to meet the high-precision and high-speed requirements for image processing.

Description

Image perspective correction method and device based on camera visual angle transformation
Technical Field
The invention relates to an image perspective correction method and device based on camera visual angle transformation, and belongs to the technical field of digital images.
Background
When the optical axis of the industrial camera is in non-strict vertical relation with the solar cell placement platform, the solar cell on the image is deformed by the near-large and far-small size of the imaging perspective projection model, and the perspective distortion phenomenon causes that the outlines or grid lines of the cell on the image are not parallel to each other, so that the outline or the grid lines are not accurate enough when the cell is positioned, the accuracy of laser scribing is affected, and the detection probe can not be in contact with the electrode of the cell sometimes, and cannot detect the electrical property. In addition, before the manipulator moves the piece, the hand-eye calibration is often needed, usually, two-dimensional nine-point calibration is carried out between an image coordinate system and the manipulator coordinate system, and perspective deformation can influence the accuracy of the hand-eye calibration result, so that the position error of the manipulator moves the piece is increased. Industrial cameras are often fixedly mounted on certain stations of photovoltaic module production equipment and almost cannot be mounted with their optical axes strictly perpendicular to the product plane.
The perspective correction method commonly used at present mainly comprises an angle detection method, a control point transformation method and the like. The angle detection method generally detects the inclination angle of the solar cell in the image by using Hough or Radon transformation at first, and corrects the solar cell according to the rotation of the angle. The control point transformation method generally carries out Hough straight line detection on the outline or the main grid line of the battery piece and extracts angular points, establishes a linear relation between four or more control points and corresponding standard points, calculates a homography matrix, and then carries out perspective transformation on a distorted original image.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, and provides an image perspective correction method and device based on camera visual angle transformation, which can accurately and rapidly realize the image perspective correction of a solar cell slice, thereby meeting the positioning and detection requirements in the production process.
In order to achieve the above purpose, the invention is realized by adopting the following technical scheme:
In a first aspect, the present invention provides an image perspective correction method based on camera perspective transformation, including:
calibrating a camera to obtain camera external parameters, camera internal parameters and distortion parameters;
Acquiring an image through the calibrated camera, and carrying out distortion correction based on distortion parameters;
constructing a perspective mapping matrix based on the camera external parameters and the camera internal parameters;
and performing perspective correction on the image after distortion correction through the transmission mapping matrix.
Optionally, calibrating the camera includes:
Shooting at least 3 images of checkerboard calibration plates at different positions at preset positions by a camera, and overlapping each checkerboard calibration plate to cover the whole visual field of the camera;
extracting sub-pixel angular points of each image and corresponding image coordinates;
Initializing world coordinates of the sub-pixel corner points, and calculating and acquiring camera external parameters, camera internal parameters and distortion parameters based on Zhang Zhengyou calibration algorithm according to the corresponding relation between the world coordinates of the sub-pixel corner points and the image coordinates.
Optionally, the distortion correction based on the distortion parameter is:
wherein, (u, v) and (u ', v') are the coordinates of the image points before and after distortion correction, k 1,k2,k3]、[p1,p2 is the radial distortion parameter and tangential distortion parameter in the distortion parameters, k 1、k2、k3 is the element in the radial distortion parameter, and p 1、p2 is the element in the tangential distortion parameter;
optionally, the constructing the perspective mapping matrix based on the camera external parameters and the camera internal parameters includes:
Solving the object distance of the space point relative to the camera based on the camera external reference and the camera internal reference, and acquiring a Z-axis projection value of the space point relative to a camera coordinate system;
Constructing a transformation relation from an image coordinate system to a camera coordinate system and from the camera coordinate system to the image coordinate system according to the Z-axis projection value and the camera internal parameters;
acquiring an axis rotation angle when the world coordinate system is converted into a camera coordinate system according to the camera external parameters;
Constructing a transformation relation from a camera coordinate system to a camera view angle of a target camera coordinate system according to the axis rotation angle and the camera external parameters;
and constructing a perspective mapping matrix according to the transformation relation from the image coordinate system to the camera coordinate system, the transformation relation from the camera coordinate system to the camera view angle of the target camera coordinate system and the transformation relation from the camera coordinate system to the image coordinate system.
Optionally, the acquiring the Z-axis projection value of the spatial point relative to the camera coordinate system includes:
Obtaining a conversion relation from a world coordinate system to a camera coordinate system according to camera external parameters:
In the formula, The camera external reference rotation matrix R,r11、r12、r13、r21、r22、r23、r31、r32、r33 is an element in the camera external reference rotation matrix R, [ T 1,t2,t3 ] is a translation vector T of the camera external reference, T 1、t2、t3 is an element in the translation vector T of the camera internal reference, and (X w,Yw,Zw)、(Xc,Yc,Zc) is a coordinate point of a space point in a world coordinate system and a camera coordinate system;
obtaining a conversion relation from a camera coordinate system to an image coordinate system according to the camera internal parameters:
Wherein, (u, v) is coordinate point of space point in image coordinate system, [ f x,fy,u0,v0 ] is camera internal reference, f x、fy、u0、v0 is camera internal reference element;
let Z w =0, it is possible to obtain:
and eliminating X c、Yc、Xw、Yw to obtain a Z-axis projection value:
optionally, the transformation relation from the image coordinate system to the camera coordinate system is as follows:
The transformation relation from the camera coordinate system to the image coordinate system is as follows:
Wherein [ f x,fy,u0,v0 ] is a camera internal reference, Z c is a Z-axis projection value of a space point relative to a camera coordinate system, and (X c,Yc,Zc) and (u, v) are coordinate points in the camera coordinate system and an image coordinate system respectively.
Optionally, the obtaining the axis rotation angle when the world coordinate system is converted to the camera coordinate system according to the camera external parameters includes:
Let R x、Ry、Rz be the rotational components of three coordinate axes of X, Y, Z rotated by the angles α, β, θ when the world coordinate system is converted to the camera coordinate system, respectively:
Rotation matrix of camera external parameters Can be expressed as:
R=RxRyRz
Then:
By a corresponding equality method:
Solving the above method can obtain the rotation angle of the shaft:
optionally, the transforming relation of the camera view angle from the camera coordinate system to the target camera coordinate system according to the axis rotation angle and the camera external parameter includes:
Acquiring a conversion relation from an original view angle to a vertical view angle in a camera coordinate system based on the axis rotation angle:
Wherein alpha and beta are axial rotation angles, (X c,Yc,Zc)、(X′c,Y′c,Z′c) are midpoint coordinates of the original view angle and the vertical view angle in a camera coordinate system respectively;
deriving a transformation relation from the camera coordinate system to the target camera coordinate system based on the axis rotation angle and the translation vector in the camera external parameters:
Wherein T 3 is a parameter in a translation vector T= [ T 1,t2,t3 ] in a camera external parameter, Z 3 is a distance between a camera optical center and a shooting object plane along an optical axis in a camera coordinate system;
obtaining a transformation relation of the camera view angle based on the transformation relation of the original view angle to the vertical view angle in the camera coordinate system and the transformation relation of the camera coordinate system to the target camera coordinate system:
The writing into homogeneous form is as follows:
Wherein (X' c,Y″c,Z″c) is the midpoint coordinate in the target camera coordinate system after the camera view angle transformation.
Optionally, the perspective mapping matrix is:
Wherein [ f x,fy,u0,v0 ] is an internal reference of the camera, Z c is a Z-axis projection value of a space point relative to a camera coordinate system, Z 3 is a distance between a camera optical center and a shooting object plane along an optical axis in the camera coordinate system, alpha and beta are axial rotation angles, and [ T 1,T2,T3 ] is a conversion relation from the camera coordinate system to a target camera coordinate system.
In a second aspect, the present invention provides an image perspective correction device based on camera perspective transformation, which is characterized by comprising a processor and a storage medium;
The storage medium is used for storing instructions;
the processor is operative according to the instructions to perform steps according to the method described above.
Compared with the prior art, the invention has the beneficial effects that:
The invention provides an image perspective correction method and device based on camera perspective transformation, which are used for realizing perspective correction of an image by utilizing the camera perspective transformation method by deducing the perspective mapping relation from an image under an original camera perspective to an image under the camera perspective of which the optical axis is perpendicular to an object plane. According to the invention, the perspective correction effect is more accurate through the analysis and calculation from the imaging angle of the camera lens, the calculated amount can be reduced, the correction speed can be improved, and the method can be effectively applied to the positioning and detection of the solar cell in the photovoltaic module production equipment so as to meet the requirements of high accuracy and high speed of the solar cell image processing.
Drawings
Fig. 1 is a flowchart of an image perspective correction method based on camera perspective transformation according to an embodiment of the present invention;
FIG. 2 is a flowchart of constructing a perspective mapping matrix based on camera external parameters and camera internal parameters according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a transformation of camera angles from a camera coordinate system to a target camera coordinate system according to an embodiment of the present invention;
fig. 4 is a view of a solar cell taken by a camera according to an embodiment of the present invention;
FIG. 5 is a perspective corrected image of a solar cell according to an embodiment of the present invention;
FIG. 6 is a perspective corrected image of a solar cell according to a conventional method according to an embodiment of the present invention;
FIG. 7 is a graph showing comparison between the conventional method and the method according to the present embodiment of the invention;
fig. 8 is a graph showing comparison of the correction operation time of the conventional method and the method according to the present embodiment.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present invention, and are not intended to limit the scope of the present invention.
Embodiment one:
As shown in fig. 1, an embodiment of the present invention provides an image perspective correction method based on camera perspective transformation, including the following steps:
1. Calibrating a camera to obtain camera external parameters, camera internal parameters and distortion parameters;
the camera is calibrated by adopting a currently mature calibration technology 'Zhang Zhengyou calibration method', and the main process comprises the following steps:
1.1, shooting at least 3 images of checkerboard calibration plates at different positions at preset positions through a camera, and overlapping each checkerboard calibration plate to cover all fields of view of the camera;
1.2, extracting sub-pixel angular points of each image and corresponding image coordinates;
1.3, initializing world coordinates (Z-axis coordinates are set to 0) of the sub-pixel corner points, and calculating and acquiring camera external parameters, camera internal parameters and distortion parameters based on Zhang Zhengyou calibration algorithm according to the corresponding relation between the world coordinates and the image coordinates of the sub-pixel corner points. Since Zhang Zhengyou calibration algorithm calculation process is tedious and mature, it will not be described too much here.
The camera external parameters comprise a rotation matrix R and a translation matrix T:
Wherein R 11、r12、r13、r21、r22、r23、r31、r32、r33 is an element in a rotation matrix R of the camera external reference, T 1、t2、t3 is an element in a translation vector T of the camera internal reference;
the camera intrinsic parameter is [ f x,fy,u0,v0],fx、fy、u0、v0 ] which is an element in the camera intrinsic parameter;
The distortion parameters include a radial distortion parameter [ k 1,k2,k3 ], a tangential distortion parameter [ p 1,p2],k1、k2、k3 ] which is an element in the radial distortion parameter, and p 1、p2 which is an element in the tangential distortion parameter.
2. Acquiring an image through the calibrated camera, and carrying out distortion correction based on distortion parameters;
the correction formula is:
wherein, (u, v) and (u ', v') are the coordinates of the image points before and after the distortion correction,
3. Constructing a perspective mapping matrix based on the camera external parameters and the camera internal parameters, as shown in fig. 2, specifically including:
3.1, solving object distance of the space point relative to the camera based on the camera external reference and the camera internal reference to obtain a Z-axis projection value of the space point relative to a camera coordinate system, wherein the method specifically comprises the following steps:
3.1.1, obtaining a conversion relation from a world coordinate system to a camera coordinate system according to camera external parameters:
Wherein, (X w,Yw,Zw)、(Xc,Yc,Zc) is a coordinate point of the space point in a world coordinate system and a camera coordinate system;
3.1.2, obtaining a conversion relation from a camera coordinate system to an image coordinate system according to the camera internal parameters:
wherein, (u, v) is a coordinate point of the spatial point in the image coordinate system;
3.1.3, let Z w =0, to obtain:
3.1.4, eliminating X c、Yc、Xw、Yw to obtain a Z-axis projection value:
3.2, constructing a transformation relation from an image coordinate system to a camera coordinate system and from the camera coordinate system to the image coordinate system according to the Z-axis projection value and the camera internal parameters;
The transformation relation from the image coordinate system to the camera coordinate system is:
the transformation relation of the camera coordinate system to the image coordinate system is as follows:
3.3, obtaining an axis rotation angle when the world coordinate system is converted into the camera coordinate system according to the camera external parameters, wherein the method specifically comprises the following steps:
3.3.1, let R x、Ry、Rz be the rotational component of three coordinate axes of X, Y, Z rotated by α, β, θ angles when the world coordinate system is converted to the camera coordinate system, respectively:
3.3.2 rotation matrix for camera parameters Can be expressed as:
R=RxRyRz
3.3.3, then:
3.3.4, obtainable by a corresponding equivalent method:
3.3.5, solving the above method to obtain the shaft rotation angle:
And 3.4, constructing a transformation relation from a camera coordinate system to a camera view angle of a target camera coordinate system according to the axis rotation angle and the camera external parameters, wherein the key step is that if perspective correction is realized, an original image is required to be converted into a front view, as shown in fig. 3, an O c-XcYcZc is an (original) camera coordinate system, the original image is rotated into an O 'c-X′cY′cZ′c so that a camera optical axis (Z axis) is perpendicular to an object plane, an obtained image is the front view, and meanwhile, if the intersection point of the optical axis and the object plane is required to be unchanged, the camera coordinate system is required to be translated into an O' c-X″cY″cZ″c.
The Z axis of the world coordinate system is set to be perpendicular to the plane of the object during calibration, so that the original camera coordinate system is rotated by alpha degrees along the X axis in the opposite direction and then rotated by beta degrees along the Y axis in the opposite direction, the phase optical axis is parallel to the Z axis of the world coordinate system so as to be perpendicular to the plane of the object, and the camera coordinate system is a left-hand coordinate system and a right-hand coordinate system during setting, so that the rotated camera coordinate system Y and Z axes take opposite directions, thereby obtaining a rotation transformation relation of the camera coordinate system, and the method specifically comprises the following steps:
3.4.1, obtaining a conversion relation from an original view angle to a vertical view angle in a camera coordinate system based on the axis rotation angle:
Wherein alpha and beta are axial rotation angles, (X c,Yc,Zc)、(X′c,Y′c,Z′c) are midpoint coordinates of the original view angle and the vertical view angle in a camera coordinate system respectively;
3.4.2, deriving a transformation relation from the camera coordinate system to the target camera coordinate system based on the axis rotation angle and the translation vector in the camera external parameters:
Wherein Z 3 is the distance between the camera optical center and the plane of the shooting object along the optical axis in the camera coordinate system;
3.4.3, obtaining a transformation relation of the camera view angle based on the transformation relation from the original view angle to the vertical view angle in the camera coordinate system and the transformation relation from the camera coordinate system to the target camera coordinate system:
3.4.4, write in homogeneous form:
Wherein (X' c,Y″c,Z″c) is the midpoint coordinate in the target camera coordinate system after the camera view angle transformation.
And 3.5, constructing a perspective mapping matrix according to the transformation relation from the image coordinate system to the camera coordinate system, the transformation relation from the camera coordinate system to the camera view angle of the target camera coordinate system and the transformation relation from the camera coordinate system to the image coordinate system. The image coordinates are converted into the coordinates under the original camera coordinate system, then converted into the coordinates under the camera coordinate system after the visual angle transformation, and then converted back into the two-dimensional pixel coordinates, thereby completing perspective correction.
The perspective mapping matrix is:
The finishing method can obtain:
4. performing perspective correction on the image after distortion correction through a transmission mapping matrix, wherein the expression is as follows:
where, (u ', v') is the distortion corrected image point coordinates and (u '', v '') is the perspective corrected image point coordinates.
In order to verify the method, the industrial camera, the lens and the light source are selected and fixedly installed, an imaging platform is built, 300 solar cell images are taken, one cell image shot by the camera is shown in fig. 4, and an image obtained after perspective correction by the method is shown in fig. 5. Meanwhile, the perspective correction of 300 battery piece images after the distortion correction is used as a comparison by using a traditional control point transformation method, and the same battery piece image obtained after the correction by using the traditional method is shown in fig. 6. The traditional control point transformation method firstly carries out Hough straight line detection on a battery piece image to extract four sides of a battery piece outline, calculates four intersection point coordinates, calculates standard rectangular four corner point pixel coordinates according to camera precision, calculates a homography matrix by utilizing four pairs of control points, and finally carries out perspective transformation on an original image to realize correction. The correction method of the invention has better effect as can be seen by comparing fig. 4, 5 and 6.
Because the solar cell is a standard rectangle, the four sides of the corrected cell outline are detected, the difference between the average included angle of the adjacent sides and 90 degrees is calculated, and the correction effect of the method of the invention and the traditional method can be compared through the difference quantification, and the result is shown in fig. 7. The test result of the included angle shows that the method has better perspective correction effect, the average included angle error of the four-side outline of the battery piece corrected by the traditional calculation method is 1.6692 degrees, the average included angle error of the perspective correction method is 0.4973 degrees, and the method has smaller fluctuation and more stable operation.
In addition, the processing run times of the two perspective correction methods were also subjected to comparative tests, and the results are shown in fig. 8. It can be seen that the conventional approach runs around 145 milliseconds, while the perspective correction approach herein is around 25 milliseconds. The traditional method increases the correction time because the image edge is detected first and then the Hough straight line detection is carried out, and compared with the traditional method, the perspective correction method is faster by about 120 milliseconds, and the detection time of the solar cell can be greatly shortened.
According to the invention, the perspective mapping relation between the image under the original camera view angle and the image under the camera view angle with the optical axis perpendicular to the object plane is obtained through calculation, so that the perspective correction of the solar cell image is realized by using a camera view angle conversion method. Compared with the traditional method, the method has the advantages that the perspective correction effect is more accurate through the angle analysis and calculation of the camera lens imaging model, the calculated amount is reduced, the correction speed is improved, and the method can be effectively applied to the positioning and detection of the solar cell in the photovoltaic module production equipment so as to meet the requirements of high accuracy and high speed of the solar cell image processing.
In a second aspect, the present invention provides an image perspective correction device based on camera perspective transformation, which is characterized by comprising a processor and a storage medium;
The storage medium is used for storing instructions;
The processor is operative according to the instructions to perform steps according to the method described above.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and variations could be made by those skilled in the art without departing from the technical principles of the present invention, and such modifications and variations should also be regarded as being within the scope of the invention.

Claims (4)

1.一种基于相机视角变换的图像透视校正方法,其特征在于,包括:1. A method for image perspective correction based on camera perspective transformation, comprising: 对相机进行标定,获取相机外参、相机内参以及畸变参数;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: 对空间点基于相机外参和相机内参进行相对于相机的物距求解,获取空间点相对于相机坐标系的Z轴投影值;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; 根据Z轴投影值以及相机内参构建图像坐标系到相机坐标系和相机坐标系到图像坐标系的变换关系式;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; 所述获取空间点相对于相机坐标系的Z轴投影值包括: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: 式中,为相机外参的旋转矩阵R,r11、r12、r13、r21、r22、r23、r31、r32、r33为相机外参的旋转矩阵R中的元素;[t1,t2,t3]为相机外参的平移向量T,t1、t2、t3为相机内参的平移向量T中的元素;(Xw,Yw,Zw)、(Xc,Yc,Zc)为空间点在世界坐标系和相机坐标系中的坐标点;Where, is the rotation matrix R of the camera extrinsic parameters, r 11 , r 12 , r 13 , r 21 , r 22 , r 23 , r 31 , r 32 , r 33 are the elements of the rotation matrix R of the camera extrinsic parameters; [t 1 , t 2 , t 3 ] is the translation vector T of the camera extrinsic parameters, t 1 , t 2 , t 3 are the elements of the translation vector T of the camera intrinsic parameters; (X w , Y w , Z w ) and (X c , Y c , Z c ) are the coordinates of the spatial 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: 式中,(u,v)为空间点在图像坐标系中的坐标点;[fx,fy,u0,v0]为相机内参,fx、fy、u0、v0为相机内参中元素;Where (u, v) is the coordinate point of the spatial point in the image coordinate system; [ fx , fy , u0 , v0 ] is the camera intrinsic parameter, and fx , fy , u0 , v0 are the elements in the camera intrinsic parameter; 设Zw=0,可得:Assuming Z w = 0, we can obtain: 消去Xc、Yc、Xw、Yw求得Z轴投影值:Eliminate Xc , Yc , Xw , and Yw to obtain 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: 式中,[fx,fy,u0,v0]为相机内参,Zc为空间点相对于相机坐标系的Z轴投影值,(Xc,Yc,Zc)、(u,v)分别为相机坐标系、图像坐标系中的坐标点;Where [f x ,f y ,u 0 ,v 0 ] is the camera intrinsic 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 ) and (u,v) are the coordinate points in the camera coordinate system and the 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: 设Rx、Ry、Rz分别为世界坐标系向相机坐标系转换时,X、Y、Z三个坐标轴旋转α、β、θ角度的旋转分量:Let Rx , Ry , and Rz be the rotation components of the X, Y, and Z axes by angles α, β, and θ when the world coordinate system is transformed into the camera coordinate system: 则相机外参的旋转矩阵可表示为:Then the rotation matrix of the camera extrinsic parameter is It can be expressed as: R=RxRyRz 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: 式中,α、β为轴旋转角度,(Xc,Yc,Zc)、(X′c,Y′c,Z′c)分别为原视角、垂直视角在相机坐标系中点坐标;Where α and β are the axis rotation angles, (X c , Y c , Z c ) and (X′ c , Y′ c , Z′ c ) are the coordinates of the original view and vertical view 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: 式中,t3为相机外参中平移向量T=[t1,t2,t3]中的参数;Z3为相机坐标系中相机光心与拍摄物体平面沿光轴的距离;Where t 3 is the parameter of the translation vector T = [t 1 , t 2 , t 3 ] in the camera extrinsic parameters; Z 3 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: 式中,(X"c,Y"c,Z"c)为相机视角变换后的目标相机坐标系中点坐标;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: 式中,[fx,fy,u0,v0]为相机内参,Zc为空间点相对于相机坐标系的Z轴投影值,Z3为相机坐标系中相机光心与拍摄物体平面沿光轴的距离,α、β为轴旋转角度,[T1,T2,T3]为相机坐标系到目标相机坐标系的变换关系式。In the formula, [f x ,f y ,u 0 ,v 0 ] is the camera intrinsic parameter, Z c is the Z-axis projection value of the space point relative to the camera coordinate system, Z 3 is the distance between the camera optical center and the plane of the photographed object along the optical axis in the camera coordinate system, α and β are the axis rotation angles, and [T 1 ,T 2 ,T 3 ] is the transformation relationship from the camera coordinate system to the target camera coordinate system. 2.根据权利要求1所述的一种基于相机视角变换的图像透视校正方法,其特征在于,所述对相机进行标定包括:2. The image perspective correction method based on camera viewpoint transformation according to claim 1, wherein the camera calibration comprises: 通过相机在预设位置拍摄至少3张不同位置的棋盘格标定板的图像,且每个所述棋盘格标定板叠加后覆盖相机的全部视野;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; 提取每张图像的亚像素角点以及相应的图像坐标;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.根据权利要求1所述的一种基于相机视角变换的图像透视校正方法,其特征在于,所述基于畸变参数进行畸变校正为:3. The image perspective correction method based on camera view angle transformation according to claim 1, wherein the distortion correction based on the distortion parameter is: 式中,(u,v)、(u,v)分别为畸变校正前、后的图像点坐标,[k1,k2,k3]、[p1,p2]分别为畸变参数中的径向、切向畸变参数,k1、k2、k3为径向畸变参数中的元素,p1、p2为切向畸变参数中的元素; Wherein, (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; 4.一种基于相机视角变换的图像透视校正装置,其特征在于,包括处理器及存储介质;4. An image perspective correction device based on camera perspective transformation, characterized by comprising a processor and a storage medium; 所述存储介质用于存储指令;The storage medium is used to store instructions; 所述处理器用于根据所述指令进行操作以执行根据权利要求1-3任一项所述方法的步骤。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.
CN202210850793.0A 2022-07-20 2022-07-20 Image perspective correction method and device based on camera visual angle transformation Active CN115115550B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210850793.0A CN115115550B (en) 2022-07-20 2022-07-20 Image perspective correction method and device based on camera visual angle transformation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210850793.0A CN115115550B (en) 2022-07-20 2022-07-20 Image perspective correction method and device based on camera visual angle transformation

Publications (2)

Publication Number Publication Date
CN115115550A CN115115550A (en) 2022-09-27
CN115115550B true CN115115550B (en) 2025-09-09

Family

ID=83332573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210850793.0A Active CN115115550B (en) 2022-07-20 2022-07-20 Image perspective correction method and device based on camera visual angle transformation

Country Status (1)

Country Link
CN (1) CN115115550B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115760602A (en) * 2022-11-04 2023-03-07 深圳快造科技有限公司 Image correction method, laser cutting apparatus, and storage medium
CN116091614B (en) * 2022-11-29 2025-11-25 深圳创维新世界科技有限公司 Video perspective methods, devices, terminal equipment and storage media
CN116309275B (en) * 2022-12-13 2025-10-28 常州大学 A method, device and storage medium for detecting sub-pixel edges of cell images
CN119183025B (en) * 2024-11-22 2025-09-16 广州乐庚信息科技有限公司 Perspective transformation image acquisition method and system based on binocular data acquisition equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118674661A (en) * 2024-05-31 2024-09-20 江苏理工学院 Correction method based on image and crack vision measurement method

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107424126A (en) * 2017-05-26 2017-12-01 广州视源电子科技股份有限公司 Image correction method, device, equipment and system, image pickup equipment and display equipment
CN109461126B (en) * 2018-10-16 2020-06-30 重庆金山科技(集团)有限公司 Image distortion correction method and system
CN110930457B (en) * 2019-10-15 2023-02-28 中国第一汽车股份有限公司 Camera calibration method, device, vehicle and storage medium
CN113592962B (en) * 2021-08-23 2024-04-09 洛阳德晶智能科技有限公司 Batch silicon wafer identification recognition method based on machine vision
CN114494464A (en) * 2021-12-15 2022-05-13 深圳市华汉伟业科技有限公司 Calibration method of line scanning camera

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118674661A (en) * 2024-05-31 2024-09-20 江苏理工学院 Correction method based on image and crack vision measurement method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱栋等.《电子测量技术》.2024,(2024年第8期),全文. *

Also Published As

Publication number Publication date
CN115115550A (en) 2022-09-27

Similar Documents

Publication Publication Date Title
CN115115550B (en) Image perspective correction method and device based on camera visual angle transformation
CN112223285B (en) Robot hand-eye calibration method based on combined measurement
CN109598762B (en) High-precision binocular camera calibration method
CN112562014B (en) Camera calibration method, system, medium and device
CN112258588A (en) Calibration method and system of binocular camera and storage medium
CN108288294A (en) A kind of outer ginseng scaling method of a 3D phases group of planes
CN115170434B (en) Error correction method and device for line structured light 3D camera
CN110099267A (en) Trapezoidal correcting system, method and projector
CN115187612B (en) A plane area measurement method, device and system based on machine vision
CN103150724A (en) Segmented model-based camera calibration method
CN112734860A (en) A pixel-by-pixel mapping projection geometry correction method based on arc-curtain prior information
CN115965697A (en) Projector calibration method, calibration system and device based on Samm's law
CN112489141B (en) Production line calibration method and device for single-board single-image strip relay lens of vehicle-mounted camera
CN114663533A (en) Multi-view camera calibration method and system based on nonlinear optimization
CN114966238B (en) Automatic detection and alignment method for antenna phase center
CN113409399A (en) Dual-camera combined calibration method, system and device
Cheng et al. Camera calibration based on phase estimation
CN117911529A (en) Pose calibration method, pose calibration system and computing equipment
JPH04242106A (en) Face recognizing apparatus
CN120125672A (en) A laser radar-camera fusion calibration method and system
CN119850732A (en) Target positioning method based on monocular vision on plane
CN118037605A (en) Planar imaging perspective deformation correction method based on extrinsic parameter adjustment
CN118544360A (en) Robot vision detection method, system, terminal and medium based on laser compensation
CN118758209A (en) A heliostat curvature detection method based on image processing technology
Xu et al. Study on binocular stereo camera calibration method

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