Camera distortion center detection method and system, computer and medium
By detecting distortion centers in camera modules, the problem of low detection efficiency in the prior art is solved, and the distortion centers are quickly estimated through a checkerboard image, which improves the yield of the optical centers.
Patent Information
- Application Number
- CN202510150390.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-06-10
AI Technical Summary
In the prior art, when detecting modules with large camera distortions, multiple images are usually required to accurately determine the center of lens distortion, which is inefficient.
By building a shooting environment, obtain a distortion image of a checkerboard, perform preprocessing and sorting the inner corner points, build a 3D coordinate system, and calculate the distortion center of the camera module.
It is possible to roughly estimate the distortion center by taking a checkerboard image, which improves the small deviation of the optical center of the camera module, and thus improves the yield of the optical center of the rear-end camera.
Smart Images

Figure CN120125646A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of lens detection, and particularly relates to a method, a system, a computer, and a medium for detecting the distortion center of a camera. Background Art
[0002] Cameras are widely used in different fields, such as mobile phones, vehicles, medical, drones, and other fields. In a lens system, the optical center refers to the point where light does not deflect when passing through the lens system. The distortion center refers to the center point in the lens system where distortion effects are caused by the lens shape and errors.
[0003] The optical center and the distortion center are two crucial parameters in lens calibration and image processing. By determining the distortion center of the lens system, image distortion can be corrected more accurately, ensuring the true restoration and high-quality output of the image. Moreover, during the design and manufacturing process of the camera module, by calibrating to obtain the distortion center parameters of the lens, the deviation of the optical center of the camera module can be reduced, thereby improving the yield rate of the optical center of the rear-end camera.
[0004] In the prior art, the detection of the lens distortion center is usually tested under a white field. For a module with a large distortion (the image around is significantly distorted. When taking the same checkerboard at the same position with the same module, it will be found that the checkerboard on the edge is severely distorted), generally, multiple images need to be taken to accurately determine the position of the lens distortion center. Summary of the Invention
[0005] Aiming at the deficiencies of the above prior art, the technical problem to be solved by the present invention is: mainly for cameras with large distortion (usually with a large FOV field of view angle), by taking a single checkerboard image, the distortion center can be roughly estimated, so as to ensure a small deviation of the optical center of the module during the active alignment and assembly of the camera, and further improve the yield rate of the optical center of the rear-end camera.
[0006] One technical solution adopted by the present invention is: to provide a method for detecting the distortion center of a camera, including the following steps:
[0007] S1: Build a shooting environment and confirm the detection position of the camera module according to the physical center of the checkerboard;
[0008] S2: Obtain a distorted image of a checkerboard through the camera module, preprocess the distorted image, extract the inner corner points in the distorted image, and sort the inner corner points;
[0009] S3: Take the checkerboard plane as the XY-axis plane, construct a 3D coordinate system, and represent all the inner corner points as three-dimensional coordinates of the 3D coordinate system;
[0010] S4: Build a distortion calibration model, and calculate the distortion center of the camera module according to the sorting and three-dimensional coordinates of the inner corner points.
[0011] Further, the method further includes the following steps:
[0012] S5: Compare the calculated distortion center with the physical center. If the offset of the distortion center relative to the physical center is less than the preset offset, the camera module is qualified; otherwise, it is unqualified.
[0013] Further, in the S1 step, the following sub-steps are included:
[0014] S11: Fix the jig with the camera module in front of the checkerboard, and make the jig lie on a plane parallel to the checkerboard plane;
[0015] S12: Use the camera module to take a positioning image of the checkerboard, extract the smallest rectangle around the center point in the positioning image, and extract the image coordinate values of all corner points on the four sides of the smallest rectangle;
[0016] S13: Calculate the estimated center coordinate value of the positioning image according to the image coordinate values of all corner points on the four sides of the smallest rectangle;
[0017] S14: Determine whether the offset of the estimated center coordinate value relative to the physical center coordinate value of the checkerboard exceeds the preset estimation error. If not, confirm the current position of the jig as the detection position; otherwise, adjust the position of the jig, and repeat the steps S11 to S14 until the offset between the estimated center coordinate value and the physical center coordinate value of the checkerboard is less than the preset estimation error.
[0018] Further, the specific calculation process of the estimated center coordinate value is as follows:
[0019]
[0020] where n represents the number of corner points on the four sides of the smallest rectangle, x n represents the image abscissa value of the nth corner point, y n represents the image ordinate value of the nth corner point, and (x ct , y ct ) represents the estimated center coordinate value;
[0021] The comparison of the estimated center coordinate value with the physical center coordinate value of the checkerboard includes:
[0022]
[0023] Among them, abs represents the absolute value, width represents the image width, height represents the image height, and δ represents the preset calculation error.
[0024] Further, the step S2 includes the following sub-steps:
[0025] S21: Obtain a distorted image of a checkerboard through the camera module, and use the corner points except the four outermost sides in the distorted image as the inner corner points;
[0026] S22: Input the distorted image into OpenCV, perform grayscale processing on the distorted image, detect the inner corner points through the corner detection function. If the result of unable to detect corner points is returned, enter step S23;
[0027] S23: Perform filtering processing on the distorted image, and re-detect the inner corner points through the corner detection function;
[0028] S24: Optimize the positions of the detected inner corner points through the cv::cornerSubPix function, and sort the inner corner points.
[0029] Further, the step S3 includes the following sub-steps:
[0030] S31: Use the checkerboard plane as the XY-axis plane to construct a 3D coordinate system;
[0031] S32: Represent the three-dimensional coordinates of all the inner corner points in the 3D coordinate system as (100j, 100i, 0), where j represents the column number where the inner corner point is located, and i represents the row number where the inner corner point is located.
[0032] Further, the distortion calibration model is a pinhole model. The specific steps of calculating the distortion center of the camera module according to the sorting and three-dimensional coordinates of the inner corner points include the following:
[0033] S41: Convert the world point to the camera coordinate system:
[0034]
[0035] Among them, represents the camera coordinates of point P, represents the world coordinates of point P, R represents the rotation matrix, and T represents the translation vector;
[0036] S42: Construct a radial distortion model:
[0037]
[0038] Among them, (x d , y d) represents the image coordinates of the distorted point P, (x, y) represents the normalized ideal image coordinates of point P, and [k 1 , k 2 , k 3 , k 4 , k 5 , k 6 represents the radial distortion parameters, r represents the distance from point P to the image center and r 2 = x 2 + y 2 ;
[0039] S43: Construct a tangential distortion model:
[0040]
[0041] where, [p 1 , p 2 represents the tangential distortion parameters;
[0042] S44: Pixel coordinate transformation:
[0043]
[0044] where, represents the internal parameter matrix of the camera, f x represents the focal length in the x direction, f y represents the focal length in the y direction, (c x , c y ) represents the principal point coordinates, and (u, v) represents the pixel coordinates of point P obtained by transformation through the internal parameter matrix;
[0045] S45: Input the radial distortion model, tangential distortion model, and internal parameter matrix into the calibrateCamera function, and iterate the radial distortion parameters, tangential distortion parameters, and internal parameter matrix until the radial distortion parameters, tangential distortion parameters, and internal parameter matrix converge or are the same before and after inputting the calibrateCamera function.
[0046] To solve the above technical problems, the second technical solution adopted by the present invention is: Provide a detection system for the distortion center of a camera, including:
[0047] A position confirmation module, used to build a shooting environment and confirm the detection position of the camera module according to the physical center of the checkerboard;
[0048] An inner corner point sorting module, used to obtain a distorted image of a checkerboard through the camera module, preprocess the distorted image, extract the inner corner points in the distorted image, and sort the inner corner points;
[0049] A coordinate construction module, configured to use the checkerboard plane as the XY-axis plane, construct a 3D coordinate system, and represent all the inner corner points as three-dimensional coordinates of the 3D coordinate system;
[0050] A distortion center calculation module, configured to construct a distortion calibration model and calculate the distortion center of the camera module according to the sorting and three-dimensional coordinates of the inner corner points.
[0051] To solve the above technical problems, the third technical solution adopted by the present invention is: A computer device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the detection method described in any one of the above.
[0052] To solve the above technical problems, the fourth technical solution adopted by the present invention is: A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the detection method described in any one of the above is implemented.
[0053] The detection method, system, computer, and storage medium for the distortion center of the camera of the present invention have at least the following beneficial effects: By taking a single board image, the distortion center can be roughly estimated, which can ensure a small deviation of the optical center of the module for the camera AA (Active Alignment technology, an advanced process for achieving high-precision alignment during the assembly of the optical module), thereby improving the yield of the optical center of the rear-end camera. Description of the Drawings
[0054] The drawings described herein are used to provide a further understanding of the present application, form a part of the present application, and the illustrative embodiments and descriptions thereof are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0055] Figure 1 It is a flowchart of an implementation manner of the detection method for the distortion center of the camera of the present invention.
[0056] Figure 2 For the present invention Figure 1 It is a sub-flowchart of step S1 in the present invention.
[0057] Figure 3 For the present invention Figure 1 It is a sub-flowchart of step S2 in the present invention.
[0058] Figure 4 For the present invention Figure 1 It is a sub-flowchart of step S3 in the present invention.
[0059] Figure 5 For the present invention Figure 1 It is a sub-flowchart of step S4 in the present invention.
[0060] Figure 6 It is a structural block diagram of an implementation manner of the detection system for the distortion center of the camera of the present invention. Specific implementation manner
[0061] The present invention will be further described below with reference to the accompanying drawings.
[0062] Please refer to Figure 1 , which is a flowchart of an implementation manner of the method for detecting the distortion center of the camera of the present invention. This implementation manner may specifically include the following steps:
[0063] S1: Set up the shooting environment and confirm the detection position of the camera module according to the physical center of the checkerboard.
[0064] Specifically, in this implementation manner, it is necessary to determine the shooting environment. Place the checkerboard calibration card within the depth of field in front of the module, ensure its flatness and the clarity of the module shooting, and add a light source at the same time, so as to ensure that the appropriate color temperature and illuminance are set through the light source board. For example, the number of grid lengths and widths of the checkerboard here are 17 and 10 respectively, that is, if the outer corner points on the four edges of the checkerboard are ignored, there are 16*9 inner corner points in this checkerboard. The range of the camera module is 1.485m to infinity, and here the checkerboard is placed 3 meters in front of the module.
[0065] Please refer to Figure 2 , this step S1 may include the following sub-steps:
[0066] S11: Fix the jig equipped with the camera module directly in front of the checkerboard and make the jig lie on a plane parallel to the checkerboard plane.
[0067] Specifically, before extracting the corner points in the checkerboard, it is generally necessary to first construct a world coordinate system. In this implementation manner, the checkerboard plane can be used as the plane where Z = 0, that is, the checkerboard plane is used as the XY axis plane. In addition, it is also necessary to ensure that the jig equipped with the camera is parallel to the checkerboard board, which can be achieved by using a rangefinder for fixed-point measurement.
[0068] S12: Use the camera module to take a positioning image of the checkerboard, extract the smallest rectangle around the center point in the positioning image, and extract the image coordinate values of all corner points on the four sides of the smallest rectangle.
[0069] S13: Calculate the estimated center coordinate value of the positioning image according to the image coordinate values of all corner points on the four sides of the smallest rectangle.
[0070] Specifically, the main purpose of steps S12 to S13 is to calculate the coordinate value of the center of the checkerboard based on the corner coordinates on the captured checkerboard image. For example, randomly pick a camera module or a golden module (with a small optical center deviation in some modules), capture an image, and extract the coordinates of 6 corners around the center point in the positioning image, then the calculated center coordinate can be obtained. However, since the captured positioning image itself will be distorted, especially severely at the edge of the positioning image, in this embodiment, the corner points on the smallest rectangle around the center point in the positioning image are used to calculate the center coordinate of the positioning image. At the same time, it is known that there are 16 * 9 inner corner points in this checkerboard, so the image center can be calculated using the 6 corner points close to the center. The specific corner extraction process and calculation process are as follows: directly perform grayscale processing on the image, then call the findChessboardCorners function in opencv, and then perform sub-pixel level corner refinement through the cv::cornerSubPix function to improve the corner positioning accuracy. Thus, all the inner corner point coordinates (excluding the outermost corner points, a total of 16 * 9 corner points here) are obtained. The corner point coordinates of the 4th row and 8th column, 4th row and 9th column, 5th row and 8th column, 5th row and 9th column, 6th row and 8th column, and 6th row and 9th column are the 6 corner points close to the center, and the calculated center coordinate is obtained:
[0071]
[0072] Among them, (x ct , y ct ) represents the calculated center coordinate value, and (x 1 , y 1 ) to (x 6 , y 6 ) represent the positioning image coordinates of the 6 corner points.
[0073] S14: Determine whether the offset of the calculated center coordinate value relative to the physical center coordinate value of the checkerboard exceeds the preset calculation error. If not, confirm the current position of the jig as the detection position; otherwise, adjust the position of the jig and repeat steps S11 to S14 until the offset between the calculated center coordinate value and the physical center coordinate value of the checkerboard is less than the preset calculation error.
[0074] Specifically, after obtaining the calculated center coordinate, the position of the jig can be determined according to the comparison between the physical center and the calculated center of the positioning image. In this embodiment, the specific comparison method between the calculated center coordinate value and the physical center coordinate value of the checkerboard is as follows:
[0075]
[0076] Among them, abs represents the absolute value, width represents the image width, height represents the image height, and δ represents a preset calculation error, which can be set to 2 in this embodiment. When the calculated center coordinate value and the physical center coordinate value of the checkerboard exceed the preset calculation error, the position of the jig can be adjusted, and steps S11 to S14 are repeated until the offset between the calculated center coordinate value and the physical center coordinate value of the checkerboard is less than the preset calculation error.
[0077] S2: Obtain a distorted image of a checkerboard through the camera module, preprocess the distorted image, extract the inner corner points in the distorted image, and sort the inner corner points.
[0078] Specifically, after the shooting environment is set up and the detection position of the jig is determined, the step of sorting the inner corner points can be carried out, which is convenient for the subsequent calculation of the distortion center.
[0079] In some embodiments, please refer to Figure 3 , this step S2 may include the following sub-steps:
[0080] S21: Obtain a distorted image of a checkerboard through the camera module, and use the corner points except the four outermost sides in the distorted image as the inner corner points.
[0081] Specifically, obtain a distorted image of a checkerboard through the camera module. The distorted image can be in formats such as bmp, jpg, etc. The checkerboard in this embodiment is also of the 17*10 specification, that is, when shooting the distorted image of the checkerboard, the four outermost sides are ignored, and only the inner corner points are used as the inner corner points. There are a total of 16*9 inner corner points in the checkerboard of this specification.
[0082] S22: Perform grayscale processing on the distorted image, detect the inner corner points through the corner detection function. If the result of unable to detect corner points is returned, enter step S23.
[0083] S23: Perform filtering processing on the distorted image, and re-detect the inner corner points through the corner detection function.
[0084] S24: Use the cv::cornerSubPix function to optimize the positions of the detected inner corner points and sort the inner corner points.
[0085] Specifically, in this embodiment, first, the distorted image is grayscale processed, and then the findChessboardCorners function is used to extract the inner corner points in the distorted image. If the findChessboardCorners function returns a result indicating that no corner points can be found, the grayscale processed image needs to be further filtered. For example, a 3*3 filter is added here to perform a specific weighted summation on the pixels in the distorted image, making the surrounding pixel values of the central pixel more sensitive. Then, the cv::cornerSubPix function is used to refine the corner points at the sub-pixel level, and the obtained inner corner points are sorted in a 16*9 manner. The inner corner point coordinates can be represented as (x ij , y ij ), where i is the row and j is the column.
[0086] S3: Take the checkerboard plane as the XY-axis plane, construct a 3D coordinate system, and represent all the inner corner points as the three-dimensional coordinates of this 3D coordinate system.
[0087] Please refer to Figure 4 , this step S3 may include the following sub-steps:
[0088] S31: Take the checkerboard plane as the XY-axis plane and construct a 3D coordinate system.
[0089] S32: Represent the three-dimensional coordinates of all the inner corner points in the 3D coordinate system as (100j, 100i, 0), where j represents the column number where the inner corner point is located, and i represents the row number where the inner corner point is located.
[0090] Specifically, for the establishment of the 3D coordinate system, a 3D coordinate can be established corresponding to the checkerboard used. In this embodiment, the checkerboard plane can be taken as the XY-axis plane, that is, Z = 0 of the checkerboard plane. At the same time, since the side length of each grid in the checkerboard is 100mm, the three-dimensional coordinates of the inner corner points can be represented as (100j, 100i, 0). For example, the three-dimensional coordinates of the i = 1 row and j = 2 column are (200, 100, 0). The corner point sorting is actually to establish the correspondence between the pixel coordinates of the corner points in the original distorted captured image and the three-dimensional coordinates of the corner points. For example, the corner point in the first row and first column: (0, 0, 0) corresponds to the coordinates of this corner point directly extracted from the image as (100.12, 50.25), and the corner point in the first row and second column: (0, 100, 0) corresponds to the coordinates of this corner point directly extracted from the image as (164.50, 49.85).
[0091] S4: Construct a distortion calibration model, and calculate the distortion center of the camera module according to the sorting and three-dimensional coordinates of the inner corner points.
[0092] Specifically, in this embodiment, a distortion calibration model is constructed through a pinhole model, so as to calculate the distortion center of the camera module according to the sorting and three-dimensional coordinates of the inner corner points.
[0093] In some embodiments, referring to Figure 5 , this step S4 may include the following sub-steps:
[0094] S41: Convert the world point to the camera coordinate system:
[0095]
[0096] Among them, represents the camera coordinates of point P, represents the world coordinates of point P, R represents the rotation matrix, and T represents the translation vector.
[0097] Specifically, in this embodiment, the checkerboard plane is located on the z w = 0 plane of the world coordinate system. Therefore, the world coordinates of point P can also be written as (x w , y w , 0). At the same time, if point P is an inner corner point, its world coordinates are equivalent to the three-dimensional coordinates of the above-mentioned inner corner points. In addition, the rotation matrix R and the translation vector T can be initially estimated by the PnP algorithm, and then jointly calibrated with the internal parameters and distortion parameters through non-linear optimization. In practical applications, the effects of distortion and non-linear optimization need to be considered to ensure the coupling of the external parameters and the internal parameters.
[0098] S42: Construct a radial distortion model:
[0099]
[0100] Among them, (x d , y d ) represents the distorted image coordinates of point P, (x, y) represents the normalized ideal image coordinates of point P, [k 1 , k 2 , k 3 , k 4 , k 5 , k 6 represents the radial distortion parameters, r represents the distance from point P to the image center and r 2 = x 2 + y 2 .
[0101] Specifically, the radial distortion parameters included in a general radial distortion model are k 1 , k 2 , k 3 three. However, in this embodiment, the established distortion model has k 1 ~k 6Six radial distortion parameters, so that it can be applied to cameras with relatively large distortion or large FOV, and obtain a better effect of correcting radial distortion. At the same time, it can ensure the distortion correction of the edge part of the image. In addition, in actual applications, it will also be found that the actual shooting distance accuracy after undistortion with 6 radial distortion parameters is higher.
[0102] S43: Construct a tangential distortion model:
[0103]
[0104] Among them, [p 1 , p 2 represents the tangential distortion parameters.
[0105] Furthermore, the distortion model can be expressed as:
[0106]
[0107] S44: Pixel coordinate transformation:
[0108]
[0109] Among them, represents the internal parameter matrix of the camera, f x represents the focal length in the x direction, f y represents the focal length in the y direction, (c x , c y ) represents the principal point coordinates, and (u, v) represents the pixel coordinates obtained by transforming point P through the internal parameter matrix.
[0110] S45: Input the radial distortion model, tangential distortion model, and internal parameter matrix into the calibrateCamera function, and iterate the radial distortion parameters, tangential distortion parameters, and internal parameter matrix until the radial distortion parameters, tangential distortion parameters, and internal parameter matrix converge or are the same before and after inputting the calibrateCamera function.
[0111] Specifically, after completing the construction of the radial distortion model, tangential distortion model, and internal parameter matrix, according to the above corner point sorting (x ij , y ij ), and the three-dimensional coordinates (100j, 100i, 0), initialize the internal parameter matrix and make Among them, efl is the effective focal length, and pixelsize is the pixel size of the image sensor, both of which are known quantities. Furthermore, the coordinates of the distortion center can be obtained through the calibrateCamera function. The principle of the calibrateCamera function is based on a series of known three-dimensional world coordinate points and their corresponding two-dimensional projection points on the image plane, and the internal parameters of the camera (including the focal lengths (f x , f y ) and the principal point coordinates (c x , c y )) are solved by mathematical methods (such as the least squares method), involving optimization algorithms (iteration) to minimize the reprojection error (i.e., the error between the projection point of the three-dimensional point on the image plane and the detected two-dimensional coordinate point (the pixel coordinates of the corner points of the original distorted captured image)). That is, the above parameters are input into the calibrateCamera function of OpenCV to obtain a new internal parameter matrix and radial and tangential distortion parameters, and iteration is performed, that is, it is judged whether the internal parameter matrix and radial and tangential distortion parameters before and after being substituted into the calibrateCamera function of opencv have converged or are the same. If they have converged or are the same, the process ends. Finally, the obtained (c x , c y ) is the distortion center of the camera module.
[0112] S5: Compare the calculated distortion center with the physical center. If the offset of the distortion center relative to the physical center is less than the preset offset, the camera module is qualified; otherwise, it is unqualified.
[0113] Please refer to Figure 6 , which is the structural block diagram of an implementation manner of the detection system for the distortion center of the camera of the present invention. The detection system for the distortion center of the camera in this implementation manner is used to implement the detection method for the distortion center of the camera as described in the above implementation manner. Specifically, the detection system for the distortion center of the camera in this implementation manner includes a position confirmation module 100, an inner corner point sorting module 200, a coordinate construction module 300, a distortion center calculation module 400, and an error judgment module 500. Among them:
[0114] The position confirmation module 100 is used to set up the shooting environment and confirm the detection position of the camera module according to the physical center of the checkerboard;
[0115] The inner corner point sorting module 200 is used to obtain a distorted image of a checkerboard through the camera module, preprocess the distorted image, extract the inner corner points in the distorted image, and sort the inner corner points;
[0116] The coordinate construction module 300 is used to take the checkerboard plane as the XY axis plane, construct a 3D coordinate system, and represent all the inner corner points as the three-dimensional coordinates of this 3D coordinate system;
[0117] The distortion center calculation module 400 is used to construct a distortion calibration model and calculate the distortion center of the camera module according to the sorting and three-dimensional coordinates of the inner corner points.
[0118] In some embodiments, the system further includes a judgment module 500, which is used to compare the calculated distortion center with the physical center. If the offset of the distortion center relative to the physical center is less than a preset offset, the camera module is qualified; otherwise, it is unqualified.
[0119] The present invention proposes a method for detecting the distortion center of a camera. It is mainly used for cameras with large distortion (usually those with a large FOV field of view). By taking a single board image, the distortion center can be roughly estimated. This can ensure a small deviation of the optical center of the module for camera AA (Active Alignment technology, an advanced process for achieving high-precision alignment during the assembly of the optical module), thereby improving the yield of the optical center of the rear-end camera.
[0120] According to the above method, the distortion center of a lens module with a resolution of 1824*940, efl = 6.28mm, and pixel size = 4.2um is detected, and (c x ,c y ) = (913.805235, 468.872065) can be obtained. Compared with the physical center (912, 460), the x and y offsets are 1.805235 and 1.127935 pixels respectively.
[0121] The distortion center of a lens module with a resolution of 3840*2160, efl = 3.29mm, and pixel size = 1.12um is detected, and (c x ,c y ) = (1912.662325, 1067.297498) can be obtained. Compared with the physical center (1920, 1080), the x and y offsets are 7.337674 and 12.702501 pixels respectively.
[0122] On the other hand, an embodiment of the present invention also provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the detection method described in any one of the above. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a multi-agent data analysis method based on a large language model. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, a touchpad, or a mouse, etc.
[0123] On the other hand, an embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the detection method described in any one of the above.
[0124] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0125] The above content only expresses the preferred embodiments of the present invention. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all fall within the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the appended claims.
Claims
1. A method for detecting the center of camera distortion, characterized in that: The method comprises the following steps: S1: Set up the shooting environment and confirm the detection position of the camera module according to the physical center of the chessboard; S2: obtaining a chessboard distorted image through a camera module, preprocessing the distorted image, extracting inner corner points in the distorted image and sorting the inner corner points; S3: Taking the chessboard plane as the XY axis plane, constructing a 3D coordinate system, and expressing all the inner corner points as three-dimensional coordinates of the 3D coordinate system; S4: Build a distortion calibration model and calculate the distortion center of the camera module based on the sorting and three-dimensional coordinates of the inner corner points.
2. The method for detecting the camera distortion center according to claim 1, characterized in that: The method further comprises the following steps: S5: Compare the calculated distortion center with the physical center. If the offset of the distortion center relative to the physical center is less than a preset offset, the camera module is qualified; otherwise, it is unqualified.
3. The method for detecting the camera distortion center according to claim 1, wherein: The S1 step includes the following sub-steps: S11: Fixing a fixture equipped with a camera module in front of the chessboard, and making the fixture be located on a plane parallel to the plane of the chessboard; S12: Using a camera module to take a positioning image of the chessboard, extracting a minimum rectangle around the center point in the positioning image, and extracting image coordinate values of all corner points on four sides of the minimum rectangle; S13: Calculating the estimated center coordinate value of the positioning image according to the image coordinate values of all corner points on the four sides of the minimum rectangle; S14: Determine whether the offset of the calculated center coordinate value relative to the physical center coordinate value of the chessboard exceeds a preset calculation error. If not, confirm that the current position of the fixture is the detection position; otherwise, adjust the position of the fixture and repeat steps S11 to S14 until the offset of the calculated center coordinate value and the physical center coordinate value of the chessboard is less than the preset calculation error.
4. The method for detecting the camera distortion center according to claim 3, wherein: The specific calculation process of the estimated center coordinate value is: Where n represents the number of corner points on the four sides of the minimum rectangle, x n Indicates the image horizontal coordinate value of the nth corner point, y n Represents the image ordinate value of the nth corner point, (x ct ,y ct ) represents the estimated center coordinate value; The comparing the calculated center coordinate value with the physical center coordinate value of the chessboard comprises: Wherein, abs represents the absolute value, width represents the image width, height represents the image height, and δ represents the preset estimation error.
5. The method for detecting the camera distortion center according to claim 1, wherein: The step S2 comprises the following sub-steps: S21: obtaining a distorted image of a chessboard through a camera module, and taking corner points in the distorted image except those located on the outermost four edges as inner corner points; S22: grayscale processing is performed on the distorted image, and the inner corner point is detected by a corner point detection function. If a result indicating that the corner point cannot be detected is returned, the process proceeds to step S23; S23: filtering the distorted image, and redetecting the inner corner points using a corner point detection function; S24: Optimize the positions of the detected inner corner points through the cv::cornerSubPix function, and sort the inner corner points.
6. The method for detecting the camera distortion center according to claim 1, wherein: The S3 step includes the following sub-steps: S31: Use the chessboard plane as the XY axis plane to construct a 3D coordinate system; S32: Express the three-dimensional coordinates of all the inner corner points in the 3D coordinate system as (100j, 100i, 0), where j represents the column number where the inner corner point is located, and i represents the row number where the inner corner point is located.
7. The method for detecting the camera distortion center according to claim 1, wherein: The distortion calibration model is a pinhole model, and the calculation of the distortion center of the camera module according to the order and three-dimensional coordinates of the inner corner points specifically includes the following sub-steps: S41: Convert world point to camera coordinate system: in, represents the camera coordinates of point P, represents the world coordinates of point P, R represents the rotation matrix, and T represents the translation vector; S42: Construct radial distortion model: Among them, (x d ,y d ) represents the image coordinates of point P after distortion, (x, y) represents the normalized ideal image coordinates of point P, [k1, k2, k3, k4, k5, k6] represents the radial distortion parameters, r represents the distance from point P to the center of the image and r 2 =x 2 +y 2 ; S43: Constructing tangential distortion model: Where [p1, p2] represents the tangential distortion parameters; S44: Pixel coordinate conversion: in, Represents the intrinsic parameter matrix of the camera, f x represents the focal length in the x direction, f y represents the focal length in the y direction, (c x ,c y ) represents the principal point coordinates, (u, v) represents the pixel coordinates of point P obtained by the intrinsic parameter matrix transformation; S45: Inputting the radial distortion model, the tangential distortion model and the intrinsic parameter matrix into the calibrateCamera function, and iterating the radial distortion parameters, the tangential distortion parameters and the intrinsic parameter matrix until the radial distortion parameters, the tangential distortion parameters and the intrinsic parameter matrix converge or are the same before and after the calibrateCamera function is input.
8. A camera distortion center detection system, characterized in that: include: The position confirmation module is used to build a shooting environment and confirm the detection position of the camera module according to the physical center of the chessboard; An inner corner point sorting module is used to obtain a chessboard distorted image through a camera module, pre-process the distorted image, extract the inner corner points in the distorted image and sort the inner corner points; A coordinate construction module, used to construct a 3D coordinate system by taking the chessboard plane as the XY axis plane, and to express all the inner corner points as three-dimensional coordinates of the 3D coordinate system; The distortion center calculation module is used to build a distortion calibration model and calculate the distortion center of the camera module based on the order and three-dimensional coordinates of the inner corner points.
9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the detection method according to any one of claims 1 to 7 is implemented.