A method and device for determining a camera distortion center
By filtering and calculating the pixel coordinates of the calibrated image, the distortion center of the camera is determined, which solves the problem of inaccurate distortion center location in traditional methods and improves the accuracy and efficiency of image correction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGSU MUTENGGUANG PRECISION OPTICAL INSTR CO LTD
- Filing Date
- 2026-04-22
- Publication Date
- 2026-07-14
AI Technical Summary
Traditional methods cannot ensure the accuracy of the distortion center location, affecting the image correction quality, and the complex parameter fitting process is prone to getting trapped in local optima.
By extracting the pixel coordinates of the calibration image, candidate corner points that meet the preset distance constraints are screened, the preliminary center position is calculated, and the distortion center is determined based on the target corner point and its neighboring corner points within its neighborhood, simplifying the operation process and improving detection accuracy.
It achieves high-precision detection of distortion centers, adapts to different lens and camera conditions, simplifies the operation process, and improves the effect of image correction and detection efficiency.
Smart Images

Figure CN122093554B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of camera distortion technology, and in particular to a method and apparatus for determining the center of camera distortion. Background Technology
[0002] In camera imaging systems, lens distortion is one of the key factors affecting image quality. Due to the optical characteristics of the lens and assembly errors, actual imaging will exhibit radial and tangential distortion, causing the geometry in the image to be distorted. To obtain accurate image information, distorted images must be corrected, and the distortion center is the core reference point in the distortion correction model.
[0003] The distortion center is defined as the intersection of the lens optical axis and the imaging plane. Its core physical characteristic is that this point itself is free of distortion; all distortion radiates outward from this point. Ideally, the distortion center should coincide with the geometric center of the imaging plane (i.e., the image center). However, in actual lens manufacturing and assembly processes, due to factors such as lens processing errors and lens-sensor assembly deviations, the intersection of the lens optical axis and the sensor plane often deviates from the image center, causing the distortion center to shift.
[0004] Therefore, there is an urgent need for a method and device for determining the distortion center of a camera, in order to solve the problem that traditional methods for determining the distortion center cannot ensure the accuracy of the distortion center position, thus affecting the quality of image correction. Summary of the Invention
[0005] The purpose of this application is to provide a method and apparatus for determining the distortion center of a camera, which solves the problem that traditional methods for determining the distortion center cannot ensure the accuracy of the distortion center position, thereby affecting the image correction quality.
[0006] In a first aspect, embodiments of this application provide a method for determining the distortion center of a camera. The method includes: extracting the pixel coordinates of each calibration corner point in a calibration image under distortion conditions, and constructing a corner point coordinate set. Based on the standard distance pixel values between adjacent calibration corner points in the calibration image, candidate corner points that meet preset distance constraints are selected from the corner point coordinate set. The preliminary center position of the calibration image is calculated based on the pixel coordinates of each candidate corner point. A target corner point is selected from the corner point coordinate set based on the preliminary center position. The target corner point is used as a reference corner point for determining the distortion center. The distortion center of the camera is determined based on the target corner point and multiple adjacent corner points within the neighborhood of the target corner point.
[0007] The method for determining the distortion center of a camera provided in this application, based on the standard distance pixel values between adjacent corner points in a calibrated image, filters candidate corner points that meet preset distance constraints from all corner points in the image and calculates the preliminary center position. This achieves a global and unbiased estimation of the distortion center, avoiding the positional deviation problem caused by directly assuming the image center as the distortion center in traditional methods. Furthermore, it further filters target corner points from the set of corner point coordinates, and finally determines the distortion center based on the target corner point and multiple adjacent corner points within its neighborhood. This multi-level filtering mechanism, from coarse to fine, effectively eliminates the interference of corner points far from the distortion center on the calculation results, significantly improving the accuracy of distortion center detection. Meanwhile, this method only requires acquiring one calibration plate distortion image to complete the detection, without the need to take multiple calibration images in different poses or perform complex parameter fitting iterative calculations. This effectively avoids the result deviation problem caused by the calibration algorithm getting stuck in a local optimum due to parameter fitting. While simplifying the operation process and improving detection efficiency, it can adapt to the distortion center detection needs under different lenses, cameras, and calibration plates, and has strong versatility and engineering adaptability. It provides a precise benchmark reference point for subsequent image distortion correction, thereby improving the effect of distortion correction processing.
[0008] One possible implementation involves selecting target corner points from a set of corner coordinates based on the initial center position. This includes: selecting multiple calibrated corner points located within the vicinity of the initial center position from the set of corner coordinates to construct a candidate corner point set; for any calibrated corner point in the candidate set, determining its row direction deviation and column direction deviation; determining the deviation value of the calibrated corner point based on the row and column direction deviations; and finally, identifying the calibrated corner point with the smallest deviation value from the candidate set as the target corner point.
[0009] One possible implementation involves determining the row direction deviation value of the calibration corner point in the row direction and the column direction deviation value of the calibration corner point in the column direction. This includes: for any target direction deviation value among the row direction deviation value and the column direction deviation value, determining the target position of the calibration corner point in the corner point coordinate set. Based on the distance between the target position and the direction edge of the corner point coordinate set, determining the computable range of the deviation value. Within the computable range, calculating a first distance between the calibration corner point and a first preset calibration corner point in the target direction, and a second distance between the calibration corner point and a second preset calibration corner point in the target direction. Calculating the absolute value of the difference between the first distance and the second distance. Summing multiple absolute values yields the target direction deviation value.
[0010] One possible implementation is to sum multiple absolute values to obtain the target direction deviation value when the target direction deviation value is the row direction deviation value, including:
[0011]
[0012] in, The range of values is . This represents the line direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the row direction. The coordinates of the second calibrated corner point in the row direction are given.
[0013] When the target direction deviation value is the column direction deviation value, multiple absolute values are summed to obtain the target direction deviation value, including:
[0014]
[0015] The range of values for num2 is: . This represents the column direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the column direction. The coordinates of the second calibrated corner point in the column direction are given.
[0016] One possible implementation involves filtering candidate corner points that meet preset distance constraints from a set of corner point coordinates, based on the standard distance pixel values between adjacent calibrated corner points in the calibration image. This includes: for any calibrated corner point in the coordinate set, determining a first distance and a second distance between the calibrated corner point and two adjacent calibrated corner points in the row direction, as well as a third distance and a fourth distance between the calibrated corner point and two adjacent calibrated corner points in the column direction. The first, second, third, and fourth distances are then compared with the standard distance pixel values. When the differences between the first, second, third, and fourth distances and the standard distance pixel values are within a preset error range of the preset distance constraints, the calibrated corner point is determined as a candidate corner point.
[0017] One possible implementation involves determining the distortion center of the camera based on a target corner point and multiple neighboring corner points within its neighborhood. This includes: selecting multiple corner points within a preset neighborhood of the target corner point from a set of corner point coordinates; filtering out valid corner points that satisfy preset distance constraints from the selected corner points; and determining the distortion center of the camera based on the pixel coordinates of each valid corner point.
[0018] One possible implementation involves determining the distortion center of the camera based on the pixel coordinates of each valid corner point, including: accumulating the x-coordinates of each valid corner point to obtain an accumulated x-coordinate value; accumulating the y-coordinates of each valid corner point to obtain an accumulated y-coordinate value; dividing the accumulated x-coordinate value by the total number of valid corner points to obtain the x-coordinate of the distortion center; and dividing the accumulated y-coordinate value by the total number of valid corner points to obtain the y-coordinate of the distortion center.
[0019] One possible implementation method further includes: performing distortion correction processing on the calibration image based on the distortion center to obtain a corrected image; extracting the pixel coordinates of each calibration corner point in the corrected image and calculating the actual pixel distance between adjacent calibration corner points; and evaluating the accuracy of the distortion center based on the deviation between the actual pixel distance and the standard spacing pixel value.
[0020] One possible implementation involves calculating the preliminary center position of the calibrated image based on the pixel coordinates of each candidate corner point, including: accumulating the abscissas of the pixel coordinates of each candidate corner point to obtain an accumulated abscissa value; accumulating the ordinates of the pixel coordinates of each candidate corner point to obtain an accumulated ordinate value; dividing the accumulated abscissa value by the number of candidate corner points to obtain the abscissa of the preliminary center position; and dividing the accumulated ordinate value by the number of candidate corner points to obtain the ordinate of the preliminary center position.
[0021] Secondly, embodiments of this application provide a device for determining the distortion center of a camera, the device comprising:
[0022] The extraction module is used to extract the pixel coordinates of each calibration corner point in the calibrated image under the distortion state and construct a corner point coordinate set.
[0023] The filtering module is used to filter candidate corner points that meet preset distance constraints from the set of corner point coordinates based on the standard distance pixel values between adjacent calibrated corner points in the calibration image.
[0024] The calculation module is used to calculate the preliminary center position of the calibration image based on the pixel coordinates of each candidate corner point.
[0025] The filtering module is also used to filter target corner points from the set of corner point coordinates based on the preliminary center position. The target corner point is the reference corner point used to determine the distortion center.
[0026] The determination module is used to determine the distortion center of the camera based on the target corner point and multiple adjacent corner points within the neighborhood of the target corner point.
[0027] One possible implementation involves selecting target corner points from a set of corner coordinates based on the initial center position. This includes: selecting multiple calibrated corner points located within the vicinity of the initial center position from the set of corner coordinates to construct a candidate corner point set; for any calibrated corner point in the candidate set, determining its row direction deviation and column direction deviation; determining the deviation value of the calibrated corner point based on the row and column direction deviations; and finally, identifying the calibrated corner point with the smallest deviation value from the candidate set as the target corner point.
[0028] One possible implementation involves a determination module, specifically used to determine the target position of the calibration corner point within the corner point coordinate set for any target direction deviation value, either row or column. Based on the distance between the target position and the directional edge of the corner point coordinate set, the computable range of the deviation value is determined. Within this computable range, a first distance is calculated between the calibration corner point and a first preset calibration corner point in the target direction, and a second distance is calculated between the calibration corner point and a second preset calibration corner point in the target direction. The absolute value of the difference between the first and second distances is calculated. Multiple absolute values are then summed to obtain the target direction deviation value.
[0029] One possible implementation involves defining a module, specifically for...
[0030]
[0031] in, The range of values is . This represents the line direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the row direction. The coordinates of the second calibrated corner point in the row direction are given.
[0032] When the target direction deviation value is the column direction deviation value, multiple absolute values are summed to obtain the target direction deviation value, including:
[0033]
[0034] The range of values for num2 is: . This represents the column direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the column direction. The coordinates of the second calibrated corner point in the column direction are given.
[0035] One possible implementation involves a filtering module that, for any calibrated corner point in the corner coordinate set, determines a first distance and a second distance between the calibrated corner point and two adjacent calibrated corner points in the row direction, as well as a third distance and a fourth distance between the calibrated corner point and two adjacent calibrated corner points in the column direction. The first, second, third, and fourth distances are then compared with standard spacing pixel values. When the differences between the first, second, third, and fourth distances and the standard spacing pixel values are within a preset error range of preset distance constraints, the calibrated corner point is determined as a candidate corner point.
[0036] One possible implementation involves a determination module, specifically used to select multiple corner points located within a preset neighborhood around the target corner point from the set of corner point coordinates. From the selected multiple corner points, valid corner points that satisfy preset distance constraints are selected. Based on the pixel coordinates of each valid corner point, the distortion center of the camera is determined.
[0037] One possible implementation involves defining a module that accumulates the x-coordinates of each valid corner point to obtain an accumulated effective x-coordinate value. It then accumulates the y-coordinates of each valid corner point to obtain an accumulated effective y-coordinate value. Finally, it divides the accumulated effective x-coordinate value by the total number of valid corner points to obtain the x-coordinate of the distortion center. Finally, it divides the accumulated effective y-coordinate value by the total number of valid corner points to obtain the y-coordinate of the distortion center.
[0038] In one possible implementation, the device is further used to: perform distortion correction processing on the calibration image based on the distortion center to obtain a corrected image; extract the pixel coordinates of each calibration corner point in the corrected image and calculate the actual pixel distance between adjacent calibration corner points; and evaluate the accuracy of the distortion center based on the deviation between the actual pixel distance and the standard spacing pixel value.
[0039] One possible implementation involves a calculation module that accumulates the x-coordinates of the pixel coordinates of each candidate corner point to obtain an accumulated x-coordinate value. It then accumulates the y-coordinates of the pixel coordinates of each candidate corner point to obtain an accumulated y-coordinate value. Finally, it divides the accumulated x-coordinate value by the number of candidate corner points to obtain the initial x-coordinate of the center position.
[0040] Thirdly, embodiments of this application provide a device for determining the center of camera distortion. This device has the function of implementing the method for determining the center of camera distortion according to the first aspect or any possible implementation thereof. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0041] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, enable the computer to perform the method for determining the camera distortion center as described in the first aspect or any possible implementation thereof.
[0042] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer, enable the computer to execute the method for determining the camera distortion center described in the first aspect or any possible implementation thereof.
[0043] The technical effects of any of the design methods in aspects two through five can be found in aspect one or in different possible implementations of aspect one, and will not be repeated here. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0045] Figure 1 A system structure diagram of an industrial focusing system provided in this application embodiment;
[0046] Figure 2 A flowchart illustrating a method for determining the distortion center of a camera, as provided in this application embodiment;
[0047] Figure 3 A schematic diagram of a device for determining the distortion center of a camera provided in an embodiment of this application;
[0048] Figure 4 This is a system architecture diagram of a camera distortion center determination system provided in an embodiment of this application. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0050] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0051] Traditional distortion correction methods typically employ two approaches to determine the distortion center: one is to directly assume the image center as the distortion center and use this assumption for subsequent correction calculations; the other is to use traditional camera calibration techniques such as the Zhang Zhengyou calibration method, employing multiple calibration board images in different poses to solve for the distortion center parameters in the camera intrinsic parameter matrix.
[0052] However, this method has the following shortcomings: directly assuming the image center as the distortion center ignores the center offset caused by actual assembly errors, and cannot ensure the accuracy of the distortion center position, thus affecting the quality of subsequent image correction. While Zhang Zhengyou's calibration method can fit the distortion center parameters from multiple calibration images, this method requires acquiring multiple calibration board images in different poses, making the calibration process complex and time-consuming. Furthermore, the calibration algorithm is prone to getting trapped in local optima during parameter fitting, causing the obtained distortion center to deviate from the true value, which also affects the accuracy of distortion correction.
[0053] Based on this, embodiments of this application provide a method and apparatus for determining the distortion center of a camera. The method includes: extracting the pixel coordinates of each calibration corner point in a calibration image under distortion conditions, and constructing a corner point coordinate set. Based on the standard distance pixel values between adjacent calibration corner points in the calibration image, candidate corner points that meet preset distance constraints are selected from the corner point coordinate set. A preliminary center position of the calibration image is calculated based on the pixel coordinates of each candidate corner point. A target corner point is selected from the corner point coordinate set based on the preliminary center position. The target corner point is the reference corner point used to determine the distortion center. The distortion center of the camera is determined based on the target corner point and multiple adjacent corner points within its neighborhood.
[0054] The method for determining the distortion center of a camera provided in this application, based on the standard distance pixel value between adjacent corner points in a calibrated image, filters candidate corner points that meet preset distance constraints from all corner points in the image and calculates the preliminary center position. This achieves a global and unbiased estimation of the distortion center, avoiding the positional deviation problem caused by directly assuming the image center as the distortion center in traditional methods. Furthermore, it further filters target corner points from the set of corner point coordinates, and finally determines the distortion center based on the target corner point and multiple adjacent corner points within its neighborhood. This multi-level filtering mechanism, from coarse to fine, effectively eliminates corner points far from the distortion center. This method significantly improves the accuracy of distortion center detection by reducing interference with the calculation results. Furthermore, it only requires acquiring one calibration plate distortion image to complete the detection, eliminating the need for multiple calibration images in different poses or complex parameter fitting iterations. This effectively avoids the result deviation problem caused by the calibration algorithm getting stuck in local optima due to parameter fitting. While simplifying the operation process and improving detection efficiency, it can adapt to the distortion center detection needs under different lenses, cameras, and calibration plates, exhibiting strong versatility and engineering adaptability. It provides a precise benchmark reference point for subsequent image distortion correction, thereby improving the effect of distortion correction processing.
[0055] The methods provided in the embodiments of this application will now be described in conjunction with the specific accompanying drawings.
[0056] On the one hand, embodiments of this application provide an industrial focusing system. For example... Figure 1 As shown, the industrial focusing system 100 may include: a support platform 101, an industrial camera 102, an optical lens 103, and an image processing unit 104.
[0057] The support platform 101 supports a calibration plate, the surface of which is provided with an array of calibration patterns, such as a checkerboard pattern or a dot array pattern, to provide a standard reference for calibrating the camera distortion center. The support platform 101 can move along the X and Y axes to adjust the relative position between the calibration plate and the industrial camera. At the same time, the support platform can be raised and lowered along the Z axis to simulate imaging scenarios at different working distances.
[0058] An industrial camera 102 is fixedly mounted above a support platform 101, with its imaging surface parallel to the platform surface. The industrial camera 102 integrates an image sensor for acquiring raw image data from the calibration board. An optical lens 103 is mounted at the front of the industrial camera 102 and fixedly connected to the camera body via a bayonet or thread, used to focus and project the optical image of the calibration board onto the image sensor surface of the industrial camera 102. Due to lens assembly errors and optical characteristics, there is often an offset between the optical axis of the optical lens 103 and the center of the image sensor of the industrial camera 102, resulting in geometric distortion in the acquired image.
[0059] The image processing unit 104 is electrically connected to the industrial camera 102 and is used to receive the distorted image of the calibration board acquired by the industrial camera 102, and execute the camera distortion center determination method provided in this application embodiment. Specifically, the image processing unit 104 first extracts the pixel coordinates of each calibration corner point in the distorted image and constructs a corner point coordinate set. Then, based on the physical size of the calibration board, the magnification of the optical lens 103, and the pixel physical size of the industrial camera 102, it calculates the standard distance pixel value between adjacent calibration corner points. Next, it filters out candidate corner points that meet the preset distance constraint conditions from the corner point coordinate set and calculates the preliminary center position. Then, based on the preliminary center position, it filters out the target corner point from the corner point coordinate set. Finally, it determines the distortion center of the optical lens 103 relative to the industrial camera 102 based on the target corner point and multiple adjacent corner points within its neighborhood.
[0060] The image processing unit 104 stores the calculated distortion center as a reference parameter for subsequent image distortion correction in its local memory. When the industrial focusing system 100 is put into actual production inspection, the industrial camera 102 acquires the original image of the object to be inspected. The image processing unit 104 performs distortion correction processing on the original image based on the pre-calibrated distortion center to generate a corrected inspection image. Based on the corrected inspection image, it performs visual inspection tasks such as size measurement and defect identification, thereby improving inspection accuracy and reliability.
[0061] It should be noted that the above Figure 1 The industrial focusing system 100 shown is merely an example of the application scenario of the solution in this application, and is not intended to limit the application scenario of the solution in this application.
[0062] On the one hand, embodiments of this application provide a method for determining the distortion center of a camera, which can be achieved by... Figure 1 The industrial focusing system 100 shown is in operation. For example... Figure 2 As shown, the method may include the following steps.
[0063] S201, extract the pixel coordinates of each calibration corner point in the calibrated image under the distortion state, and construct the corner point coordinate set.
[0064] Specifically, the first step is to acquire a distorted image of the calibration board. This calibration board uses a checkerboard pattern with 44×44 corner points and an image resolution of 2448×2048 pixels. Due to optical lens distortion, the corner points, which were originally arranged in a straight line in the acquired checkerboard image, will appear bent and distorted, and the spacing between the corner points will no longer be uniform. This distorted image is the object of processing in this step.
[0065] To improve the accuracy of corner detection, the distorted image is first converted to grayscale, eliminating the interference of color information on edge detection. Then, the Harris corner detection algorithm or the `findChessboardCorners` function from the OpenCV vision library is used to extract corners from the grayscale image, initially obtaining the pixel coordinates of each corner.
[0066] Since the initially extracted corner coordinates may contain sub-pixel level positioning errors, this embodiment further employs the cornerSubPix function in OpenCV to refine the corner coordinates at the sub-pixel level. This function, based on the grayscale gradient information of the corner's neighborhood, uses an iterative optimization algorithm to fine-tune the corner position, achieving sub-pixel level accuracy in the detected corner coordinates, thereby improving the accuracy of subsequent calculations.
[0067] After refinement, the image processing unit stores the pixel coordinates of each calibrated corner point into a two-dimensional array `points` according to its actual row and column order in the checkerboard grid. For a corner point located in the i-th row and j-th column, its pixel coordinates are: The values of i and j are all within the range of For the coordinates of each calibrated corner point... ,in If the pixel coordinates of the image are denoted as , then is .
[0068]
[0069] , This represents the pixel coordinates of the image.
[0070] S202, based on the standard distance pixel value between adjacent calibrated corner points in the calibration image, select candidate corner points that meet the preset distance constraints from the set of corner point coordinates.
[0071] Before corner point screening, it is necessary to pre-calculate the standard distance pixel value between adjacent calibrated corner points in the calibration image under distortion-free conditions. This standard distance pixel value reflects the pixel distance that should exist between adjacent corner points in the checkerboard pattern under ideal imaging conditions. It is not affected by image scaling or distortion caused by lens distortion, and therefore can serve as an objective benchmark for determining whether a corner point is located near the distortion center.
[0072] Specifically, the standard pixel spacing N is calculated based on the device parameters of the shooting platform. For example, the magnification of the optical lens is... The pixel size of the CMOS sensor in an industrial camera is (Unit: micrometers), the actual physical distance between adjacent corner points in the calibration plate is... (Unit: micrometers), then the formula for calculating the standard pixel spacing value N is:
[0073]
[0074] In the absence of distortion, the distance between any two adjacent corner points in the chessboard should be 40 pixels.
[0075] One possible implementation involves filtering candidate corner points that meet preset distance constraints from a set of corner point coordinates, based on the standard distance pixel values between adjacent calibrated corner points in the calibration image. This includes: for any calibrated corner point in the coordinate set, determining a first distance and a second distance between the calibrated corner point and two adjacent calibrated corner points in the row direction, as well as a third distance and a fourth distance between the calibrated corner point and two adjacent calibrated corner points in the column direction. The first, second, third, and fourth distances are then compared with the standard distance pixel values. When the differences between the first, second, third, and fourth distances and the standard distance pixel values are within a preset error range of the preset distance constraints, the calibrated corner point is determined as a candidate corner point.
[0076] Specifically, after obtaining the standard spacing pixel value N, the image processing unit traverses each calibrated corner point in the corner coordinate set and determines whether it meets the preset distance constraint condition. The preset distance constraint condition means that the distance between the current corner point and its adjacent corner points in the four directions (up, down, left, and right) should all be within a preset error range centered on the standard spacing pixel value.
[0077] Considering the potential sub-pixel level positioning errors during corner extraction, and the possibility that the current corner may not be precisely located at the distortion center, resulting in slight distortion deviations, this embodiment sets the preset error range to the standard spacing pixel value N plus or minus 0.5 pixels, i.e., the lower threshold thb = N - 0.5, and the upper threshold tht = N + 0.5. This error range setting can tolerate reasonable detection errors while effectively excluding areas with significant distortion.
[0078] For any calibrated corner point in the corner coordinate set Calculate the Euclidean distances between it and its four adjacent corner points in each direction:
[0079] Calibration Corner Point Adjacent corner to the left The first distance between them, dist1, is
[0080]
[0081] Calibration Corner Point Adjacent corner to the right The second distance between them, dist2, is
[0082]
[0083] Calibration Corner Point Adjacent corners to the top The third distance between them, dist3, is
[0084]
[0085] Calibration Corner Point Adjacent corners to the bottom The fourth distance between them is dist4.
[0086]
[0087] After calculating the above four distance values, the first distance dist1, the second distance dist2, the third distance dist3 and the fourth distance dist4 are compared with the standard spacing pixel value N to determine whether these distance values are all within the preset error range. .
[0088] When all four conditions are met, it indicates that the distances between the current corner point and its four adjacent corner points (up, down, left, and right) are close to the standard pixel spacing value. This means that the distortion degree in the area where the corner point is located is small, conforming to the geometric characteristics of a region near the distortion center. At this time, the image processing unit determines the calibrated corner point as a candidate corner point and records its pixel coordinates.
[0089] If any condition is not met, it indicates that the distance between the current corner point and its adjacent corner points in at least one direction deviates too much from the standard spacing pixel value, meaning that there is significant distortion in the region where the corner point is located, and it does not meet the characteristics of being located near the distortion center. In this case, the calibrated corner point is not included in the candidate corner point list.
[0090] Through the above screening process, the image processing unit selects candidate corner points from all 44×44 corner points that meet the preset distance constraints. These candidate corner points form a subset of corner points close to the distortion center, which is used for subsequent preliminary center position calculation, thereby effectively eliminating the interference of corner points far from the distortion center on center positioning.
[0091] S203, calculate the preliminary center position of the calibration image based on the pixel coordinates of each candidate corner point.
[0092] Specifically, a preliminary center location is calculated using statistical averaging, serving as the first approximate estimate of the distortion center. Since the candidate corner points are all located in the vicinity of the distortion center, the average value of their coordinates can reflect the approximate location of the distortion center quite well.
[0093] One possible implementation involves calculating the preliminary center position of the calibrated image based on the pixel coordinates of each candidate corner point, including: accumulating the abscissas of the pixel coordinates of each candidate corner point to obtain an accumulated abscissa value; accumulating the ordinates of the pixel coordinates of each candidate corner point to obtain an accumulated ordinate value; dividing the accumulated abscissa value by the number of candidate corner points to obtain the abscissa of the preliminary center position; and dividing the accumulated ordinate value by the number of candidate corner points to obtain the ordinate of the preliminary center position.
[0094] Specifically, after obtaining all candidate corner points that meet the preset distance constraints, statistical analysis is performed on the pixel coordinates of these candidate corner points. First, the x-coordinates of all candidate corner points are summed to obtain the summed x-coordinate value. :
[0095]
[0096] At the same time, the ordinates of all candidate corner points are summed to obtain the summed ordinate value. :
[0097]
[0098] During the accumulation process, the number n of candidate corner points is recorded simultaneously. This number n is the total number of corner points participating in the accumulation operation.
[0099]
[0100] Obtain the cumulative value of the horizontal axis and the cumulative value of the vertical axis Then, divide each x-coordinate by the number of candidate corner points n to obtain the initial x-coordinate of the center position. and ordinate :
[0101]
[0102] S204: Select target corner points from the set of corner point coordinates based on the preliminary center position. The target corner points are the reference corner points used to determine the distortion center.
[0103] One possible implementation involves selecting target corner points from a set of corner coordinates based on the initial center position. This includes: selecting multiple calibrated corner points located within the vicinity of the initial center position from the set of corner coordinates to construct a candidate corner point set; for any calibrated corner point in the candidate set, determining its row direction deviation and column direction deviation; determining the deviation value of the calibrated corner point based on the row and column direction deviations; and finally, identifying the calibrated corner point with the smallest deviation value from the candidate set as the target corner point.
[0104] Further, the steps of determining the row direction deviation value of the calibration corner point in the row direction and the column direction deviation value of the calibration corner point in the column direction may include: determining the target position of the calibration corner point in the corner point coordinate set for any target direction deviation value among the row direction deviation value and the column direction deviation value; determining the calculable range of the deviation value based on the distance between the target position and the direction edge of the corner point coordinate set; calculating a first distance between the calibration corner point and a first preset calibration corner point in the target direction, and a second distance between the calibration corner point and a second preset calibration corner point in the target direction, within the calculable range; calculating the absolute value of the difference between the first distance and the second distance; and summing the multiple absolute values to obtain the target direction deviation value.
[0105] The step of summing multiple absolute values to obtain the target direction deviation value when the target direction deviation value is the row direction deviation value may include:
[0106]
[0107] in, The range of values is . This represents the line direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the row direction. The coordinates of the second calibrated corner point in the row direction are given.
[0108] When the target direction deviation value is the column direction deviation value, multiple absolute values are summed to obtain the target direction deviation value, including:
[0109]
[0110] The range of values for num2 is: . This represents the column direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the column direction. The coordinates of the second calibrated corner point in the column direction are given.
[0111] Specifically, firstly, based on the preliminary center location From the set of corner coordinates, multiple calibrated corner points located in the vicinity of the initial center position are selected to construct a candidate corner point set. Specifically, the row and column indices of the corner points closest to the initial center position, as determined in S203, are used. A predetermined neighborhood is defined centered on this area. In this embodiment, the neighborhood is set to... The 3×3 neighborhood centered on the row index is [ -3, +3], the column index range is [ -3, All corner points within [+3]. These corner points are used as candidate corner points to construct a candidate corner point set. ,in and These represent the row index and column index of the candidate corner point in the corner point coordinate set, respectively.
[0112] Then, for each calibrated corner point in the candidate corner point set, the image processing unit calculates its row direction deviation value and column direction deviation value. These two deviation values are used to measure the degree of symmetry of the corner point in the row and column directions.
[0113] For any calibrated corner point in the candidate corner point set The calculation method for its line direction deviation value bisa1 is as follows:
[0114] Based on the row index of the calibrated corner point in the corner point coordinate set The computable range num1 is determined by considering the row direction edges of the corner coordinate set (i.e., the minimum and maximum row indices of 1 and 44). The value of num1 must satisfy... This means ensuring that when performing symmetrical distance calculations, both the selected upper and lower corner points exist within the corner point coordinate set.
[0115] Within the computable range num1, for each l from 1 to num1, calculate the calibration corner point and its l-th corner point above the row direction. , The distance between them, and the l-th corner point below it in the direction of the row ( , The distance between these two distances is calculated. The absolute value of the difference between these two distances is then summed for all values of l to obtain the row direction deviation value bisa1.
[0116]
[0117] Similarly, the column direction deviation value bisa2 is calculated as follows:
[0118] Based on the column index of the calibrated corner point in the corner point coordinate set. The column direction edges of the corner coordinate set are used to determine the computable range num2. The value of num2 needs to satisfy... .
[0119] Within the computable range num2, for each l from 1 to num2, calculate the calibration corner point and its leftmost corner point in the column direction (...). , The distance between them, and the l-th corner point to the right of its column direction ( , The distance between these two distances is calculated. The absolute value of the difference between these two distances is then summed for all values of l to obtain the column direction deviation value bisa2.
[0120]
[0121] After obtaining the row direction deviation value bisa1 and the column direction deviation value bisa2, the comprehensive deviation metric for the calibrated corner point is determined based on these two deviation values. Since the computable ranges num1 and num2 corresponding to different candidate corner points may differ, directly comparing the magnitudes of the deviation values would be affected by the number of calculations. Therefore, this embodiment uses the mean deviation as the comprehensive deviation metric, which is calculated by summing the row direction deviation value and the column direction deviation value and dividing by the corresponding total number of calculations.
[0122]
[0123] The mean deviation reflects the average symmetry deviation of the corner point in the row and column directions. The smaller the mean deviation, the closer the corner points on the left and right sides and the top and bottom sides are to each other, meaning the corner point is closer to the distortion center.
[0124] The above calculation is performed on each calibrated corner point in the candidate corner point set to obtain the mean deviation for each corner point. Then, all candidate corner points are traversed, and the corner point with the smallest mean deviation is identified as the target corner point. Its row and column indices in the corner point coordinate set are recorded as ( The target corner point is the corner point that is closest to the true distortion center among all corner points, and will be used as the reference position for subsequent calculation of the final distortion center.
[0125] S205, based on the target corner point and multiple adjacent corner points within the neighborhood of the target corner point, determine the distortion center of the camera.
[0126] Specifically, based on the target corner point selected by S204, multiple adjacent corner points are selected in its surrounding neighborhood, and the final distortion center is calculated by statistical averaging. Since the target corner point itself is the corner point closest to the true distortion center, the degree of distortion in the local area centered on it is relatively small, and the geometric relationship between the corner points is closer to the ideal state. Therefore, the distortion center coordinates can be obtained more accurately than the initial center position based on the average position of multiple corner points in this area.
[0127] One possible implementation involves determining the distortion center of the camera based on a target corner point and multiple neighboring corner points within its neighborhood. This includes: selecting multiple corner points within a preset neighborhood of the target corner point from a set of corner point coordinates; filtering out valid corner points that satisfy preset distance constraints from the selected corner points; and determining the distortion center of the camera based on the pixel coordinates of each valid corner point.
[0128] Furthermore, the step of determining the distortion center of the camera based on the pixel coordinates of each effective corner point may include: accumulating the abscissas of each effective corner point to obtain an accumulated abscissa value; accumulating the ordinates of each effective corner point to obtain an accumulated ordinate value; dividing the accumulated abscissa value by the total number of effective corner points to obtain the abscissa of the distortion center; and dividing the accumulated ordinate value by the total number of effective corner points to obtain the ordinate of the distortion center.
[0129] Specifically, multiple corner points located within a preset neighborhood around the target corner point are selected from the corner point coordinate set. This is based on the row and column indices of the target corner point determined in S204. A preset neighborhood is defined centered on ( ). In this embodiment, the neighborhood is set to be centered on ( ). The 5×5 neighborhood centered on ) represents the row index range of [ -5, +5], the column index range is [ -5, All corner points within [+5]. These corner points will be used as candidate reference points for subsequent filtering and calculations.
[0130] Next, valid corner points that meet the preset distance constraints are selected from the chosen multiple corner points. Similar to the selection principle in S202, this step also filters corner points within the neighborhood based on the standard spacing pixel value N and the preset error range [thb, tht]. For each corner point within a 5×5 neighborhood ( , ), calculate the distances dist1, dist2, dist3, and dist4 between it and the adjacent corner points on the left, right, top, and bottom sides, respectively.
[0131]
[0132]
[0133]
[0134]
[0135] Then, it is further determined whether all of these four distances satisfy the condition of thb < dist < tht. When all four conditions are satisfied simultaneously, this corner point is determined as a valid corner point, and its pixel coordinates are recorded; otherwise, this corner point is regarded as a corner point greatly affected by distortion and does not participate in the final center calculation.
[0136] During the screening process, the coordinate values of each valid corner point and the flag indicating whether this corner point is valid are recorded simultaneously. Specifically, for each corner point within the 5×5 neighborhood, its valid abscissa , valid ordinate and valid flag are set as follows:
[0137]
[0138]
[0139]
[0140] After obtaining the coordinate values and flags of all valid corner points, the image processing unit determines the distortion center of the camera according to the pixel coordinates of each valid corner point. Specifically, the valid abscissas of all valid corner points within the 5×5 neighborhood are accumulated to obtain the accumulated value of valid abscissas; the valid ordinates of all valid corner points are accumulated to obtain the accumulated value of valid ordinates; the valid flags of all valid corner points are accumulated to obtain the total number of valid corner points. Then, the accumulated value of valid abscissas and the accumulated value of valid ordinates are respectively divided by the total number of valid corner points to obtain the final distortion center coordinates ( , ). The distortion center coordinates can be determined by the following formula.
[0141]
[0142] Through the above calculations, the finally obtained distortion center ( , ) is obtained based on the average positions of multiple valid corner points within the neighborhood around the target corner point. Compared with the preliminary center position ( , ), this final distortion center has higher precision because it is the result of further fine calculations within the local area based on the preliminary positioning. This distortion center will be used as the core reference parameter for subsequent image distortion correction processing, for establishing a distortion model, calculating distortion coefficients, and finally generating a corrected image.
[0143] Furthermore, distortion correction is performed on the calibration image based on the distortion center to obtain the corrected image. The pixel coordinates of each calibration corner point in the corrected image are extracted, and the actual pixel distance between adjacent calibration corner points is calculated. The accuracy of the distortion center is evaluated based on the deviation between the actual pixel distance and the standard spacing pixel value.
[0144] Specifically, the corner positions of the original distorted image extracted in S201 and the coordinates of the distortion center calculated in S205 are obtained. , Based on the distortion center, the theoretical positions of each corner point in an ideal distortion-free state are extracted according to the actual pixel coordinate transformation relationship. Specifically, according to the principle of distortion center diffusion, the radius distance of any pixel point in the image from the distortion center determines the degree of distortion experienced by that point. By establishing a distortion model, a mapping relationship between the actual corner point positions and the theoretical corner point positions can be established.
[0145] After establishing a one-to-one correspondence between actual and theoretical corner point positions, corner points at the same radius distance are grouped into the same set. For each set of corner points at a given radius distance, the corresponding functional relationship between the actual and theoretical corner point positions is calculated, i.e., mapping parameters between corner point coordinates and actual coordinates are established. Subsequently, the functional parameters corresponding to different radius distances are integrated, and a cubic or higher-order polynomial function is used to fit the distortion parameters to obtain the final distortion correction parameters.
[0146] After obtaining the distortion correction parameters, the original distorted image is processed pixel by pixel. A blank image of the same size as the original image is created to store the corrected image result. For each pixel location in the blank image, the distance from that location to the distortion center is first calculated. , The radius distance is calculated, and then the corresponding mapping relationship is obtained based on the fitted distortion correction parameters. The coordinate position of the pixel in the original distorted image is then calculated. Since the calculated mapping coordinates are usually floating-point numbers and cannot be directly mapped to integer pixel positions, bilinear interpolation is used to sample the original image, and the interpolated pixel value is filled into the current pixel position. After traversing all pixels of the blank image, the distortion-corrected image is obtained.
[0147] After obtaining the corrected image, the same method as in S201 is used to re-extract the pixel coordinates of each calibrated corner point in the corrected image. Specifically, the corrected image is converted to grayscale, and the corner points are extracted using the Harris corner detection algorithm or the findChessboardCorners function in OpenCV. The cornerSubPix function is then used to refine the corner point coordinates at the sub-pixel level to obtain the precise pixel coordinates of each corrected corner point.
[0148] Based on the corrected corner coordinates, the actual pixel distance between all adjacent calibrated corner points is calculated. For each pair of adjacent corner points in the checkerboard, their Euclidean distance is calculated and denoted as . , where i and j represent the corner point indexes corresponding to this distance. Since the corrected image should theoretically be close to a distortion-free state, the distances between all adjacent corner points should tend to be consistent, that is, close to the standard spacing pixel value N.
[0149] To quantify the correction effect and the accuracy of distortion center detection, the image processing unit calculates the average deviation between the actual distance of all adjacent corner points and the standard spacing pixel value. Let m be the total number of adjacent corner point spacings in the corrected image, then the formula for calculating the average deviation disN is:
[0150]
[0151] in, This represents the actual pixel distance between adjacent corner point pairs with corner point indices (i, j), where N is the standard spacing pixel value. This average deviation reflects the overall degree of deviation between the corner point distances in the corrected image and the ideal value.
[0152] When the average deviation disN is less than 0.1 pixels, it indicates that the final obtained distortion center is accurate and effective. Distortion correction processing based on this distortion center can restore the image to a near-distortion-free state. If disN is greater than or equal to 0.1 pixels, it suggests that the distortion center detection result may be biased, and the shooting parameters or corner point extraction process need to be rechecked.
[0153] The above primarily describes the solutions provided in this application from the perspective of the device's working principle. It is understood that the device for determining the camera distortion center includes corresponding hardware structures and / or software modules to perform each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, based on the algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0154] This application embodiment can divide the camera distortion center determination device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module.
[0155] It should be noted that the module division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. When dividing functional modules according to their respective functions, Figure 3 A schematic diagram of a possible configuration of the camera distortion center determination device involved in the above and embodiment examples is shown. Figure 3 As shown, the device 300 for determining the distortion center of the camera may include: an extraction module 301, a filtering module 302, a calculation module 303, and a determination module 304.
[0156] The extraction module 301 is used to support the execution of the camera distortion center determination device 300. Figure 2 S201 in the illustrated method for determining the center of camera distortion.
[0157] The filtering module 302 is used to support the execution of the camera distortion center determination device 300. Figure 2 S202 and S204 are illustrated in the method for determining the center of camera distortion.
[0158] Calculation module 303 is used to support the execution of the camera distortion center determination device 300. Figure 2 S203 in the illustrated method for determining the center of camera distortion.
[0159] Determination module 304 is used to support the execution of the camera distortion center determination device 300. Figure 2 S205 in the illustrated method for determining the center of camera distortion.
[0160] One possible implementation involves selecting target corner points from a set of corner coordinates based on the initial center position. This includes: selecting multiple calibrated corner points located within the vicinity of the initial center position from the set of corner coordinates to construct a candidate corner point set; for any calibrated corner point in the candidate set, determining its row direction deviation and column direction deviation; determining the deviation value of the calibrated corner point based on the row and column direction deviations; and finally, identifying the calibrated corner point with the smallest deviation value from the candidate set as the target corner point.
[0161] One possible implementation involves a determination module, specifically used to determine the target position of the calibration corner point within the corner point coordinate set for any target direction deviation value, either row or column. Based on the distance between the target position and the directional edge of the corner point coordinate set, the computable range of the deviation value is determined. Within this computable range, a first distance is calculated between the calibration corner point and a first preset calibration corner point in the target direction, and a second distance is calculated between the calibration corner point and a second preset calibration corner point in the target direction. The absolute value of the difference between the first and second distances is calculated. Multiple absolute values are then summed to obtain the target direction deviation value.
[0162] One possible implementation involves defining a module, specifically for...
[0163]
[0164] in, The range of values is . This represents the line direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the row direction. The coordinates of the second calibrated corner point in the row direction are given.
[0165] When the target direction deviation value is the column direction deviation value, multiple absolute values are summed to obtain the target direction deviation value, including:
[0166]
[0167] The range of values for num2 is: . This represents the column direction deviation value. The coordinates of the corner point are used to calibrate the corner point. The coordinates of the first calibrated corner point in the column direction. The coordinates of the second calibrated corner point in the column direction are given.
[0168] One possible implementation involves a filtering module that, for any calibrated corner point in the corner coordinate set, determines a first distance and a second distance between the calibrated corner point and two adjacent calibrated corner points in the row direction, as well as a third distance and a fourth distance between the calibrated corner point and two adjacent calibrated corner points in the column direction. The first, second, third, and fourth distances are then compared with standard spacing pixel values. When the differences between the first, second, third, and fourth distances and the standard spacing pixel values are within a preset error range of preset distance constraints, the calibrated corner point is determined as a candidate corner point.
[0169] One possible implementation involves a determination module, specifically used to select multiple corner points located within a preset neighborhood around the target corner point from the set of corner point coordinates. From the selected multiple corner points, valid corner points that satisfy preset distance constraints are selected. Based on the pixel coordinates of each valid corner point, the distortion center of the camera is determined.
[0170] One possible implementation involves defining a module that accumulates the x-coordinates of each valid corner point to obtain an accumulated effective x-coordinate value. It then accumulates the y-coordinates of each valid corner point to obtain an accumulated effective y-coordinate value. Finally, it divides the accumulated effective x-coordinate value by the total number of valid corner points to obtain the x-coordinate of the distortion center. Finally, it divides the accumulated effective y-coordinate value by the total number of valid corner points to obtain the y-coordinate of the distortion center.
[0171] In one possible implementation, the device is further used to: perform distortion correction processing on the calibration image based on the distortion center to obtain a corrected image; extract the pixel coordinates of each calibration corner point in the corrected image and calculate the actual pixel distance between adjacent calibration corner points; and evaluate the accuracy of the distortion center based on the deviation between the actual pixel distance and the standard spacing pixel value.
[0172] One possible implementation involves a calculation module that accumulates the x-coordinates of the pixel coordinates of each candidate corner point to obtain an accumulated x-coordinate value. It then accumulates the y-coordinates of the pixel coordinates of each candidate corner point to obtain an accumulated y-coordinate value. Finally, it divides the accumulated x-coordinate value by the number of candidate corner points to obtain the initial x-coordinate of the center position.
[0173] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0174] The camera distortion center determination device 300 provided in this application embodiment is used to perform the above-mentioned... Figure 2 The method shown for determining the distortion center of the camera can achieve the same effect as the method described above.
[0175] This application also provides a device for determining the distortion center of a camera, which can perform the method and related steps for determining the distortion center of a camera in the above method embodiments.
[0176] This application also provides a computer-readable storage medium storing instructions thereon, which, when executed, perform the method and related steps for determining the camera distortion center in the above method embodiments.
[0177] This application also provides a computer program product that, when run on a computer, causes the computer to execute the method and related steps for determining the camera distortion center in the above method embodiments.
[0178] In some embodiments, the methods shown in this application can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.
[0179] This application embodiment also provides a camera distortion center determination system 400, such as... Figure 4 As shown, the camera distortion center determination system 400 includes at least one processor 401 and at least one interface circuit 402.
[0180] As an example, when the camera distortion center determination system 400 includes a processor and an interface circuit, the processor can be... Figure 4 The processor 401 shown in the solid box (or the processor 401 shown in the dashed box) can be an interface circuit. Figure 4 The interface circuit 402 is shown in the solid box (or the dashed box). When the camera distortion center determination system 400 includes two processors and two interface circuits, then the two processors include... Figure 4 The processor 401 shown in the solid box and the processor 401 shown in the dashed box, these two interface circuits include Figure 4 Interface circuit 402 is shown in both solid and dashed boxes. No limitations are imposed on this.
[0181] Processor 401 and interface circuit 402 can be interconnected via a line. For example, interface circuit 402 can be used to receive signals. Alternatively, interface circuit 402 can be used to send signals to other devices (e.g., processor 401). For instance, interface circuit 402 can read computer instructions stored in memory and send those instructions to processor 401. Processor 401 executes the instructions and, in conjunction with input / output devices, implements the various steps in the above embodiments, such as implementing... Figure 2The methods illustrated are the steps performed in the embodiments shown. Of course, this system for determining the camera distortion center may also include other discrete components, and this application does not specifically limit this.
[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0183] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0184] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0185] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0186] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, in essence, or the part that contributes, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0187] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for determining the distortion center of a camera, characterized in that, The method includes: Extract the pixel coordinates of each calibration corner point in the calibrated image under the distortion state, and construct a corner point coordinate set; Based on the standard distance pixel value between adjacent calibrated corner points in the calibration image, candidate corner points that meet the preset distance constraint conditions are selected from the corner point coordinate set; The preliminary center position of the calibration image is calculated based on the pixel coordinates of each candidate corner point; Based on the preliminary center position, multiple calibration corner points located in the vicinity of the preliminary center position are selected from the corner point coordinate set to construct a candidate corner point set; for any calibration corner point in the candidate corner point set, the row direction deviation value of the calibration corner point in the row direction and the column direction deviation value of the calibration corner point in the column direction are determined; based on the row direction deviation value and the column direction deviation value, the deviation value of the calibration corner point is determined; the calibration corner point with the smallest deviation value in the candidate corner point set is determined as the target corner point; the target corner point is the reference corner point used to determine the distortion center; The distortion center of the camera is determined based on the target corner point and multiple adjacent corner points within the neighborhood of the target corner point.
2. The method according to claim 1, characterized in that, Determining the row direction deviation value of the calibration corner point in the row direction and the column direction deviation value of the calibration corner point in the column direction includes: For any target direction deviation value among the row direction deviation value and the column direction deviation value, determine the target position of the calibration corner point in the corner point coordinate set; The calculable range of the deviation value is determined based on the distance between the target position and the directional edge of the corner coordinate set; Within the calculable range, calculate the first distance between the calibration angle point and a first preset calibration angle point in the target direction, and the second distance between the calibration angle point and a second preset calibration angle point in the target direction; Calculate the absolute value of the difference between the first distance and the second distance; The target direction deviation value is obtained by summing up the multiple absolute values.
3. The method according to claim 2, characterized in that, When the target direction deviation value is the row direction deviation value, the step of accumulating multiple absolute values to obtain the target direction deviation value includes: in, The range of values is ; This is the row direction deviation value. The coordinates of the calibrated corner points; The coordinates of the first calibrated corner point in the row direction; The coordinates of the second calibrated corner point in the row direction; When the target direction deviation value is the column direction deviation value, the step of accumulating multiple absolute values to obtain the target direction deviation value includes: The range of values for num2 is: ; The column direction deviation value. The coordinates of the calibrated corner points; The coordinates of the first calibrated corner point along the column direction; The coordinates of the second calibrated corner point in the column direction are given.
4. The method according to claim 1, characterized in that, The step of selecting candidate corner points that meet preset distance constraints from the corner point coordinate set based on the standard distance pixel values between adjacent calibrated corner points in the calibrated image includes: For any calibrated corner point in the set of corner point coordinates, determine the first distance and the second distance between the calibrated corner point and two adjacent calibrated corner points in the row direction, as well as the third distance and the fourth distance between the calibrated corner point and two adjacent calibrated corner points in the column direction. The first distance, the second distance, the third distance, and the fourth distance are each compared with the standard spacing pixel value; When the difference between the first distance, the second distance, the third distance, and the fourth distance and the standard spacing pixel value is determined to be within the preset error range of the preset distance constraint, the calibrated corner point is determined as the candidate corner point.
5. The method according to claim 1, characterized in that, Determining the distortion center of the camera based on the target corner point and multiple adjacent corner points within the neighborhood of the target corner point includes: Multiple corner points located within a preset neighborhood around the target corner point are selected from the set of corner point coordinates; Select valid corner points that satisfy the preset distance constraint conditions from the selected multiple corner points; The distortion center of the camera is determined based on the pixel coordinates of each effective corner point.
6. The method according to claim 5, characterized in that, Determining the distortion center of the camera based on the pixel coordinates of each of the effective corner points includes: The x-coordinates of each of the effective corner points are summed to obtain the summed effective x-coordinates; The ordinates of each effective corner point are summed to obtain the summed effective ordinate values. Divide the accumulated effective x-coordinates by the total number of effective corner points to obtain the x-coordinate of the distortion center. The ordinate of the distortion center is obtained by dividing the accumulated effective ordinate by the total number of effective corner points.
7. The method according to claim 1, characterized in that, The method further includes: The calibration image is subjected to distortion correction processing based on the distortion center to obtain the corrected image; Extract the pixel coordinates of each calibrated corner point in the corrected image, and calculate the actual pixel distance between adjacent calibrated corner points; The accuracy of the distortion center is evaluated based on the deviation between the actual pixel distance and the standard spacing pixel value.
8. The method according to claim 1, characterized in that, The step of calculating the preliminary center position of the calibration image based on the pixel coordinates of each of the candidate corner points includes: The x-coordinates of the pixel coordinates of each candidate corner point are summed to obtain the summed x-coordinate value. The ordinates of the pixel coordinates of each candidate corner point are summed to obtain the summed ordinate value. The abscissa of the preliminary center position is obtained by dividing the accumulated abscissa value by the number of candidate corner points; The ordinate of the preliminary center position is obtained by dividing the accumulated value of the ordinate by the number of candidate corner points.
9. A device for determining the distortion center of a camera, characterized in that, The device includes: The extraction module is used to extract the pixel coordinates of each calibration corner point in the calibrated image under the distortion state and construct a corner point coordinate set; The filtering module is used to filter out candidate corner points that meet preset distance constraints from the set of corner point coordinates based on the standard distance pixel value between adjacent calibrated corner points in the calibration image. The calculation module is used to calculate the preliminary center position of the calibration image based on the pixel coordinates of each of the candidate corner points; The filtering module is further configured to: select multiple calibrated corner points located in the vicinity of the initial center position from the corner point coordinate set, based on the initial center position, to construct a candidate corner point set; for any calibrated corner point in the candidate corner point set, determine the row direction deviation value of the calibrated corner point in the row direction and the column direction deviation value of the calibrated corner point in the column direction; determine the deviation value of the calibrated corner point based on the row direction deviation value and the column direction deviation value; determine the calibrated corner point with the smallest deviation value in the candidate corner point set as the target corner point; the target corner point is the reference corner point used to determine the distortion center; The determination module is used to determine the distortion center of the camera based on the target corner point and multiple adjacent corner points located within the neighborhood of the target corner point.