Method, device and equipment for determining image distortion center

By processing the initial image and fitting the parabola to determine the image distortion center, the problem of the inability to accurately determine the distortion center in the prior art is solved, and the quality of image correction is improved.

CN120219472APending Publication Date: 2025-06-27KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510230356.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The prior art cannot accurately determine the image distortion center, which affects the correction quality of the image.

Method used

By processing the initial image, the center coordinates of the scattered spots are extracted and a plurality of parabolas are fitted, thereby determining the first target parabola and the second target parabola, and finally determining the distortion center of the image.

Benefits of technology

Improve the accuracy of the image distortion center and ensure the quality of image correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120219472A_ABST
    Figure CN120219472A_ABST
Patent Text Reader

Abstract

The invention provides a method, device and equipment for determining an image distortion center, and the method comprises the steps: processing an initial image, and obtaining a target image; acquiring center coordinates of all speckles in the target image, fitting a plurality of parabolas according to the center coordinates of the speckles, and determining a first target parabola and a second target parabola from the plurality of parabolas; determining a distortion center of the image according to the first target parabola and the second target parabola; therefore, if the image is distorted, each layer of speckle spots can be fitted into a parabola, and the opening of the parabola close to the distortion center is close to 0, so that the parabolas are fitted through the speckle spots, and the first target parabola and the second target parabola are found in the parabolas; the first target parabola comprises two parabolas with opposite openings in the vertical direction, and the second target parabola comprises two parabolas with opposite openings in the horizontal direction, so that the parabola closest to the distortion center is found in the vertical direction and the horizontal direction; and when the distortion center is determined according to the first target parabola and the second target parabola, the accuracy of the distortion center is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of optical technologies, and in particular, to a method, apparatus, and device for determining the center of image distortion. Background Art

[0002] Image distortion refers to the degree of distortion of the image formed by an optical system with respect to the object itself. It is an inherent characteristic of an optical lens, manifested as the shape of the image no longer maintaining the original geometric proportion, showing distortion or deformation. Distortion is usually divided into positive distortion (also known as pincushion distortion, as shown in Figure 1 shown) and negative distortion (also known as barrel distortion, as shown in Figure 2 shown).

[0003] Distortion correction usually involves performing a geometric transformation on the image to restore its original geometric shape. Therefore, when performing image distortion correction, it is necessary to accurately determine the position of the distortion center to ensure the correction quality of the image.

[0004] In the prior art, generally, the image center is directly assumed to be the distortion center, which cannot ensure the accuracy of the distortion center position, thus affecting the correction quality of the image. Summary of the Invention

[0005] In view of the problems existing in the prior art, embodiments of the present invention provide a method, apparatus, and device for determining the center of image distortion, so as to solve or partially solve the technical problem that the distortion center cannot be accurately determined in the prior art, thus affecting the correction quality of the image.

[0006] In a first aspect of the present invention, a method for determining the center of image distortion is provided, and the method includes:

[0007] Processing an initial image to obtain a target image; the initial image is an image captured of a target board when a measurement module projects scattered spots onto the target board, and there are multiple scattered spots in the target image;

[0008] Obtaining the center coordinates of all scattered spots in the target image, fitting a plurality of parabolas according to the center coordinates of the scattered spots, and determining a first target parabola and a second target parabola from the plurality of parabolas;

[0009] Determining the distortion center of the image according to the first target parabola and the second target parabola.

[0010] In the above solution, the processing of the initial image includes:

[0011] Converting the initial image into a grayscale image;

[0012] Performing binarization processing on the grayscale image to obtain a binarized image;

[0013] Perform erosion and dilation operations on the binarized image to obtain a dilated image;

[0014] Determine the areas of all the contours in the dilated image, remove the contours with contour areas greater than a preset area threshold, and obtain a target image.

[0015] In the above solution, when the parabola is a vertically oriented parabola, fitting multiple parabolas according to the center coordinates of the scatter spots includes:

[0016] Store the center coordinates of the scatter spots into a pre-created first sequence; traverse the first sequence, determine the scatter spot closest to the origin in the first sequence as the target scatter spot; magnify all the ordinate values in the first sequence by a preset multiple to obtain a second sequence; traverse the second sequence, and in each traversal, determine the scatter spot closest to the target scatter spot obtained after the previous traversal in the second sequence as the target scatter spot after the current traversal; after completing the traversal of the second sequence, obtain a first target group of scatter spots;

[0017] Repeat the above steps to obtain multiple first target groups of scatter spots, and use the least squares method to fit each first target group of scatter spots to obtain multiple first parabolas; where

[0018] The scatter spot sequence used in the current execution of the above steps is the sequence after removing the first target group of scatter spots obtained in the previous execution.

[0019] In the above solution, when the parabola is a horizontally oriented parabola, fitting multiple parabolas according to the center coordinates of the scatter spots includes:

[0020] Store the center coordinates of the scatter spots into a pre-created first sequence; traverse the first sequence, determine the scatter spot closest to the origin in the first sequence as the target scatter spot; magnify all the abscissa values in the first sequence by a preset multiple to obtain a third sequence; traverse the third sequence, and in each traversal, determine the scatter spot closest to the target scatter spot obtained after the previous traversal in the third sequence as the target scatter spot after the current traversal; after completing the traversal of the third sequence, obtain a second target group of scatter spots;

[0021] Repeat the above steps to obtain multiple second target groups of scatter spots, and use the least squares method to fit each second target group of scatter spots to obtain multiple second parabolas; where

[0022] The scatter spot sequence used in the current execution of the above steps is the sequence after removing the second target group of scatter spots obtained in the previous execution.

[0023] In the above solution, the parabola includes a first parabola and a second parabola; determining the first target parabola and the second target parabola from the multiple parabolas includes:

[0024] Obtain the first quadratic term coefficient in the function expression corresponding to each first parabola and the second quadratic term coefficient in the function expression corresponding to each second parabola;

[0025] Arrange each of the first quadratic term coefficients and the second quadratic term coefficients in a predetermined order to obtain a corresponding first quadratic term coefficient sequence and a second quadratic term coefficient sequence;

[0026] Find two first quadratic term coefficients with opposite signs from the first quadratic term coefficient queue, and determine the first parabola corresponding to the two first quadratic term coefficients with opposite signs as the first target parabola;

[0027] Find two second quadratic term coefficients with opposite signs from the second quadratic term coefficient queue, and determine the second parabola corresponding to the two second quadratic term coefficients with opposite signs as the second target parabola.

[0028] In the above solution, determining the distortion center of the image according to the first target parabola and the second target parabola includes:

[0029] Determine the two first parabolas included in the first target parabola, and obtain the first target quadratic term coefficient of the function expressions corresponding to the two first parabolas; determine the two second parabolas included in the second target parabola, and obtain the second target quadratic term coefficient of the function expressions corresponding to the two second parabolas;

[0030] Determine the abscissa of the distortion center according to the two first target quadratic term coefficients;

[0031] Determine the ordinate of the distortion center according to the two second target quadratic term coefficients.

[0032] In the above solution, determining the abscissa of the distortion center according to the two first quadratic term coefficients includes:

[0033] Determine the absolute values of the two first target quadratic term coefficients to obtain a first absolute value and a second absolute value;

[0034] Determine the abscissa adjustment coefficient of the distortion center according to the first absolute value and the second absolute value;

[0035] For the two first parabolas, determine the average value of the abscissas of all the scattered spots used to fit the first parabola to obtain a first average abscissa value and a second average abscissa value;

[0036] Determine the abscissa of the distortion center based on the abscissa adjustment coefficient, the first abscissa average value, and the second abscissa average value.

[0037] In the above solution, determining the ordinate of the distortion center according to the two second target quadratic coefficients includes:

[0038] Determine the absolute values of the two second target quadratic coefficients to obtain a third absolute value and a fourth absolute value;

[0039] Determine the ordinate adjustment coefficient of the distortion center according to the third absolute value and the fourth absolute value;

[0040] For the two second parabolas, determine the average value of the ordinates of all the scattered spots used to fit the second parabola to obtain a first ordinate average value and a second ordinate average value;

[0041] Determine the ordinate of the distortion center according to the ordinate adjustment coefficient, the first ordinate average value, and the second ordinate average value.

[0042] In the second aspect of the present invention, there is provided a device for determining the distortion center of an image, the device includes:

[0043] A processing unit for processing an initial image to obtain a target image; the initial image is an image of a target board taken when a test module projects scattered spots onto the target board, and there are multiple scattered spots in the target image;

[0044] A first determination unit for obtaining the center coordinates of all the scattered spots in the target image, fitting multiple parabolas according to the center coordinates of the scattered spots, and determining a first target parabola and a second target parabola from the multiple parabolas;

[0045] A second determination unit for determining the distortion center of the image according to the first target parabola and the second target parabola.

[0046] In the third aspect of the present invention, there is provided a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the steps of the method described in any item of the first aspect are implemented.

[0047] The present invention provides a method, device and equipment for determining the center of image distortion, the method comprising: processing an initial image to obtain a target image; the initial head portrait is an image of a target plate taken when a module to be tested projects scattered spots to the target plate, and the target image has multiple scattered spots; obtaining the center coordinates of all scattered spots in the target image, fitting multiple parabolas according to the center coordinates of the scattered spots, and determining a first target parabola and a second target parabola from the multiple parabolas; determining the distortion center of the image according to the first target parabola and the second target parabola; in this way, if the image is distorted , then each layer of scattered speckles can be fitted into a parabola, and the opening of the parabola close to the distortion center should be close to 0. Therefore, the present invention fits the scattered speckles into a parabola, and finds a first target parabola and a second target parabola in multiple parabolas. The first target parabola includes two parabolas with opposite openings in the vertical direction, and the second target parabola includes two parabolas with opposite openings in the horizontal direction. This is equivalent to finding the parabola closest to the distortion center in the vertical and horizontal directions, and then when the distortion center is determined according to the first target parabola and the second target parabola, the accuracy of the distortion center is ensured. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0049] Figure 1 A schematic diagram of pincushion distortion provided in the prior art is shown;

[0050] Figure 2 A schematic diagram of barrel distortion provided in the prior art is shown;

[0051] Figure 3 A schematic diagram of a method flow for determining the center of image distortion according to an embodiment of the present invention is shown;

[0052] Figure 4 A schematic diagram of converting an initial image into a grayscale image according to an embodiment of the present invention is shown;

[0053] Figure 5 A schematic diagram of a binary image obtained by processing a grayscale image according to an embodiment of the present invention is shown;

[0054] Figure 6 A schematic diagram of the structure of a device for determining an image distortion center according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0055] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be completely conveyed to those skilled in the art.

[0056] The present invention provides a method for determining the center of image distortion, as Figure 3 shown, the method includes the following steps:

[0057] S310. Process the initial image to obtain a target image; the initial image is an image of the target board taken when the module to be tested projects scattered spots onto the target board, and there are multiple scattered spots in the target image.

[0058] Before processing the initial image, first place the module to be tested directly in front of the target board, then control the module to be tested to project scattered spots onto the target board, and then take a picture of the target board to obtain the initial image. Then the initial image is the image of the target board taken when the module to be tested projects scattered spots onto the target board, and the initial image contains multiple scattered spots. Among them, the target board can be any one of the following several types: a target board with line pairs, a target board with grids, and a target board with dots.

[0059] The initial image is a color image. In order to more accurately identify the center of distortion, the present invention also needs to process the initial image to obtain a target image.

[0060] In one embodiment, processing the initial image to obtain a target image includes:

[0061] Convert the initial image to a grayscale image;

[0062] Perform binarization processing on the grayscale image to obtain a binary image;

[0063] Perform erosion and dilation operations on the binary image to obtain a dilated image;

[0064] Determine all the contour areas in the dilated image, remove the contours with contour areas greater than a preset area threshold, and obtain a target image.

[0065] Specifically, the initial image can be first converted to a grayscale image, and the grayscale image is as Figure 4 shown. In Figure 4 , the black area is the background and the white dots are the foreground area.

[0066] Then perform binarization processing on the grayscale image. The implementation is as follows:

[0067] Count the number of pixels for each gray level in the grayscale image to obtain a grayscale histogram. Traverse all possible gray levels as thresholds to divide the image into a foreground and a background. For each threshold, calculate the between-class variance between the foreground and the background. Select the threshold that maximizes the between-class variance as the optimal threshold.

[0068] Perform binarization on the grayscale image according to the optimal threshold. Set the brightness value of the pixel points in the grayscale image that are greater than the optimal threshold to 1, and set the brightness value of the pixel points in the grayscale image that are less than the optimal threshold to 0 to obtain a binary image. Among them, the binary image is as Figure 5 shown.

[0069] After obtaining the binary image, erosion and dilation operations can be performed on the binary image to obtain a dilated image. Since there may still be many interference points in the dilated image, the contour finding function findContours can be called to find all the contours in the dilated image, and then calculate the contour area of each contour.

[0070] Generally speaking, the contours of the speckles are smaller, and the contours of the interference points are larger. Therefore, an area threshold can be set based on experience to remove the contours whose contour areas are greater than the preset area threshold, which is equivalent to removing the interference points in the dilated image.

[0071] It can be understood that the initial image obtained during shooting may be offset. Therefore, after removing the interference points in the dilated image, the present invention also needs to determine the area formed by all the speckles, call the findContours function to determine the contour of this area, determine the minimum bounding rectangle of this contour, and correct the angle of the speckle area by rotating the bounding rectangle. After the correction is completed, the target image is obtained.

[0072] S311. Obtain the central coordinates of all the speckles in the target image, fit multiple parabolas according to the central coordinates of the speckles, and determine a first target parabola and a second target parabola from the multiple parabolas.

[0073] After determining all the contours in the dilated image in the above steps, the central coordinates of each contour can be determined accordingly. Then in this step, the central coordinates of all the speckles in the target image can be found based on the coordinates of each contour, multiple parabolas can be fitted according to the central coordinates of the speckles, and a first target parabola and a second target parabola can be determined from the multiple parabolas.

[0074] Refer to Figure 5 , if the image is distorted, then there are parabolas both in the horizontal direction and in the vertical direction. The present invention needs to determine the first target parabola in the vertical direction and the second target parabola in the horizontal direction.

[0075] In one embodiment, when the parabola is a vertically oriented parabola, fitting multiple parabolas based on the central coordinates of the scattered spots includes:

[0076] Store the central coordinates of the scattered spots into a pre-created first sequence; traverse the first sequence, and determine the scattered spot closest to the origin in the first sequence as the target scattered spot; magnify all the ordinate values in the first sequence by a preset multiple to obtain a second sequence; traverse the second sequence, and in each traversal, determine the scattered spot closest to the target scattered spot obtained after the previous traversal in the second sequence as the target scattered spot after the current traversal; after the traversal of the second sequence is completed, obtain the first target group of scattered spots;

[0077] Repeat the above steps to obtain multiple first target groups of scattered spots, and use the least squares method to fit each first target group of scattered spots to obtain multiple first parabolas; where

[0078] The sequence of scattered spots used in the current execution of the above steps is the sequence after removing the first target group of scattered spots obtained in the previous execution.

[0079] Specifically, fitting multiple parabolas in the vertical direction based on the central coordinates of the scattered spots includes the following steps:

[0080] Step a, store the central coordinates of the scattered spots into the first sequence;

[0081] Step b, for the scattered spots in the first sequence, calculate the distance between each scattered spot and the origin according to the central coordinates of each scattered spot, and determine the scattered spot corresponding to the closest distance as the target scattered spot P1;

[0082] Step c, magnify the ordinate values of all the scattered spots in the first sequence by 10 times to obtain a second sequence, and find the scattered spot closest to the target scattered spot P1 in the second sequence, denoted as the target scattered spot P2;

[0083] Execute step c, find the scattered spot closest to the target scattered spot P2 in the second sequence, denoted as the target scattered spot P3; repeat the execution of step c until all the target scattered spots in the second sequence are found to obtain the first target group of scattered spots (P1, P2... Pn);

[0084] Step d, delete the first target group of scattered spots in the first sequence, repeat the execution of step b and step c to find the second group of target scattered spots;

[0085] Step e, repeat the execution of step d until all the scattered spots in the first sequence are extracted, and finally obtain multiple first target groups of scattered spots.

[0086] Step f: Use the least squares method to perform parabolic fitting on multiple first target groups of scattered spots respectively to obtain multiple first parabolas.

[0087] Similarly, in one embodiment, when the parabola is a horizontal parabola, fitting multiple parabolas according to the center coordinates of the scattered spots includes:

[0088] Store the center coordinates of the scattered spots into a pre-created first sequence; traverse the first sequence, and determine the scattered spot closest to the origin in the first sequence as the target scattered spot; magnify all the abscissa values in the first sequence by a preset multiple to obtain a third sequence; traverse the third sequence, and in each traversal, determine the scattered spot closest to the target scattered spot obtained after the previous traversal in the third sequence as the target scattered spot after the current traversal; after the traversal of the third sequence is completed, obtain a second target group of scattered spots;

[0089] Repeat the above steps to obtain multiple second target groups of scattered spots, and use the least squares method to fit each second target group of scattered spots to obtain multiple second parabolas; where

[0090] The sequence of scattered spots used in the current execution of the above steps is the sequence after removing the second target group of scattered spots obtained in the previous execution.

[0091] Specifically, when determining multiple second parabolas, the specific execution steps used are the same as steps a to f above. The only difference is that in step c when determining the second parabola, the abscissa values of all scattered spots in the first sequence are magnified by 10 times to obtain a third sequence; the remaining steps are exactly the same, so they will not be elaborated here.

[0092] After obtaining multiple first parabolas and multiple second parabolas, the present invention needs to determine a first target parabola among the multiple first parabolas and a second target parabola among the multiple second parabolas.

[0093] Then in one implementation manner, determining the first target parabola and the second target parabola from multiple parabolas includes:

[0094] Obtain the first quadratic term coefficients in the function expressions corresponding to each first parabola and the second quadratic term coefficients in the function expressions corresponding to each second parabola;

[0095] Arrange each first quadratic term coefficient and the second quadratic term coefficient in a predetermined order respectively to obtain corresponding first quadratic term coefficient sequences and second quadratic term coefficient sequences;

[0096] Search for two first quadratic term coefficients with opposite signs in the first quadratic term coefficient queue, and determine the first parabolas corresponding to the two first quadratic term coefficients with opposite signs as the first target parabola;

[0097] Search for two second quadratic coefficients with opposite signs from the second quadratic coefficient queue, and determine the second parabolas corresponding to the two second quadratic coefficients with opposite signs as the second target parabolas.

[0098] Specifically, the function expression of each parabola is a quadratic function: y = ax 2 + bx + c, and each parabola corresponds to a quadratic coefficient a.

[0099] Taking multiple first parabolas as an example, assume the number of first parabolas is n, the function expression of the first first parabola is y = a1x 2 + b1x + c1, the function expression of the second first parabola is y = a2x 2 + b2x + c2, and the function expression of the nth first parabola is: y = a n x 2 + b n x + c n .

[0100] Assume that after arranging multiple first quadratic coefficients in descending order, the obtained first quadratic coefficient queue is (a1, a2,..., a n ), then there is:

[0101] a1 > a2 >... a k > 0 > a k+1 >... > a n ;

[0102] It can be seen that the two first quadratic coefficients with opposite signs are a k and a k+1 , then the first parabolas corresponding to a k and a k+1 are the first target parabolas. The first target parabolas contain two parabolas with opposite openings in the vertical direction.

[0103] Similarly, the second target parabolas can be determined from multiple second parabolas in the same way as above. The second target parabolas contain two parabolas with opposite openings in the horizontal direction. Since the determination method of the second target parabolas is exactly the same as that of the first target parabolas, it will not be elaborated here.

[0104] S312. Determine the distortion center of the image according to the first target parabola and the second target parabola.

[0105] After the first target parabola and the second target parabola are determined, the distortion center of the image can be determined according to the first target parabola and the second target parabola.

[0106] In one embodiment, determining the distortion center of an image based on a first target parabola and a second target parabola includes:

[0107] Determine two first parabolas included in the first target parabola, and obtain first target quadratic term coefficients of function expressions corresponding to the two first parabolas; determine two second parabolas included in the second target parabola, and obtain second target quadratic term coefficients of function expressions corresponding to the two second parabolas;

[0108] Determine the abscissa of the distortion center according to the two first target quadratic term coefficients;

[0109] Determine the ordinate of the distortion center according to the two second target quadratic term coefficients.

[0110] In one embodiment, determining the abscissa of the distortion center according to two first quadratic term coefficients includes:

[0111] Determine the absolute values of the two first target quadratic term coefficients to obtain a first absolute value and a second absolute value;

[0112] Determine the abscissa adjustment coefficient of the distortion center according to the first absolute value and the second absolute value;

[0113] For the two first parabolas, determine the average value of the abscissas of all the scattered spots used to fit the first parabola to obtain a first abscissa average value and a second abscissa average value;

[0114] Determine the abscissa of the distortion center according to the abscissa adjustment coefficient, the first abscissa average value, and the second abscissa average value.

[0115] In one embodiment, determining the abscissa adjustment coefficient of the distortion center according to the first absolute value and the second absolute value includes:

[0116] According to the formula Determine the abscissa adjustment coefficient η, where m is the first absolute value, g is the second absolute value, and m > g.

[0117] In one embodiment, determining the abscissa of the distortion center according to the abscissa adjustment coefficient, the first abscissa average value, and the second abscissa average value includes:

[0118] Determine the abscissa X of the distortion center according to the formula X = (B - A) × η + A; where A is the second abscissa average value and B is the first abscissa average value.

[0119] Continuing with the above example, the two first quadratic term coefficients with opposite signs are a k and a k+1 , then the two first parabolas included in the first target parabola are y = ak x 2 +b k x + c k and y = a k+1 x 2 +b k+1 x + c k+1 ;

[0120] The quadratic coefficients of the two first target terms are a k and a k+1 ; Assume a k = 1, a k+1 = -2, then the abscissa adjustment coefficient is:

[0121] Determine all the scattered spots used to fit the first parabola y = a k x 2 +b k x + c k and calculate the first abscissa average value B of these scattered spots;

[0122] Determine all the scattered spots used to fit the first parabola y = a k+1 x 2 +b k+1 x + c k+1 and calculate the second abscissa average value A of these scattered spots;

[0123] Then, according to the formula Determine the abscissa X of the distortion center.

[0124] In one embodiment, determining the ordinate of the distortion center according to the two second target quadratic coefficients includes:

[0125] Determine the absolute values of the two second target quadratic coefficients to obtain the third absolute value and the fourth absolute value;

[0126] Determine the ordinate adjustment coefficient of the distortion center according to the third absolute value and the fourth absolute value;

[0127] For the two second parabolas, determine the ordinate average values of all the scattered spots used to fit the second parabola to obtain the first ordinate average value and the second ordinate average value;

[0128] Determine the ordinate of the distortion center according to the ordinate adjustment coefficient, the first ordinate average value and the second ordinate average value.

[0129] In one embodiment, determining the ordinate adjustment coefficient of the distortion center according to the third absolute value and the fourth absolute value includes:

[0130] According to the formula Determine the abscissa adjustment coefficient η′, where m′ is the first absolute value and g′ is the second absolute value, and m′ > g′.

[0131] In one embodiment, determining the ordinate of the distortion center according to the ordinate adjustment coefficient, the first average ordinate, and the second average ordinate includes:

[0132] Determine the ordinate Y of the distortion center according to the formula Y = (B′ - A′) × η′ + A′; where A′ is the second average ordinate and B′ is the first average ordinate.

[0133] Assume that two second quadratic coefficients with opposite signs are a s and a s+1 , then the two first parabolas included in the second target parabola are y = a s x 2 +b s x + c s and y = a s+1 x 2 +b s+1 x + c s+1 ;

[0134] The two first target quadratic coefficients are a s and a s+1 ; assume a k = 2, a k+1 = -1, then the ordinate adjustment coefficient is:

[0135] Determine all the scattered spots used for fitting the second parabola y = a s x 2 +b s x + c s and calculate the first average ordinate B′ of these scattered spots;

[0136] Determine all the scattered spots used for fitting the second parabola y = a s+1 x 2 +b s+1 x + c s+1 and calculate the second average ordinate A′ of these scattered spots;

[0137] Then, according to the formula Determine the ordinate Y of the distortion center.

[0138] In the present invention, speckles are fitted into parabolas, and a first target parabola and a second target parabola are found among multiple parabolas. The first target parabola contains two parabolas with opposite openings in the vertical direction, and the second target parabola contains two parabolas with opposite openings in the horizontal direction. In this way, it is equivalent to finding the parabolas closest to the distortion center in the vertical and horizontal directions. Furthermore, when determining the distortion center based on the first target parabola and the second target parabola, the accuracy of the distortion center is ensured.

[0139] Based on the same inventive concept as in the foregoing embodiments, this embodiment further provides a device for determining the image distortion center, as Figure 6 shown. The device includes:

[0140] A processing unit 61, configured to process an initial image to obtain a target image; the initial image is an image of a target board captured when a measurement module projects speckles onto the target board, and there are multiple speckles in the target image;

[0141] A first determination unit 62, configured to obtain the central coordinates of all speckles in the target image, fit multiple parabolas according to the central coordinates of the speckles, and determine a first target parabola and a second target parabola from the multiple parabolas;

[0142] A second determination unit 63, configured to determine the distortion center of the image according to the first target parabola and the second target parabola.

[0143] Since the device introduced in the embodiments of the present invention is the device adopted for implementing the method for determining the image distortion center in the embodiments of the present invention, based on the method introduced in the embodiments of the present invention, those skilled in the art can understand the specific structure and variations of the device, and thus will not be elaborated herein. Any device adopted by the method in the embodiments of the present invention falls within the scope of protection of the present invention.

[0144] Based on the same inventive concept, this embodiment provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, any step of the foregoing method is implemented.

[0145] Through one or more embodiments of the present invention, the present invention has the following beneficial effects or advantages:

[0146] The present invention provides a method, apparatus and device for determining the distortion center of an image. The method includes: processing an initial image to obtain a target image; the initial image is an image of a target board captured when a measurement module projects scattered spots onto the target board, and there are a plurality of scattered spots in the target image; obtaining the center coordinates of all the scattered spots in the target image, fitting a plurality of parabolas according to the center coordinates of the scattered spots, and determining a first target parabola and a second target parabola from the plurality of parabolas; the opening directions of the first target parabola and the second target parabola are opposite; determining the distortion center of the image according to the first target parabola and the second target parabola; thus, if the image is distorted, each layer of scattered spots can be fitted into a parabola, and the parabola close to the distortion center should have an opening close to 0. Therefore, the present invention fits the scattered spots into parabolas, and finds the first target parabola and the second target parabola among the plurality of parabolas. The first target parabola includes two parabolas with opposite opening directions in the vertical direction, and the second target parabola includes two parabolas with opposite opening directions in the horizontal direction. This is equivalent to finding the parabolas closest to the distortion center in the vertical and horizontal directions. Furthermore, when determining the distortion center according to the first target parabola and the second target parabola, the accuracy of the distortion center is ensured.

[0147] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system or other device. Various general-purpose systems can also be used in conjunction with the teachings based herein. The structure required to construct such a system will be apparent from the above description. In addition, the present invention is not directed to any particular programming language. It should be understood that the content of the present invention described herein can be implemented using various programming languages, and the description of a particular language above is to disclose the best mode of the present invention.

[0148] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0149] Similarly, it should be understood that, for the purpose of streamlining the present disclosure and assisting in the understanding of one or more of the various inventive aspects, in the foregoing description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all of the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the present invention.

[0150] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and disposed in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all the features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) can be replaced by an alternative feature that provides the same, equivalent, or similar purpose.

[0151] In addition, those skilled in the art will be able to understand that although some of the embodiments herein include certain features included in other embodiments rather than other features, the combination of the features of different embodiments means that it is within the scope of the present invention and forms different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.

[0152] Each component embodiment of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the gateway, proxy server, and system according to the embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (such as a computer program and a computer program product) for executing part or all of the methods described herein. Such a program for implementing the present invention can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0153] It should be noted that the above embodiments illustrate the present invention rather than limit the present invention, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim listing several devices, several of these devices can be embodied by the same item of hardware. The use of the words first, second, and third, etc. does not denote any order. These words can be interpreted as names.

[0154] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications falling within the scope of the present invention.

[0155] As described above, it is only the preferred embodiments of the present invention, and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for determining the center of image distortion, characterized in that: The method comprises: The initial image is processed to obtain a target image; the initial head portrait is an image of the target plate taken when the module to be tested projects scattered spots onto the target plate, and the target image contains multiple scattered spots; Acquiring the center coordinates of all scattered spots in the target image, fitting a plurality of parabolas according to the center coordinates of the scattered spots, and determining a first target parabola and a second target parabola from the plurality of parabolas; A distortion center of the image is determined according to the first target parabola and the second target parabola.

2. The method according to claim 1, characterized in that The processing of the initial image comprises: Converting the initial image into a grayscale image; Binarizing the grayscale image to obtain a binary image; Performing corrosion and expansion operations on the binary image to obtain an expanded image; The areas of all contours in the dilated image are determined, and contours whose areas are greater than a preset area threshold are removed to obtain a target image.

3. The method according to claim 1, characterized in that When the parabola is a vertical parabola, fitting multiple parabolas according to the center coordinates of the scattered spots includes: The center coordinates of the scattered spots are stored in a pre-created first sequence; the first sequence is traversed, and the scattered spots in the first sequence that are closest to the origin are determined as target scattered spots; all the vertical coordinate values ​​in the first sequence are magnified by a preset multiple to obtain a second sequence; the second sequence is traversed, and in each traversal, the scattered spots in the second sequence that are closest to the target scattered spots obtained after the previous traversal are determined as the target scattered spots after the current traversal; after the traversal of the second sequence is completed, the scattered spots of the first target group are obtained; Repeat the above steps to obtain multiple first target group scattered spots, and use the least square method to fit each first target group scattered spot to obtain multiple first parabolas; wherein, The speckle sequence used when the above steps are currently executed is the sequence after the first target group of speckles obtained in the previous execution is eliminated.

4. The method according to claim 1, characterized in that When the parabola is a horizontal parabola, fitting multiple parabolas according to the center coordinates of the scattered spots includes: The center coordinates of the scattered spots are stored in a pre-created first sequence; the first sequence is traversed, and the scattered spots in the first sequence that are closest to the origin are determined as target scattered spots; all the horizontal coordinate values ​​in the first sequence are magnified by a preset multiple to obtain a third sequence; the third sequence is traversed, and in each traversal, the scattered spots in the third sequence that are closest to the target scattered spots obtained after the previous traversal are determined as the target scattered spots after the current traversal; after the traversal of the third sequence is completed, a second target group of scattered spots is obtained; Repeat the above steps to obtain multiple second target group scattered spots, and use the least square method to fit each second target group scattered spot to obtain multiple second parabolas; wherein, The speckle sequence used when the above steps are currently executed is the sequence after the second target group of speckles obtained in the previous execution is eliminated.

5. The method according to claim 1, characterized in that The parabola includes a first parabola and a second parabola; and determining a first target parabola and a second target parabola from the plurality of parabolas includes: Obtain the first quadratic term coefficient in the function expression corresponding to each first parabola and the second quadratic term coefficient in the function expression corresponding to each second parabola; Arranging the first quadratic term coefficients and the second quadratic term coefficients in a predetermined order respectively to obtain a corresponding first quadratic term coefficient sequence and a second quadratic term coefficient sequence; Searching for two first quadratic term coefficients of opposite sign from the first quadratic term coefficient queue, and determining the first parabola corresponding to the two first quadratic term coefficients of opposite sign as the first target parabola; Two second quadratic term coefficients with opposite sign are searched from the second quadratic term coefficient queue, and the second parabola corresponding to the two second quadratic term coefficients with opposite sign is determined as the second target parabola.

6. The method according to claim 1, characterized in that The determining the distortion center of the image according to the first target parabola and the second target parabola comprises: Determine two first parabolas included in the first target parabola, and obtain first target quadratic term coefficients of the function expression corresponding to the two first parabolas; determine two second parabolas included in the second target parabola, and obtain second target quadratic term coefficients of the function expression corresponding to the two second parabolas; Determine the abscissa of the distortion center according to the two first target quadratic term coefficients; The ordinate of the distortion center is determined according to the two second target quadratic term coefficients.

7. The method according to claim 6, characterized in that The step of determining the abscissa of the distortion center according to the two first quadratic term coefficients comprises: Determine the absolute values ​​of two coefficients of the first target quadratic terms to obtain a first absolute value and a second absolute value; determining a horizontal coordinate adjustment coefficient of the distortion center according to the first absolute value and the second absolute value; For the two first parabolas, determine the average value of the abscissa of all scattered spots used to fit the first parabolas, and obtain a first abscissa average value and a second abscissa average value; The abscissa of the distortion center is determined according to the abscissa adjustment coefficient, the first abscissa average value, and the second abscissa average value.

8. The method according to claim 6, characterized in that The determining the ordinate of the distortion center according to the two second target quadratic term coefficients comprises: Determine the absolute values ​​of two coefficients of the second target quadratic term to obtain a third absolute value and a fourth absolute value; Determine a ordinate adjustment coefficient of the distortion center according to the third absolute value and the fourth absolute value; For the two second parabolas, determine the ordinate average of all scattered spots used to fit the second parabolas, and obtain a first ordinate average and a second ordinate average; The ordinate of the distortion center is determined according to the ordinate adjustment coefficient, the first ordinate average value, and the second ordinate average value.

9. A device for determining the center of image distortion, characterized in that: The device comprises: A processing unit, used to process the initial image to obtain a target image; the initial head portrait is an image of the target plate taken when the module to be tested projects scattered spots onto the target plate, and the target image contains multiple scattered spots; A first determination unit is used to obtain the center coordinates of all scattered spots in the target image, fit a plurality of parabolas according to the center coordinates of the scattered spots, and determine a first target parabola and a second target parabola from the plurality of parabolas; The second determining unit is used to determine the distortion center of the image according to the first target parabola and the second target parabola.

10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 8 are implemented.