Method, device and photographic equipment for correcting wide-angle lens image distortion
By calculating the distortion parameters and differences parameters of the maximum resolution image, the correction of arbitrary wide-angle lens images is achieved, and the complicated multi-group calibration problems in the prior art and the problem of abnormal correction after digital zoom is solved, improving the accuracy of the correction and simplifying the process.
Patent Information
- Application Number
- CN202111239136.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-25
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2041-10-25
AI Technical Summary
In the prior art, when correcting image distortion of wide-angle lenses, multiple sets of distortion parameters need to be calibrated, especially when there is a large image resolution or digital zoom, resulting in cumbersome correction process and large errors, and the images captured after digital zoom cannot be effectively corrected.
A method is proposed to determine the difference parameters of the second calibration image by calculating the distortion parameters corresponding to the maximum resolution image, including the dimension proportional coefficient and the edge dimension difference value, and to correct the coordinates of the distorted image, thereby realizing the correction of the original wide-angle distortion image of any resolution.
This method does not require calibration of multiple sets of distortion parameters, greatly simplifies the correction process, improves the accuracy of correction, and can effectively process images taken after digital zoom.
Smart Images

Figure CN113962892B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing and computer vision, and in particular to a method, a device and a photographic device for correcting wide-angle lens image distortion. Background Art
[0002] At present, the correction technology of wide-angle lens image distortion generally uses the checkerboard image to calculate the distortion parameters that conform to the distortion mathematical model, and then uses the distortion parameters and the distortion mathematical model to transform the coordinates of the distorted image to achieve the purpose of correction. However, when the same camera shoots images of different resolutions, due to the errors in the distortion parameters calculated for images of different resolutions, it will cause the distortion parameters calculated by the previous resolution to be directly used for the distortion correction of images of different resolutions shot by the same model of camera lens, resulting in correction anomalies.
[0003] In the prior art, when the resolution of the image taken by the wide-angle camera is relatively large, it is necessary to calibrate multiple sets of distortion parameters for the images of multiple resolutions, so that when the captured image is corrected, the distortion parameters corresponding to the resolution are selected according to the resolution of the captured image to correct the captured image. Therefore, when the resolution of the image is relatively large, it is necessary to calibrate many sets of distortion parameters accordingly, which makes the current correction method very cumbersome, and when calibrating the image with a small resolution, the calculated distortion parameter error is large, resulting in abnormal correction of the image. In addition, most cameras currently support digital zoom technology, but the digital zoom of the wide-angle lens will also cause abnormal correction of the distorted image, but most cameras currently do not support the function of correcting the image taken after digital zoom. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. One purpose of the present invention is to provide a method, device and photographic equipment for correcting wide-angle lens image distortion, which does not require calibration of multiple sets of distortion parameters, but only requires calculation of a set of distortion parameters corresponding to a maximum resolution image to achieve correction of the original wide-angle distorted image of any resolution, greatly simplifies the correction process, and avoids the situation where the distortion parameter error of the calibration is too large when calibrating a small resolution image, thereby improving the accuracy of the correction.
[0005] The present invention provides a method for correcting wide-angle lens image distortion, the method comprising:
[0006] Inputting an original distorted image and a preset first calibration image;
[0007] Determining a second calibration image according to the original distorted image and the first calibration image;
[0008] Calculating the distorted image coordinates corresponding to the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model;
[0009] Determining a difference parameter of the second calibration image, and correcting the distorted image coordinates according to the difference parameter;
[0010] Output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
[0011] In addition, the method for correcting wide-angle lens image distortion according to the embodiment of the present invention may also have the following additional technical features:
[0012] Further, determining a second calibration image according to the original distorted image and the first calibration image includes: determining an image corresponding to a maximum resolution having the same aspect ratio as the original distorted image under the resolution of the first calibration image as the second calibration image.
[0013] Furthermore, the difference parameter includes: a size ratio coefficient between the second calibration image and the original distorted image, and an edge size difference between the first calibration image and the second calibration image.
[0014] Further, determining the difference parameter of the second calibration image includes:
[0015] Determining a resolution ratio between the second calibration image and the original distorted image as the size ratio coefficient;
[0016] The difference in the number of pixels between the first calibration image and the second calibration image in the horizontal direction and the vertical direction is determined as the edge size difference.
[0017] Further, determining the difference parameter of the second calibration image includes:
[0018] Determine a resolution ratio between the second calibration image and the original distorted image, and use a ratio of the resolution ratio to a digital zoom factor of a wide-angle lens as the size ratio coefficient;
[0019] Determine a first ratio of the number of pixels of the second calibration image in the horizontal direction to the digital zoom multiple, determine a first difference between the number of pixels of the second calibration image in the horizontal direction and the first ratio, and determine a second difference between the number of pixels of the first calibration image and the second calibration image in the horizontal direction; and determine a second ratio of the number of pixels of the second calibration image in the vertical direction to the digital zoom multiple, determine a third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, and determine a fourth difference between the number of pixels of the first calibration image and the second calibration image in the vertical direction; determine the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference as the edge size difference.
[0020] Further, correcting the distorted image coordinates according to the difference parameter includes:
[0021] translating the distorted image coordinates according to the edge size difference;
[0022] The coordinates of the distorted image after translation are scaled according to the size ratio coefficient.
[0023] According to the method for correcting wide-angle lens image distortion according to the embodiment of the present invention, the method does not need to calibrate multiple groups of distortion parameters, and only needs to calculate a group of distortion parameters corresponding to the maximum resolution image to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0024] In view of the above problems, the present invention further proposes a device for correcting image distortion of a wide-angle lens, the device comprising:
[0025] An input module, used for inputting an original distorted image and a preset first calibration image;
[0026] A determination module, configured to determine a second calibration image according to the original distorted image and the first calibration image;
[0027] A calculation module, configured to calculate the distorted image coordinates corresponding to the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model;
[0028] a correction module, configured to determine a difference parameter of the second calibration image, and correct the coordinates of the distorted image according to the difference parameter;
[0029] The output module is used to output the corrected image according to the pixel values corresponding to the coordinates of the corrected distorted image.
[0030] According to the device for correcting wide-angle lens image distortion according to the embodiment of the present invention, the device does not need to calibrate multiple groups of distortion parameters, but only needs to calculate a group of distortion parameters corresponding to the maximum resolution image to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0031] In view of the above-mentioned problems, the present invention further proposes a photographic device, wherein the device is provided with the device for correcting wide-angle lens image distortion as described in any of the above-mentioned embodiments.
[0032] According to the photographic device of the embodiment of the present invention, the device does not need to calibrate multiple groups of distortion parameters, and only needs to calculate a group of distortion parameters corresponding to the maximum resolution image to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0033] In view of the above problems, the present invention further provides an electronic device, which includes: a processor, a memory; and
[0034] A program for correcting wide-angle lens image distortion stored in the memory and executable on the processor, wherein when the program for correcting wide-angle lens image distortion is executed by the processor, the method for correcting wide-angle lens image distortion as described in any of the above embodiments is implemented.
[0035] According to the electronic device of the embodiment of the present invention, the device does not need to calibrate multiple sets of distortion parameters, but only needs to calculate a set of distortion parameters corresponding to the maximum resolution image to realize the correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0036] In response to the above-mentioned problems, the present invention further proposes a computer-readable storage medium, on which is stored a program for correcting wide-angle lens image distortion. When the program for correcting wide-angle lens image distortion is executed by a processor, the method for correcting wide-angle lens image distortion as described in any of the above-mentioned embodiments is implemented.
[0037] According to the computer-readable storage medium of an embodiment of the present invention, when the program for correcting wide-angle lens image distortion stored thereon is executed by a processor, there is no need to calibrate multiple groups of distortion parameters. Only one group of distortion parameters corresponding to the maximum resolution image needs to be calculated to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0038] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0040] Figure 1 is a flow chart of a method for correcting wide-angle lens image distortion according to an embodiment of the present invention;
[0041] Figure 2 is a schematic diagram of multi-resolution size image distortion correction according to an embodiment of the present invention;
[0042] Figure 3 is a schematic structural diagram of a device for correcting wide-angle lens image distortion according to an embodiment of the present invention;
[0043] Figure 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to be able to understand the features and technical contents of the embodiments of the present invention in more detail, the implementation of the embodiments of the present invention is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present invention. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0045] Reference below Figure 1-Figure 4 A method, an apparatus and a photographic device for correcting image distortion of a wide-angle lens according to an embodiment of the present invention are described.
[0046] Figure 1 FIG. 4 is a flow chart of a method for correcting image distortion of a wide-angle lens according to an embodiment of the present invention. Figure 1 As shown, the method includes steps S1 to S5:
[0047] Step S1: input the original distorted image and the preset first calibration image.
[0048] The original distorted image is, for example, an image captured by a wide-angle lens of a camera, and the image has distortion caused by the wide-angle capture. The first calibration image is a preset calibration image.
[0049] Step S2: Determine a second calibration image according to the original distorted image and the first calibration image.
[0050] Step S3: Calculate the distorted image coordinates corresponding to the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model.
[0051] It is understandable that, since the first calibration image is a preset calibration image, the distortion mathematical model of the first calibration image can also be preset accordingly, that is, the distortion parameters corresponding to the first calibration image are pre-calculated. For example, a checkerboard image can be used to calculate the distortion parameters that conform to the distortion mathematical model. Using a checkerboard image to calculate the distortion parameters belongs to the prior art and will not be described in detail here.
[0052] In a specific embodiment, when calculating the distorted image coordinates corresponding to the second calibration image, the distorted image coordinates corresponding to the entire second calibration image can be calculated, for example, the distorted image coordinates corresponding to each pixel point in the second calibration image are calculated respectively, thereby improving the integrity and accuracy of the data, thereby facilitating improving the accuracy of image correction.
[0053] In another specific embodiment, it is also possible that the distorted image coordinates corresponding to the entire second calibration image do not need to be calculated, and the distorted image coordinates corresponding to the coordinates of the second calibration image only need to be calculated at intervals, and the coordinates within the intervals can be estimated by interpolation. For example, in the second calibration image, points are taken according to a preset interval, the distorted image coordinates corresponding to these points are calculated, and then the distorted image coordinates corresponding to other points between each adjacent point are estimated by interpolation. Compared with calculating the distorted image coordinates corresponding to the entire image, this method can reduce the algorithm complexity, reduce the amount of calculation, and improve the calculation efficiency.
[0054] Step S4: Determine the difference parameter of the second calibration image, and correct the distorted image coordinates according to the difference parameter.
[0055] Step S5: Output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
[0056] In a specific embodiment, the coordinates of the corrected distorted image are likely not integers, that is, the coordinate values have decimal points, so the calculated coordinates can be rounded, for example, the integer coordinates closest to the coordinates are selected, the pixel values corresponding to the integer coordinates are assigned to the pixel values corresponding to the corrected image coordinates, and the corrected image is obtained and output. In other embodiments, interpolation methods can also be used to obtain pixel values of distorted image coordinates, such as bilinear interpolation method, etc.
[0057] Therefore, the method for correcting the image distortion of a wide-angle lens according to the embodiment of the present invention determines the second calibration image according to the original distorted image and the first calibration image, and can correct the original distorted image of any resolution by calculating the distorted image coordinates corresponding to the second calibration image and the difference parameters of the second calibration image, that is, assigning the pixel values corresponding to the corrected distorted image coordinates to the correction image, and outputting the correction image. Since the first calibration image is a preset calibration image, correspondingly, the distortion mathematical model of the first calibration image can also be preset, that is, the distortion parameters corresponding to the first calibration image are calculated in advance. Therefore, the method only needs to calculate a set of distortion parameters, that is, calculate the distortion parameters corresponding to the first calibration image, to realize the correction of the original wide-angle distorted image of any resolution, avoiding the situation where multiple sets of distortion parameters need to be calibrated when the image taken by the wide-angle camera has multiple resolutions, thereby greatly simplifying the correction process.
[0058] In a specific embodiment, the first calibration image is an image with maximum resolution taken by a wide-angle camera, and the distortion parameter error corresponding to the image is the smallest. Thus, it is possible to avoid the situation where the distortion parameter error is too large when calibrating a small-resolution image, thereby improving the accuracy of the correction.
[0059] In one embodiment of the present invention, in step S2, determining the second calibration image according to the original distorted image and the first calibration image includes: determining an image corresponding to the maximum resolution with the same aspect ratio as the original distorted image under the resolution of the first calibration image as the second calibration image. That is, under the preset resolution corresponding to the first calibration image, searching for an image corresponding to the maximum resolution with the same aspect ratio as the original distorted image. For example, the resolution size of the distorted image is obtained, and compared with the preset maximum resolution of the first calibration image, and the image with the same aspect ratio as the original distorted image and the maximum resolution is found, which is the second calibration image. Assuming that the resolution of the first calibration image is 2560x1920, the resolution of the original distorted image currently captured is 1920x1080, and its aspect ratio is 16:9, then under the resolution of the first calibration image, the maximum resolution with an aspect ratio of 16:9 is 2560x1440, and the image corresponding to the resolution of 2560x1440 is the second calibration image.
[0060] In one embodiment of the present invention, the difference parameter of the second calibration image includes: a size ratio coefficient between the second calibration image and the original distorted image, and an edge size difference between the first calibration image and the second calibration image.
[0061] In one embodiment of the present invention, determining the difference parameter of the second calibration image includes:
[0062] Step S31-1: Determine the resolution ratio of the second calibration image to the original distorted image as a size ratio coefficient.
[0063] Step S32-1: Determine the difference in the number of pixels between the first calibration image and the second calibration image in the horizontal and vertical directions as the edge size difference. This process is a process for determining the difference parameter of the second calibration image when the camera does not have digital zoom.
[0064] It can be understood that the resolution refers to the number of pixels in the horizontal (horizontal) and vertical (longitudinal) directions of the image, for example: 1920x1080 resolution, that is, the image has 1920 pixels in the horizontal direction and 1080 pixels in the vertical direction, and the resolution ratio, that is, the size ratio coefficient, is the ratio of the number of pixels in the horizontal direction of the second calibration image to the original distorted image, or the ratio of the number of pixels in the vertical direction of the second calibration image to the original distorted image. It can also be understood that the first calibration image and the second calibration image both include multiple edges, so the edge size difference includes the size difference corresponding to each edge of the first calibration image and the second calibration image.
[0065] by Figure 2 Take this as an example to illustrate: Figure 2 4 is a schematic diagram of multi-resolution size image distortion correction according to an embodiment of the present invention.
[0066] In a specific embodiment, Figure 2 In the example shown, the resolution of the first calibration image is 2560*1920, the resolution of the original distorted image is 1920*1080, and the aspect ratio is 16:9. The resolution of the second calibration image determined based on the first calibration image and the original distorted image is 2560*1440, the size ratio coefficient is 4:3=1.1, and the edge size difference is 1920-1440=480. It can be understood that the edge size difference includes the following: Figure 2 As shown in the upper and lower and left and right parts, the excess length of the horizontal upper edge is 0, that is, the size difference in the left and right directions is 0; the excess length of the vertical upper edge is (1920-1440)÷2=240, that is, the size difference in the upper and lower directions is 240 each.
[0067] In one embodiment of the present invention, determining the difference parameter of the second calibration image includes:
[0068] Step S31-2: Determine the resolution ratio of the second calibration image to the original distorted image, and use the ratio of the resolution ratio to the digital zoom factor of the wide-angle lens as a size ratio coefficient.
[0069] Step S32-2: determine a first ratio of the number of pixels of the second calibration image in the horizontal direction to the digital zoom multiple, determine a first difference between the number of pixels of the second calibration image in the horizontal direction and the first ratio, determine a second difference between the number of pixels of the first calibration image and the second calibration image in the horizontal direction; and determine a second ratio of the number of pixels of the second calibration image in the vertical direction to the digital zoom multiple, determine a third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, and determine a fourth difference between the number of pixels of the first calibration image and the second calibration image in the vertical direction; determine the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference as the edge size difference. This process is a process of determining the difference parameters of the second calibration image when the camera has digital zoom. The principle of digital zoom is the process of first enlarging the image and then cropping it. Therefore, the image actually captured is cropped relative to the image without zooming. When calculating the distortion parameters, this part of the cropping needs to be subtracted. Therefore, it is necessary to consider the impact of the digital zoom multiple on the calculation of the distorted image coordinates.
[0070] Specifically, most current photographic devices support digital zoom technology, but digital zoom of wide-angle lenses can cause abnormalities in the correction of distorted images based on traditional methods. The embodiments of the present invention calculate the difference parameters of the second calibration image under digital zoom, and can correct the original distorted image of any resolution through the distorted image coordinates corresponding to the second calibration image. The method only needs to calculate the distortion parameters corresponding to the first calibration image, avoiding the need to calibrate multiple sets of distortion parameters when the image taken by the wide-angle camera has multiple resolutions, simplifying the correction process, and at the same time, considering the impact of digital zoom on the calculation of distorted image coordinates, further improving the accuracy of correction.
[0071] In a specific embodiment, the first calibration image is an image of maximum resolution taken by a wide-angle camera, the resolution of which is 2560*1920, the resolution of the original distorted image is 1920*1080, and the aspect ratio is 16:9, then the resolution of the second calibration image is 2560*1440, assuming that the digital zoom factor of the wide-angle camera is 1.2x, the size ratio coefficient is 4:3:1.2=1.1, and the edge size difference needs to be based on the edge size difference when there is no digital zoom plus 2560-2560 / 1.2=426 and 1440–1440 / 1.2=240. It can be understood that the edge size difference includes two parts, the upper and lower parts and the left and right parts, so the excess length of the edge in the horizontal direction is 426÷2=213.3, and the excess length of the edge in the vertical direction is 240÷2+240=360.
[0072] In one embodiment of the present invention, the distorted image coordinates are corrected according to the difference parameters, including:
[0073] Step S41: translating the distorted image coordinates according to the edge size difference.
[0074] Step S42: scaling the coordinates of the distorted image after translation according to the size ratio coefficient.
[0075] Specifically, translating the distorted image coordinates according to the edge size difference includes: translating the distorted image coordinates corresponding to the second calibration image in the horizontal direction by a distance equal to the excess length of the edge in the horizontal direction, that is, the size difference in the horizontal direction, and translating the distorted image coordinates corresponding to the second calibration image in the vertical direction by a distance equal to the excess length of the edge in the vertical direction, that is, the size difference in the vertical direction. Scaling the translated distorted image coordinates according to the size ratio coefficient, the scaling ratio being the size ratio coefficient.
[0076] In a specific embodiment, when the wide-angle lens does not have digital zoom, the resolution of the first calibration image is 2560*1920, the resolution of the original distorted image is 1920*1080, and the aspect ratio is 16:9. The resolution of the second calibration image is 2560*1440, and the distorted image coordinates corresponding to the second calibration image are translated horizontally by 0 and vertically by 240. The translated distorted image coordinates are then scaled, and the scaling ratio is 4:3=1.33. For example, when the wide-angle lens does not have digital zoom, assuming that the resolution of the first calibration image is 2560*1920, the resolution of the original distorted image is 1920*1080, and the aspect ratio is 16:9, then the resolution of the second calibration image is 2560*1440, and the distorted image coordinates corresponding to the second calibration image are, for example, (72.8, 285.6). The coordinates are translated to the left by 0 in the horizontal direction and translated downward by 240 in the vertical direction to obtain (72.8, 45.6), and then divided by the proportional coefficient 1.33 to obtain the corrected distorted coordinates (54.6, 34.2). Since the coordinates are not integers, the nearest integer coordinates to the coordinates are selected, and the pixel values corresponding to the integer coordinates are assigned to the pixel values corresponding to the corrected image coordinates to obtain the corrected image, and the corrected image is output. The pixel values of the distorted image coordinates can also be obtained by interpolation, such as bilinear interpolation, and then the pixel values are assigned to the pixel values corresponding to the corrected image coordinates to obtain the corrected image.
[0077] When the wide-angle lens has digital zoom, assuming that the digital zoom ratio is 1.2x, the resolution of the first calibration image is 2560*1920, the resolution of the original distorted image is 1920*1080, and the aspect ratio is 16:9, then the resolution of the second calibration image is 2560*1440, and the distorted image coordinates corresponding to the second calibration image are translated by a distance of 213.3 in the horizontal direction and 360 in the vertical direction, and then the translated distorted image coordinates are scaled, and the scaling ratio is 4:3:1.2=1.1. For example, when the wide-angle lens has digital zoom, assuming that the digital zoom ratio is 1.2x, the resolution of the first calibration image is 2560*1920, the resolution of the original distorted image is 1920*1080, and the aspect ratio is 16:9, then the resolution of the second calibration image is 2560*1440, and the distorted image coordinates corresponding to the second calibration image are, for example, (274,398). The coordinates are translated to the left by 213.3 in the horizontal direction and translated downward by 360 in the vertical direction to obtain (60.7,38), and then divided by the proportional coefficient 1.1 to obtain the corrected distorted coordinates (54.6,34.2). Since the coordinates are not integers, the integer coordinates closest to the coordinates are selected, and the pixel values corresponding to the integer coordinates are assigned to the pixel values corresponding to the corrected image coordinates to obtain the corrected image, and the corrected image is output. The pixel values of the distorted image coordinates may also be obtained by using an interpolation method, such as a bilinear interpolation method, and then the pixel values are assigned to the pixel values corresponding to the corrected image coordinates to obtain a corrected image.
[0078] In summary, according to the method for correcting wide-angle lens image distortion according to an embodiment of the present invention, there is no need to calibrate multiple sets of distortion parameters. It is only necessary to calculate the distortion parameters corresponding to a set of maximum resolution images to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0079] A further embodiment of the present invention also discloses a device for correcting image distortion of a wide-angle lens. Figure 3 FIG. 1 is a schematic diagram of a structure of a device for correcting image distortion of a wide-angle lens according to an embodiment of the present invention. Figure 3 As shown, the device 10 comprises:
[0080] An input module 11 is used to input an original distorted image and a preset first calibration image, and a determination module 12 is used to determine a second calibration image based on the original distorted image and the first calibration image, and a calculation module 13 is used to calculate the distorted image coordinates corresponding to the second calibration image based on the distortion parameters of the first calibration image and the distortion mathematical model, and a correction module 14 is used to determine the difference parameters of the second calibration image and correct the distorted image coordinates according to the difference parameters, and an output module 15 is used to output a corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
[0081] In one embodiment of the present invention, the determination module 12 is further used to determine a second calibration image based on the original distorted image and the first calibration image, including: determining an image corresponding to a maximum resolution having the same aspect ratio as the original distorted image under the resolution of the first calibration image as the second calibration image.
[0082] In one embodiment of the present invention, the correction module 14 is further used to determine the difference parameters of the second calibration image, and then correct the distorted image coordinates according to the difference parameters, wherein the difference parameters include: a size ratio coefficient between the second calibration image and the original distorted image, and an edge size difference between the first calibration image and the second calibration image.
[0083] In one embodiment of the present invention, the correction module 14 is further used to determine the difference parameters of the second calibration image, including: the correction module 14 is used to determine the resolution ratio of the second calibration image to the original distorted image as the size ratio coefficient, and to determine the difference in the number of pixels in the horizontal and vertical directions between the first calibration image and the second calibration image as the edge size difference.
[0084] In one embodiment of the present invention, the correction module 14 is further used to determine the difference parameter of the second calibration image, including:
[0085] The correction module 14 determines a resolution ratio between the second calibration image and the original distorted image, takes the ratio of the resolution ratio to the digital zoom multiple of the wide-angle lens as the size ratio coefficient, and determines a first ratio of the number of pixels of the second calibration image in the horizontal direction to the digital zoom multiple, determines a first difference between the number of pixels of the second calibration image in the horizontal direction and the first ratio, determines a second difference between the number of pixels of the first calibration image and the second calibration image in the horizontal direction; and determines a second ratio of the number of pixels of the second calibration image in the vertical direction to the digital zoom multiple, determines a third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, determines a fourth difference between the number of pixels of the first calibration image and the second calibration image in the vertical direction; determines the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference as the edge size difference.
[0086] In one embodiment of the present invention, the correction module 14 is used to correct the distorted image coordinates according to the difference parameter, including: the correction module 14 translates the distorted image coordinates according to the edge size difference.
[0087] The correction module 14 is further configured to scale the coordinates of the distorted image after translation according to the size ratio coefficient.
[0088] According to the device 10 for correcting wide-angle lens image distortion according to an embodiment of the present invention, the device 10 does not need to calibrate multiple sets of distortion parameters, but only needs to calculate a set of distortion parameters corresponding to the maximum resolution image to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0089] A further embodiment of the present invention also discloses a photographic device, which is provided with the device 10 for correcting wide-angle lens image distortion as described in any of the above embodiments.
[0090] In a specific embodiment, the photographic device is, for example but not limited to, an electronic device such as a camera with a wide-angle lens, a mobile phone, a tablet computer, a wearable device, etc.
[0091] It should be noted that when the photographic device of the embodiment of the present invention performs wide-angle lens image distortion correction, its specific implementation method is similar to the specific implementation method of the device for correcting wide-angle lens image distortion of the embodiment of the present invention. Please refer to the description of the device part for details. In order to reduce redundancy, it will not be repeated here.
[0092] According to the photographic device of the embodiment of the present invention, the photographic device does not need to calibrate multiple groups of distortion parameters, and only needs to calculate a group of distortion parameters corresponding to the maximum resolution image to achieve correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0093] A further embodiment of the present invention also discloses a computer-readable storage medium, on which is stored a program for correcting wide-angle lens image distortion. When the program for correcting wide-angle lens image distortion is executed by a processor, the method for correcting wide-angle lens image distortion as described in any of the above embodiments is implemented.
[0094] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0095] According to the computer-readable storage medium of an embodiment of the present invention, when the program for correcting wide-angle lens image distortion stored thereon is executed by a processor, it is only necessary to calculate the distortion parameters corresponding to a set of maximum resolution images to achieve correction of original wide-angle distorted images of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter errors of small-resolution images are too large when calibrating them, thereby improving the accuracy of correction.
[0096] A further embodiment of the present invention also discloses an electronic device.
[0097] In some embodiments, the electronic device includes a device 10 for correcting the distortion of a wide-angle lens image as described in any one of the above embodiments of the present invention. That is, the electronic device may include: an input module 11 for inputting an original distorted image and a preset first calibration image; and a determination module 12 for determining a second calibration image according to the original distorted image and the first calibration image; and a calculation module 13 for calculating the distorted image coordinates corresponding to the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model; and a correction module 14 for determining the difference parameters of the second calibration image and correcting the distorted image coordinates according to the difference parameters; and an output module 15 for outputting a corrected image according to the pixel values corresponding to the corrected distorted image coordinates. Therefore, in some embodiments, when the electronic device is used to correct the distortion of a wide-angle lens image, its specific implementation is similar to the device 10 for correcting the distortion of a wide-angle lens image described in any one of the above embodiments of the present invention. For details, please refer to the above description of the device 10, which will not be repeated here to reduce redundancy.
[0098] In other embodiments, Figure 4As shown, the electronic device includes: a processor 1000, a memory 2000; and a program for correcting wide-angle lens image distortion stored in the memory 2000 and executable on the processor 1000, wherein the program for correcting wide-angle lens image distortion, when executed by the processor 1000, implements the method for correcting wide-angle lens image distortion as described in any of the above embodiments.
[0099] In a specific embodiment, the electronic device is, for example, but not limited to, a camera device, and the camera device includes, for example, but is not limited to, a camera with a wide-angle lens, a mobile phone, a tablet computer, a wearable device, etc.
[0100] According to the electronic device of the embodiment of the present invention, the device does not need to calibrate multiple sets of distortion parameters, but only needs to calculate a set of distortion parameters corresponding to the maximum resolution image to realize the correction of the original wide-angle distorted image of any resolution, which greatly simplifies the correction process and avoids the situation where the distortion parameter error of the small resolution image is too large when calibrating, thereby improving the accuracy of the correction.
[0101] The processor 1000 may be one or more processors. Figure 4 A processor 1000 is taken as an example.
[0102] like Figure 4 As shown, the electronic device may further include a communication interface 3000 and a bus 4000. The processor 1000, the memory 2000, and the communication interface 3000 may communicate with each other through the bus 4000. The communication interface 3000 may be used for information transmission. The processor 1000 may call the logic instructions in the memory 2000 to execute the method for correcting wide-angle lens image distortion of the above embodiment.
[0103] In addition, the logic instructions in the memory 2000 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0104] The memory 2000 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present invention. The processor 1000 executes the functional application and data processing by running the software programs, instructions and modules stored in the memory 2000, that is, the method for correcting wide-angle lens image distortion in the above method embodiment is implemented.
[0105] The memory 2000 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 2000 may include a high-speed random access memory and may also include a non-volatile memory.
[0106] The technical solution of the embodiment of the present invention can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiment of the present invention. The aforementioned storage medium may be a non-transitory storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes, or a transient storage medium.
[0107] When used in the present invention, although the terms "first", "second", etc. may be used in the present invention to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, without changing the meaning of the description, a first element can be called a second element, and similarly, a second element can be called a first element, as long as all occurrences of "first element" are renamed consistently and all occurrences of "second element" are renamed consistently. The first element and the second element are both elements, but may not be the same element.
[0108] The various aspects, implementations, implementations or features of the described embodiments can be used alone or in any combination. The various aspects of the described embodiments can be implemented by software, hardware or a combination of software and hardware. The described embodiments can also be embodied by a computer-readable medium storing computer-readable code, which includes instructions that can be executed by at least one computing device. The computer-readable medium can be associated with any data storage device capable of storing data that can be read by a computer system. Computer-readable media for example can include read-only memory, random access memory, CD-ROM, HDD, DVD, magnetic tape, and optical data storage devices. The computer-readable medium can also be distributed in computer systems connected via a network so that the computer-readable code can be stored and executed in a distributed manner.
[0109] The above technical description may refer to the accompanying drawings, which form a part of the present invention, and the implementation methods according to the described embodiments are shown in the accompanying drawings by way of description. Although the embodiments are described in sufficient detail to enable those skilled in the art to implement the embodiments, the embodiments are non-restrictive; other embodiments may be used in this way, and changes may be made without departing from the scope of the described embodiments. For example, the order of operations described in the flowchart is non-restrictive, so the order of two or more operations illustrated in the flowchart and described according to the flowchart may be changed according to several embodiments. As another example, in several embodiments, one or more operations illustrated in the flowchart and described according to the flowchart are optional or deletable. In addition, certain steps or functions may be added to the disclosed embodiments, or the order of two or more steps may be replaced. All these changes are considered to be included in the disclosed embodiments and claims.
[0110] In addition, terms are used in the above technical description to provide a thorough understanding of the described embodiments. However, overly detailed details are not required to implement the described embodiments. Therefore, the above description of the embodiments is presented for the purpose of explanation and description. The embodiments presented in the above description and the examples disclosed according to these embodiments are provided separately to add context and help understand the described embodiments. The above description is not intended to be exhaustive or to limit the described embodiments to the precise form of the invention. According to the above teachings, several modifications, selective applications and changes are feasible. In some cases, well-known processing steps are not described in detail to avoid unnecessarily affecting the described embodiments.
[0111] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.
[0112] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for correcting wide-angle lens image distortion, characterized in that: include: Inputting an original distorted image and a preset first calibration image; Determining a second calibration image according to the original distorted image and the first calibration image; Calculating the distorted image coordinates corresponding to the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model; Determining a difference parameter of the second calibration image, and correcting the distorted image coordinates according to the difference parameter; Outputting a corrected image according to the pixel values corresponding to the coordinates of the corrected distorted image; The difference parameters include: a size ratio coefficient between the second calibration image and the original distorted image, and an edge size difference between the first calibration image and the second calibration image; Determining a difference parameter of the second calibration image includes: Determine a resolution ratio between the second calibration image and the original distorted image, and use a ratio of the resolution ratio to a digital zoom factor of a wide-angle lens as the size ratio coefficient; Determine a first ratio of the number of pixels of the second calibration image in the horizontal direction to the digital zoom multiple, determine a first difference between the number of pixels of the second calibration image in the horizontal direction and the first ratio, and determine a second difference between the number of pixels of the first calibration image and the second calibration image in the horizontal direction; and determine a second ratio of the number of pixels of the second calibration image in the vertical direction to the digital zoom multiple, determine a third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, and determine a fourth difference between the number of pixels of the first calibration image and the second calibration image in the vertical direction; determine the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference as the edge size difference.
2. The method for correcting wide-angle lens image distortion according to claim 1, characterized in that: Determining a second calibration image according to the original distorted image and the first calibration image includes: determining an image corresponding to a maximum resolution under the resolution of the first calibration image and having the same aspect ratio as the original distorted image as the second calibration image.
3. The method for correcting wide-angle lens image distortion according to claim 1, characterized in that: Correcting the distorted image coordinates according to the difference parameter includes: translating the distorted image coordinates according to the edge size difference; The coordinates of the distorted image after translation are scaled according to the size ratio coefficient.
4. A device for correcting wide-angle lens image distortion, characterized in that: include: An input module, used for inputting an original distorted image and a preset first calibration image; A determination module, configured to determine a second calibration image according to the original distorted image and the first calibration image; A calculation module, configured to calculate the distorted image coordinates corresponding to the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model; a correction module, configured to determine difference parameters of the second calibration image, and to correct the distorted image coordinates according to the difference parameters; the difference parameters include: a size ratio coefficient between the second calibration image and the original distorted image, and an edge size difference between the first calibration image and the second calibration image; determining the difference parameters of the second calibration image includes: determining a resolution ratio between the second calibration image and the original distorted image, and using a ratio of the resolution ratio to a digital zoom multiple of a wide-angle lens as the size ratio coefficient; determining a first ratio of the number of pixels of the second calibration image in the horizontal direction to the digital zoom multiple; and determining a first ratio of the number of pixels of the second calibration image in the horizontal direction to the digital zoom multiple. value, determining a first difference between the number of pixels of the second calibration image in the horizontal direction and the first ratio, determining a second difference between the number of pixels of the first calibration image and the second calibration image in the horizontal direction; and determining a second ratio between the number of pixels of the second calibration image in the vertical direction and the digital zoom multiple, determining a third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, and determining a fourth difference between the number of pixels of the first calibration image and the second calibration image in the vertical direction; determining the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference as the edge size difference; The output module is used to output the corrected image according to the pixel values corresponding to the coordinates of the corrected distorted image.
5. A photographic device, characterized in that: A device for correcting wide-angle lens image distortion as claimed in claim 4 is provided.
6. An electronic device, characterized in that: include: Processor, memory; as well as A program for correcting wide-angle lens image distortion stored in the memory and executable on the processor, wherein when the program for correcting wide-angle lens image distortion is executed by the processor, the method for correcting wide-angle lens image distortion as claimed in any one of claims 1 to 3 is implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program for correcting wide-angle lens image distortion, and when the program for correcting wide-angle lens image distortion is executed by a processor, the method for correcting wide-angle lens image distortion as claimed in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Image correction method of binocular camera and storage medium
CN109961401A