Lens distortion data acquisition method and device
By acquiring and processing raw images captured by real cameras, constructing a coordinate system and calculating a half-image height array, a lens distortion data table is generated, solving the problem of supplier data dependency in lens simulation and realizing the flexibility and accuracy of lens distortion simulation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GAC AION NEW ENERGY AUTOMOBILE CO LTD
- Filing Date
- 2024-07-09
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies rely on distortion data provided by suppliers in lens simulation, which means that lens distortion simulation cannot be performed or the results are poor when the supplier cannot provide the data or the data is incomplete.
By acquiring configuration parameters and original images captured by a real camera, a coordinate system is constructed, distortion points are extracted and corrected, the actual and ideal half-image height arrays are calculated, and a lens distortion data table is generated.
Even when the supplier does not provide distortion data, the system can calculate lens distortion data tables independently, improving the flexibility and effectiveness of distortion simulation.
Smart Images

Figure CN118822913B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a method and apparatus for acquiring lens distortion data. Background Technology
[0002] In the field of optical imaging system design and simulation, lens simulation software plays a crucial role. A key technical challenge in lens simulation is accurately simulating the distortion state of the corrected image to realistically reflect the lens's performance in practical applications. Existing methods primarily rely on distortion data sheets provided by suppliers. When suppliers cannot provide such data or provide incomplete data, lens distortion simulation will be impossible or ineffective. Summary of the Invention
[0003] The purpose of this application is to provide a method and apparatus for acquiring lens distortion data, which can calculate a lens distortion data table even when the lens supplier does not provide distortion data, thus overcoming the problem of supplier dependence and improving the flexibility of distortion simulation.
[0004] The first aspect of this application provides a method for acquiring lens distortion data, including:
[0005] Obtain configuration parameters and raw images captured by the actual camera;
[0006] Convert the original image into a grayscale image;
[0007] Based on the grayscale image, construct a first coordinate system with the top left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin;
[0008] Based on the first coordinate system, the distortion points of the grayscale image are extracted to obtain a set of distortion coordinates;
[0009] Based on the configuration parameters, the distorted coordinate set is subjected to distortion correction processing to obtain the corrected coordinate set;
[0010] The coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set are converted from the first coordinate system to the second coordinate system, respectively, to obtain the first distorted coordinate set and the first corrected coordinate set;
[0011] Calculate the actual half-image height array and the ideal half-image height array based on the first distortion coordinate set and the first correction coordinate set, respectively;
[0012] Based on the actual half-image height array and the ideal half-image height array, calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image.
[0013] In the above implementation process, this method can obtain the coordinates of distortion points and correction points based on the original image, and further compare and calculate based on the coordinates of distortion points and correction points to obtain lens distortion data. It is evident that this method can calculate lens distortion data tables even when the lens supplier does not provide distortion data, overcoming the problem of supplier dependence and improving the flexibility of distortion simulation.
[0014] Furthermore, the configuration parameters include at least lens intrinsics, pixel size, resolution, and distortion coefficient;
[0015] The positive X-axis of the first coordinate system points downwards from the left edge of the grayscale image, and the positive Y-axis of the first coordinate system points to the right from the top edge of the grayscale image.
[0016] Further, the step of converting the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system to obtain the first distorted coordinate set and the first corrected coordinate set includes:
[0017] The coordinates of the distorted coordinate set are converted from the first coordinate system to the second coordinate system to obtain the first distorted coordinate set;
[0018] The coordinates of the corrected coordinate set are converted from the first coordinate system to the second coordinate system to obtain the first corrected coordinate set.
[0019] Further, the step of calculating the actual half-image height array and the ideal half-image height array based on the first distortion coordinate set and the first correction coordinate set respectively includes:
[0020] Based on the pixel size and the first set of distortion coordinates, calculate a second set of distortion coordinates with physically meaningful dimensions;
[0021] Based on the pixel size and the first set of corrected coordinates, a second set of corrected coordinates with physically meaningful dimensions is calculated.
[0022] Further, the step of calculating the half-view set and the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the ideal half-image array includes:
[0023] Based on the second set of distorted coordinates, the distance from each distorted point to the origin of the second coordinate system is calculated to obtain the actual half-image height array;
[0024] Based on the second set of corrected coordinates, the distance from each corrected point to the origin of the second coordinate system is calculated to obtain the ideal half-image height array;
[0025] Calculate the actual half-angle of view based on the actual half-image height array;
[0026] Calculate the ideal half-view angle based on the ideal half-image height array;
[0027] By summing the actual half-angle and the ideal half-angle, a set of half-angles is obtained;
[0028] The correspondence array between the actual half-image and the ideal half-image is determined based on the actual half-image height array and the actual half-image height array.
[0029] A second aspect of this application provides a lens distortion data acquisition device, the lens distortion data acquisition device comprising:
[0030] The acquisition unit is used to acquire configuration parameters and raw images captured by the actual camera.
[0031] The image conversion unit is used to convert the original image into a grayscale image;
[0032] The construction unit is used to construct a first coordinate system with the upper left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin based on the grayscale image.
[0033] An extraction unit is used to extract distortion points from the grayscale image based on the first coordinate system to obtain a set of distortion coordinates.
[0034] The correction unit is used to perform distortion correction processing on the distorted coordinate set based on the configuration parameters to obtain the corrected coordinate set;
[0035] A coordinate transformation unit is used to convert the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the coordinates of the second coordinate system, respectively, to obtain a first distorted coordinate set and a first corrected coordinate set;
[0036] The first calculation unit is used to calculate the actual half-image height array and the ideal half-image height array based on the first distorted coordinate set and the first corrected coordinate set, respectively.
[0037] The second calculation unit is used to calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the ideal half-image array.
[0038] Furthermore, the configuration parameters include at least lens intrinsics, pixel size, resolution, and distortion coefficient;
[0039] The positive X-axis of the first coordinate system points downwards from the left edge of the grayscale image, and the positive Y-axis of the first coordinate system points to the right from the top edge of the grayscale image.
[0040] Furthermore, the coordinate transformation unit is specifically used to transform the coordinates of the distorted coordinate set from the first coordinate system to the second coordinate system to obtain a first distorted coordinate set; and to transform the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system to obtain a first corrected coordinate set.
[0041] Furthermore, the first calculation unit is specifically used to calculate a second set of distortion coordinates with physically meaningful dimensions based on the pixel size and the first set of distortion coordinates;
[0042] The first calculation unit is further configured to calculate a second set of corrected coordinates with physically meaningful dimensions based on the pixel size and the first set of corrected coordinates.
[0043] Furthermore, the second computing unit includes:
[0044] The calculation subunit is used to calculate the distance from each distorted point to the origin of the second coordinate system based on the second distorted coordinate set, so as to obtain the actual half-image height array;
[0045] The calculation subunit is also used to calculate the distance from each correction point to the origin of the second coordinate system based on the second set of correction coordinates, so as to obtain an ideal half-image height array;
[0046] The calculation subunit is also used to calculate the actual half-angle of view based on the actual half-image height array;
[0047] The calculation subunit is also used to calculate the ideal half-view angle based on the ideal half-image height array;
[0048] The summarization subunit is used to summarize the actual half-angle and the ideal half-angle to obtain a set of half-angles;
[0049] A sub-unit is defined for determining the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the actual half-image height array.
[0050] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program to cause the electronic device to perform the lens distortion data acquisition method described in any one of the first aspects of this application.
[0051] The fourth aspect of this application provides a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the lens distortion data acquisition method described in any one of the first aspects of this application.
[0052] The beneficial effects of this application are: the method and apparatus can calculate lens distortion data tables even when the lens supplier does not provide distortion data, thus overcoming the problem of supplier dependence and improving the flexibility of distortion simulation. Attached Figure Description
[0053] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 A flowchart illustrating a method for acquiring lens distortion data provided in an embodiment of this application;
[0055] Figure 2 A flowchart illustrating another method for acquiring lens distortion data provided in this application embodiment;
[0056] Figure 3 This is a schematic diagram of distortion point extraction provided in an embodiment of this application;
[0057] Figure 4 This is another schematic diagram of distortion point extraction provided in an embodiment of this application;
[0058] Figure 5 This is a schematic diagram of the structure of a lens distortion data acquisition device provided in an embodiment of this application;
[0059] Figure 6 This is a schematic diagram of another lens distortion data acquisition device provided in an embodiment of this application. Detailed Implementation
[0060] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0061] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0062] Example 1
[0063] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for acquiring lens distortion data provided in this embodiment. The method includes:
[0064] S101. Obtain configuration parameters and original images captured by the actual camera.
[0065] In this embodiment, the configuration parameters include at least lens intrinsics, pixel size, resolution, and distortion coefficient.
[0066] S102. Convert the original image to a grayscale image.
[0067] S103. Construct a first coordinate system with the top left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin.
[0068] In this embodiment, the positive X-axis of the first coordinate system is the downward direction of the left edge of the grayscale image, and the positive Y-axis of the first coordinate system is the rightward direction of the top edge of the grayscale image.
[0069] S104. Based on the first coordinate system, extract the distortion points of the grayscale image to obtain the distortion coordinate set.
[0070] S105. Based on the configuration parameters, perform distortion correction processing on the distorted coordinate set to obtain the corrected coordinate set.
[0071] S106. Convert the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system, respectively, to obtain the first distorted coordinate set and the first corrected coordinate set.
[0072] S107. Calculate the actual half-image height array and the ideal half-image height array based on the first distortion coordinate set and the first correction coordinate set, respectively.
[0073] S108. Based on the actual half-image height array and the ideal half-image height array, calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image.
[0074] In this embodiment, the aforementioned correspondence array is a distortion data table, which is used to assist lens simulation software in converting corrected images back to distorted images. The distortion data table obtained through this method can replace the traditional distortion data table provided by the supplier, thereby achieving the purpose of simulating lens distortion when the supplier does not provide a distortion data table.
[0075] In this embodiment, the method can generate the distortion data table required by the simulation software given lens parameters. Thus, when the distortion data table provided by the supplier is incomplete (resulting in poor simulation distortion effect), the distortion data table can be customized and generated using self-taken images, thereby improving the simulation distortion effect.
[0076] If the distortion data table provided by the supplier is incomplete (resulting in poor simulation distortion effect), a distortion data table can be generated by taking your own pictures to improve the simulation distortion effect.
[0077] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0078] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0079] As can be seen, the lens distortion data acquisition method described in this embodiment can calculate the lens distortion data table even when the lens supplier does not provide distortion data, thus overcoming the problem of supplier dependence and improving the flexibility of distortion simulation.
[0080] Example 2
[0081] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a method for acquiring lens distortion data provided in this embodiment. The method includes:
[0082] S201. Obtain configuration parameters and original images captured by the actual camera.
[0083] In this embodiment, the configuration parameters include at least lens intrinsics, pixel size, resolution, and distortion coefficient.
[0084] In this embodiment, the method can output the correspondence between half-view, actual half-image, and ideal half-image based on the above configuration parameters.
[0085] S202. Convert the original image to a grayscale image.
[0086] In this embodiment, the method can convert images captured by a real camera (images to be distorted) into grayscale images.
[0087] S203. Construct a first coordinate system with the top left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin.
[0088] In this embodiment, the positive X-axis of the first coordinate system is the downward direction of the left edge of the grayscale image, and the positive Y-axis of the first coordinate system is the rightward direction of the top edge of the grayscale image.
[0089] S204. Based on the first coordinate system, extract the distortion points of the grayscale image to obtain the distortion coordinate set.
[0090] Please refer to Figure 3 and Figure 4, Figure 3 A schematic diagram of distortion point extraction is shown. Figure 4 Another schematic diagram of distortion point extraction is shown. In this method, when selecting points on the image, the coordinates of the object's outline are generally selected at the top, bottom, left, and right positions of the image (preferably points with a high distortion rate in the image).
[0091] S205. Based on the configuration parameters, perform distortion correction processing on the distorted coordinate set to obtain the corrected coordinate set.
[0092] In this embodiment, the method can determine the set of corrected coordinates corresponding to the set of distorted coordinates by using a mathematical model of geometric distortion correction.
[0093] S206. Convert the coordinates of the distorted coordinate set from the first coordinate system to the second coordinate system to obtain the first distorted coordinate set.
[0094] S207. Convert the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system to obtain the first corrected coordinate set.
[0095] In this embodiment, the method can transform the distortion coordinate set and the correction coordinate set from a coordinate system with the top left corner of the image as the origin, the X-axis downwards and the Y-axis to the right into a coordinate system with the center of the image as the origin, the X-axis downwards and the Y-axis to the right.
[0096] For example, this method can subtract half of the horizontal resolution from the x-coordinate of the two coordinate sets mentioned above (for example, 960 for the x-coordinate in 1920x1080) and half of the vertical resolution from the y-coordinate (for example, 540 for the y-coordinate in 1920x1080).
[0097] S208. Based on the pixel size and the first distortion coordinate set, calculate the second distortion coordinate set with physical meaning.
[0098] S209. Based on the pixel size and the first set of corrected coordinates, calculate the second set of corrected coordinates that has physical meaning.
[0099] In this embodiment, the method can multiply the distorted coordinate set and the corrected coordinate set by the pixel size, so that the coordinate set has a physically meaningful size.
[0100] S210. Based on the second distorted coordinate set, calculate the distance from each distorted point to the origin of the second coordinate system to obtain the actual half-image height array.
[0101] In this embodiment, the method can calculate the distance from the correction point to the origin using the correction coordinates, thereby obtaining a set of ideal half-image height arrays. The distance from the origin to the correction coordinates is r. 理想半像高 The calculation formula is as follows:
[0102] r 理想半像高 ^2=x 矫正 ^2+y 矫正 ^2.
[0103] S211. Based on the second set of correction coordinates, calculate the distance from each correction point to the origin of the second coordinate system to obtain the ideal half-image height array.
[0104] In this embodiment, the method can calculate the distance from the distorted point to the origin using distorted coordinates, and obtain a set of actual half-image height arrays, r 实际半像高 The calculation formula is as follows:
[0105] r 实际半像高 ^2=x 畸变 ^2+y 畸变 ^2.
[0106] S212. Calculate the actual half-angle of view based on the actual half-image height array.
[0107] S213. Calculate the ideal half-view angle based on the ideal half-image height array.
[0108] In this embodiment, the method can calculate the half-angle using the inverse tangent function, and the calculation formula is as follows:
[0109] Actual half-angle θ = arctan(r) 实际半像高 / f); where f is the focal length;
[0110] Ideal half-angle θ = arctan(r) 理想半像高 / f); where f is the focal length.
[0111] S214. Summarize the actual half-angle view and the ideal half-angle view to obtain the half-angle view set.
[0112] S215. Determine the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the actual half-image height array.
[0113] In this embodiment, the method can ultimately obtain a set of correspondence arrays of half-view, actual half-image, and ideal half-image.
[0114] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0115] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0116] As can be seen, the lens distortion data acquisition method described in this embodiment can calculate a lens distortion data table to achieve a lens distortion simulation effect when the lens supplier does not provide distortion data; or when the distortion data provided by the supplier is insufficient to meet the requirements of lens distortion simulation, it can selectively extract the locations with large lens distortion and convert them into distortion data to improve the effect of simulation distortion.
[0117] Example 3
[0118] Please refer to Figure 5 , Figure 5 This is a schematic diagram of a lens distortion data acquisition device provided in this embodiment. Figure 5 As shown, the lens distortion data acquisition device includes:
[0119] Acquisition unit 310 is used to acquire configuration parameters and original images captured by the actual camera;
[0120] Image conversion unit 320 is used to convert the original image into a grayscale image;
[0121] Construction unit 330 is used to construct a first coordinate system with the upper left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin based on the grayscale image;
[0122] Extraction unit 340 is used to extract distortion points from grayscale images based on the first coordinate system to obtain a set of distortion coordinates;
[0123] The correction unit 350 is used to perform distortion correction processing on the distorted coordinate set based on configuration parameters to obtain the corrected coordinate set.
[0124] The coordinate transformation unit 360 is used to transform the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the coordinates of the second coordinate system, respectively, to obtain the first distorted coordinate set and the first corrected coordinate set;
[0125] The first calculation unit 370 is used to calculate the actual half-image height array and the ideal half-image height array according to the first distorted coordinate set and the first corrected coordinate set, respectively;
[0126] The second calculation unit 380 is used to calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the ideal half-image array.
[0127] In this embodiment, the explanation of the lens distortion data acquisition device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated here.
[0128] As can be seen, the lens distortion data acquisition device described in this embodiment can calculate the lens distortion data table even when the lens supplier does not provide distortion data, thus overcoming the problem of supplier dependence and improving the flexibility of distortion simulation.
[0129] Example 4
[0130] Please refer to Figure 6 , Figure 6 This is a schematic diagram of a lens distortion data acquisition device provided in this embodiment. Figure 6 As shown, the lens distortion data acquisition device includes:
[0131] Acquisition unit 310 is used to acquire configuration parameters and original images captured by the actual camera;
[0132] Image conversion unit 320 is used to convert the original image into a grayscale image;
[0133] Construction unit 330 is used to construct a first coordinate system with the upper left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin based on the grayscale image;
[0134] Extraction unit 340 is used to extract distortion points from grayscale images based on the first coordinate system to obtain a set of distortion coordinates;
[0135] The correction unit 350 is used to perform distortion correction processing on the distorted coordinate set based on configuration parameters to obtain the corrected coordinate set.
[0136] The coordinate transformation unit 360 is used to transform the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the coordinates of the second coordinate system, respectively, to obtain the first distorted coordinate set and the first corrected coordinate set;
[0137] The first calculation unit 370 is used to calculate the actual half-image height array and the ideal half-image height array according to the first distorted coordinate set and the first corrected coordinate set, respectively;
[0138] The second calculation unit 380 is used to calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the ideal half-image array.
[0139] In this embodiment, the configuration parameters include at least lens intrinsic parameters, pixel size, resolution, and distortion coefficient;
[0140] The positive X-axis of the first coordinate system points downwards from the left edge of the grayscale image, and the positive Y-axis points to the right from the top edge of the grayscale image.
[0141] As an optional implementation, the coordinate transformation unit 360 is specifically used to transform the coordinates of the distorted coordinate set from the first coordinate system to the second coordinate system to obtain the first distorted coordinate set; and to transform the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system to obtain the first corrected coordinate set.
[0142] As an optional implementation, the first calculation unit 370 is specifically used to calculate a second set of distortion coordinates with physically meaningful dimensions based on the pixel size and the first set of distortion coordinates;
[0143] The first calculation unit 370 is further used to calculate a second set of corrected coordinates with physically meaningful dimensions based on the pixel size and the first set of corrected coordinates.
[0144] As an optional implementation, the second computing unit 380 includes:
[0145] The calculation subunit 381 is used to calculate the distance from each distortion point to the origin of the second coordinate system based on the second distortion coordinate set, so as to obtain the actual half-image height array;
[0146] The calculation subunit 381 is also used to calculate the distance from each correction point to the origin of the second coordinate system based on the second correction coordinate set, so as to obtain the ideal half-image height array;
[0147] The calculation subunit 381 is also used to calculate the actual half-angle of view based on the actual half-image height array;
[0148] The calculation subunit 381 is also used to calculate the ideal half-view angle based on the ideal half-image height array;
[0149] Sub-unit 382 is used to summarize the actual half-angle and the ideal half-angle to obtain the half-angle set;
[0150] Subunit 383 is defined to determine the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the actual half-image height array.
[0151] In this embodiment, the explanation of the lens distortion data acquisition device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated here.
[0152] As can be seen, the lens distortion data acquisition device described in this embodiment can calculate a lens distortion data table to achieve a lens distortion simulation effect when the lens supplier does not provide distortion data; or when the distortion data provided by the supplier is insufficient to meet the requirements of lens distortion simulation, it can selectively extract the locations with large lens distortion and convert them into distortion data to improve the effect of simulation distortion.
[0153] This application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to enable the electronic device to perform the lens distortion data acquisition method in embodiment 1 or embodiment 2 of this application.
[0154] This application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the lens distortion data acquisition method in embodiment 1 or embodiment 2 of this application is performed.
[0155] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0156] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0157] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) 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.
[0158] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0159] 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 that can be easily conceived by those skilled in the art within the scope of the technology 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.
[0160] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for acquiring lens distortion data, characterized in that, include: Obtain configuration parameters and raw images captured by the actual camera; Convert the original image into a grayscale image; Based on the grayscale image, construct a first coordinate system with the top left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin; Based on the first coordinate system, the distortion points of the grayscale image are extracted to obtain a set of distortion coordinates; Based on the configuration parameters, the distorted coordinate set is subjected to distortion correction processing to obtain the corrected coordinate set; The coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set are converted from the first coordinate system to the second coordinate system, respectively, to obtain the first distorted coordinate set and the first corrected coordinate set; Calculate the actual half-image height array and the ideal half-image height array based on the first distortion coordinate set and the first correction coordinate set, respectively; Based on the actual half-image height array and the ideal half-image height array, calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image.
2. The method for acquiring lens distortion data according to claim 1, characterized in that, The configuration parameters include at least lens intrinsics, pixel size, resolution, and distortion coefficient; The positive X-axis of the first coordinate system points downwards from the left edge of the grayscale image, and the positive Y-axis of the first coordinate system points to the right from the top edge of the grayscale image.
3. The lens distortion data acquisition method according to claim 1, characterized in that, The step of converting the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system, respectively, to obtain the first distorted coordinate set and the first corrected coordinate set, includes: The coordinates of the distorted coordinate set are converted from the first coordinate system to the second coordinate system to obtain the first distorted coordinate set; The coordinates of the corrected coordinate set are converted from the first coordinate system to the second coordinate system to obtain the first corrected coordinate set.
4. The method for acquiring lens distortion data according to claim 2, characterized in that, The step of calculating the actual half-image height array and the ideal half-image height array based on the first distortion coordinate set and the first correction coordinate set respectively includes: Based on the pixel size and the first set of distortion coordinates, calculate a second set of distortion coordinates with physically meaningful dimensions; Based on the pixel size and the first set of corrected coordinates, a second set of corrected coordinates with physically meaningful dimensions is calculated.
5. The method for acquiring lens distortion data according to claim 4, characterized in that, The step of calculating the half-view set and the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the ideal half-image array includes: Based on the second set of distorted coordinates, the distance from each distorted point to the origin of the second coordinate system is calculated to obtain the actual half-image height array; Based on the second set of corrected coordinates, the distance from each corrected point to the origin of the second coordinate system is calculated to obtain the ideal half-image height array; Calculate the actual half-angle of view based on the actual half-image height array; Calculate the ideal half-view angle based on the ideal half-image height array; By summing the actual half-angle and the ideal half-angle, a set of half-angles is obtained; The correspondence array between the actual half-image and the ideal half-image is determined based on the actual half-image height array and the actual half-image height array.
6. A lens distortion data acquisition device, characterized in that, The lens distortion data acquisition device includes: The acquisition unit is used to acquire configuration parameters and raw images captured by the actual camera. The image conversion unit is used to convert the original image into a grayscale image; The construction unit is used to construct a first coordinate system with the upper left corner of the grayscale image as the origin and a second coordinate system with the center of the grayscale image as the origin based on the grayscale image. An extraction unit is used to extract distortion points from the grayscale image based on the first coordinate system to obtain a set of distortion coordinates. The correction unit is used to perform distortion correction processing on the distorted coordinate set based on the configuration parameters to obtain the corrected coordinate set; A coordinate transformation unit is used to convert the coordinates of the distorted coordinate set and the coordinates of the corrected coordinate set from the first coordinate system to the coordinates of the second coordinate system, respectively, to obtain a first distorted coordinate set and a first corrected coordinate set; The first calculation unit is used to calculate the actual half-image height array and the ideal half-image height array based on the first distorted coordinate set and the first corrected coordinate set, respectively. The second calculation unit is used to calculate the half-view set and the correspondence array between the actual half-image and the ideal half-image based on the actual half-image height array and the ideal half-image array.
7. The lens distortion data acquisition device according to claim 6, characterized in that, The configuration parameters include at least lens intrinsics, pixel size, resolution, and distortion coefficient; The positive X-axis of the first coordinate system points downwards from the left edge of the grayscale image, and the positive Y-axis of the first coordinate system points to the right from the top edge of the grayscale image.
8. The lens distortion data acquisition device according to claim 6, characterized in that, The coordinate transformation unit is specifically used to transform the coordinates of the distorted coordinate set from the first coordinate system to the second coordinate system to obtain a first distorted coordinate set; and to transform the coordinates of the corrected coordinate set from the first coordinate system to the second coordinate system to obtain a first corrected coordinate set.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the lens distortion data acquisition method according to any one of claims 1 to 5.
10. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the lens distortion data acquisition method according to any one of claims 1 to 5.