WO2023070862A1 - Method and apparatus for correcting image distortion of wide-angle lens, and photographing device - Google Patents

Method and apparatus for correcting image distortion of wide-angle lens, and photographing device Download PDF

Info

Publication number
WO2023070862A1
WO2023070862A1 PCT/CN2021/137562 CN2021137562W WO2023070862A1 WO 2023070862 A1 WO2023070862 A1 WO 2023070862A1 CN 2021137562 W CN2021137562 W CN 2021137562W WO 2023070862 A1 WO2023070862 A1 WO 2023070862A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
calibration image
difference
calibration
distortion
Prior art date
Application number
PCT/CN2021/137562
Other languages
French (fr)
Chinese (zh)
Inventor
王辉
Original Assignee
上海闻泰信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海闻泰信息技术有限公司 filed Critical 上海闻泰信息技术有限公司
Publication of WO2023070862A1 publication Critical patent/WO2023070862A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Definitions

  • the present disclosure relates to a method, device and camera equipment for correcting image distortion of a wide-angle lens.
  • the correction technology of wide-angle lens image distortion generally uses the checkerboard image to calculate the distortion parameters conforming to the distortion mathematical model, and then performs coordinate transformation on the distorted image through the distortion parameters and the distortion mathematical model to achieve the purpose of correction.
  • the same camera shoots images with different resolutions, due to errors in the distortion parameters calculated from images with different resolutions, it will directly use the distortion parameters calculated from the previous resolutions to process images of different resolutions captured by the same model of camera lens.
  • correction abnormality occurs.
  • a method, an apparatus, and a photographing apparatus for correcting image distortion of a wide-angle lens are provided.
  • a method for correcting image distortion of a wide-angle lens comprising:
  • the method for correcting image distortion of a wide-angle lens may also have the following additional technical features:
  • determining the second calibration image according to the original distorted image and the first calibration image includes: determining a maximum resolution under the resolution of the first calibration image that is the same as the aspect ratio of the original distorted image The image corresponding to the rate is used as the second calibration 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 the difference parameter of the second calibration image includes: determining the resolution ratio of the second calibration image to the original distorted image as the size scale factor; determining the ratio of the first calibration image to the The difference between the number of pixels in the horizontal direction and the vertical direction of the second calibration image is the difference in edge size.
  • determining the difference parameter of the second calibration image includes: determining a resolution ratio of the second calibration image to the original distorted image, and using the ratio of the resolution ratio to the digital zoom factor of the wide-angle lens as the ratio The size ratio factor; determine the first ratio of the number of pixels in the horizontal direction of the second calibration image to the digital zoom factor, and determine the number of pixels in the horizontal direction of the second calibration image and the first ratio Determine the first difference between the number of pixels in the horizontal direction of the first calibration image and the second calibration image; and determine the difference between the number of pixels in the vertical direction of the second calibration image and The second ratio of the digital zoom factor determines the third difference between the number of pixels in the vertical direction of the second calibration image and the second ratio, and determines the first calibration image and the second calibration image
  • the fourth difference in the number of pixels 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.
  • correcting the distorted image coordinates according to the difference parameter includes: translating the distorted image coordinates according to the edge size difference; scaling the translated distorted image coordinates according to the size ratio coefficient .
  • 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 includes:
  • 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 further includes:
  • pixel points are taken out according to preset intervals, and the coordinates of the distorted image corresponding to the pixel points are calculated;
  • output the corrected image according to the pixel value corresponding to the corrected distorted image coordinates including:
  • the corrected image is output.
  • the translation of the distorted image coordinates according to the edge size difference includes:
  • the distance that the distorted image coordinates corresponding to the second calibration image are translated in the vertical direction is taken as the size difference in the vertical direction.
  • a device for correcting image distortion of a wide-angle lens comprising:
  • the input module is configured to input the original distorted image and the preset first calibration image
  • a determining 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 a difference parameter of the second calibration image, and correct the coordinates of the distorted image according to the difference parameter;
  • the output module is configured to output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
  • the determining module is specifically configured to: determine the maximum resolution below the resolution of the first calibration image corresponding to the aspect ratio of the original distorted image image, as the second calibration image.
  • the difference parameter includes: the size ratio coefficient between the second calibration image and the original distorted image, and the first calibration image and the second calibration image The edge size difference of the image.
  • the correction module is specifically configured to: determine the ratio of the resolution of the second calibration image to the original distorted image as the size ratio coefficient, and determine the first calibration
  • the difference in the number of pixels in the horizontal and vertical directions between the image and the second calibration image is the difference in edge size.
  • the correction module is specifically configured to: determine the resolution ratio between the second calibration image and the original distorted image, and combine the resolution ratio with the digital zoom of the wide-angle lens
  • the ratio of multiples is used as the size scale factor; determine the first ratio between the number of pixels in the horizontal direction of the second calibration image and the digital zoom multiple, determine the number of pixels in the horizontal direction of the second calibration image and The first difference of the first ratio determines the second difference in the number of pixels in the horizontal direction between the first calibration image and the second calibration image; and determines the vertical direction of the second calibration image
  • the second ratio of the number of pixels of the second calibration image to the digital zoom factor determine the third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, and determine the first calibration image and the second ratio
  • the fourth difference value of the number of pixels in the vertical direction of the second calibration image determine the sum of the first difference value and the second difference value, and the difference between the third difference value and the fourth difference value and are the edge size difference.
  • the correction module is further configured to:
  • the calculation module is specifically configured to:
  • the calculation module is specifically configured to:
  • pixel points are taken out according to preset intervals, and the coordinates of the distorted image corresponding to the pixel points are calculated;
  • a photographic device is provided with the device for correcting image distortion of a wide-angle lens according to any one of the above embodiments.
  • An electronic device comprising: a memory and one or more processors, the memory is configured as a module storing computer-readable instructions that, when executed by the processor, cause the One or more processors execute the steps of the method for correcting wide-angle lens image distortion provided by any embodiment of the present disclosure.
  • One or more non-volatile storage media storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the correction wide-angle lens provided by any embodiment of the present disclosure The steps of the image warping method.
  • FIG. 1 is a flowchart of a method for correcting image distortion of a wide-angle lens according to one or more embodiments of the present disclosure
  • Fig. 2 is a schematic diagram of multi-resolution size image distortion correction according to one or more embodiments of the present disclosure
  • FIG. 3 is a schematic structural diagram of an apparatus for correcting image distortion of a wide-angle lens according to one or more embodiments of the present disclosure
  • Fig. 4 is a schematic structural diagram of an electronic device according to one or more embodiments of the present disclosure.
  • FIG. 1 is a flowchart of a method for correcting image distortion of a wide-angle lens according to an embodiment of the present disclosure. As shown in Figure 1, the method includes steps S1 to S5:
  • Step S1 Input the original distorted image and the preset first calibration image.
  • the original distorted image is, for example, an image taken by a wide-angle lens of a camera, and the image has distortion caused by wide-angle shooting.
  • the first calibration image is a preset calibration image.
  • 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.
  • the distortion mathematical model of the first calibration image may also be preset, that is, the distortion parameter corresponding to the first calibration image is calculated in advance.
  • a checkerboard image can be used to calculate a distortion parameter conforming to a distortion mathematical model, and the use of a checkerboard image to calculate a distortion parameter belongs to the prior art, and details will not be described here.
  • the distorted image coordinates corresponding to the entire image of the second calibration image can be calculated, for example, the distorted image corresponding to each pixel in the second calibration image can be calculated separately Coordinates, thus, can improve the integrity and accuracy of data, which in turn helps to improve the accuracy of image correction.
  • Step S4 Determine the difference parameter of the second calibration image, and correct the coordinates of the distorted image according to the difference parameter.
  • Step S5 output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
  • the coordinates of the corrected distorted image are probably not integers, that is, there are decimal points in the coordinate values, so the calculated coordinates can be rounded, for example, the nearest integer coordinate to the coordinate is selected, and the corresponding integer coordinate
  • the pixel value is assigned to the pixel value corresponding to the coordinates of the corrected image to obtain the corrected image and output the corrected image.
  • an interpolation method may also be used to obtain pixel values of the distorted image coordinates, such as bilinear interpolation and the like.
  • the second calibration image is determined according to the original distorted image and the first calibration image, and the difference parameters of the distortion image corresponding to the second calibration image and the second calibration image can be calculated for any
  • the resolution of the original distorted image is corrected, that is, the pixel value corresponding to the corrected distorted image coordinate is assigned to the corrected image, and the corrected image is output.
  • the first calibration image is a preset calibration image, correspondingly, the distortion mathematical model of the first calibration image may also be preset, that is, the distortion parameter corresponding to the first calibration image is calculated in advance.
  • this method only needs to calculate a set of distortion parameters, that is, calculate the distortion parameters corresponding to the first calibration image, and then realize the correction of the original wide-angle distorted image with any resolution, avoiding the existence of distortion in the image captured by the wide-angle camera.
  • a set of distortion parameters that is, calculate the distortion parameters corresponding to the first calibration image
  • multiple sets of distortion parameters need to be calibrated, which greatly simplifies the calibration process.
  • the first calibration image is an image with the largest resolution captured by a wide-angle camera, and the distortion parameter error corresponding to this image is the smallest, thus, it is possible to avoid the distortion parameter error calibrated when the small resolution image is calibrated If it is too large, the accuracy of the correction is improved.
  • step S2 determining the second calibration image according to the original distorted image and the first calibration image includes: determining that the resolution of the first calibration image is the same as the aspect ratio of the original distorted image
  • the image corresponding to the maximum resolution of is used as the second calibration image.
  • an image corresponding to the maximum resolution with the same aspect ratio as the original distorted image is searched for.
  • the acquired resolution of the distorted image is 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 largest resolution is found, which is the second Calibration image.
  • the resolution of the first calibration image is 2560x1920
  • the resolution of the currently captured original distorted image is 1920x1080
  • its aspect ratio is 16:9
  • the aspect ratio is also 16:9
  • the maximum resolution of is 2560x1440
  • the image corresponding to the resolution of 2560x1440 is the second calibration image.
  • 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.
  • determining the difference parameter of the second calibration image includes:
  • Step S31-1 Determine the ratio of the resolution of the second calibration image to the original distorted image as the size ratio coefficient.
  • 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 the difference parameter of the second calibration image when there is no digital zoom in the camera determination process.
  • the resolution refers to the number of pixels in the horizontal (horizontal) and vertical (vertical) 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.
  • Ratio that is, the size ratio coefficient is the ratio of the number of pixels in the horizontal direction between the second calibration image and the original distorted image, or the ratio of the number of pixels in the vertical direction between the second calibration image and the original distorted image.
  • both the first calibration image and the second calibration image include a plurality of edges, and thus the edge size difference includes the corresponding size difference between the first calibration image and the second calibration image at each edge.
  • FIG. 2 is a schematic diagram of multi-resolution size image distortion correction according to an embodiment of the present disclosure.
  • the resolution of the first calibration image is 2560*1920
  • the resolution of the original distorted image is 1920*1080
  • the aspect ratio is 16:9
  • the resolution of the second calibration image determined by the calibration image and the original distorted image is 2560*1440
  • the edge size difference includes the upper, lower and left and right parts as shown in Figure 2, then the excess length of the edge in the transverse direction is 0, that is, the size difference in the left and right directions is 0;
  • determining the difference parameter of the second calibration image includes:
  • 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 the size ratio factor.
  • Step S32-2 determine the first ratio between the number of pixels in the horizontal direction of the second calibration image and the digital zoom factor, determine the first difference between the number of pixels in the horizontal direction of the second calibration image and the first ratio, and determine the first ratio
  • the second difference in the number of pixels in the horizontal direction between the first calibration image and the second calibration image The third difference between the number of pixels in the vertical direction and the second ratio determines the fourth difference in the number of pixels in the vertical direction between the first calibration image and the second calibration image; determine the difference between the first difference and the second difference and, and the sum of the third difference and the fourth difference is the edge size difference.
  • This process is the process of determining the difference parameters of the second calibration image when the camera has digital zoom.
  • the principle of digital zoom is that the image is first enlarged and then cropped.
  • the digital zoom of the wide-angle lens will cause the correction of the distorted image based on the traditional method to be abnormal.
  • the embodiment of the present disclosure calculates the difference parameter of the second calibration image under the digital zoom , and the original distorted image with any resolution can be corrected through the distorted image coordinates corresponding to the second calibration image.
  • This method only needs to calculate the distortion parameters corresponding to the first calibration image, which avoids multiple resolutions in the image captured by the wide-angle camera.
  • the rate is high, multiple sets of distortion parameters need to be calibrated, which simplifies the correction process.
  • the influence of digital zoom on the calculation of the distorted image coordinates is considered, which further improves the accuracy of the correction.
  • the first calibration image is an image with the 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.
  • correcting the distorted image coordinates according to the difference parameters includes:
  • Step S41 Translate the distorted image coordinates according to the edge size difference.
  • Step S42 scaling the translated distorted image coordinates according to the size ratio coefficient.
  • 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 lateral direction by an excess length of the edge in the lateral direction, that is, For the size difference, the distance to translate the distorted image coordinates corresponding to the second calibration image in the vertical direction is the excess length of the edge in the vertical direction, that is, the size difference in the vertical direction.
  • Scale the translated distorted image coordinates according to the size scale factor, and the zoom ratio is the size scale factor.
  • the resolution of the first calibration image is 2560*1920
  • the resolution of the original distorted image is 1920*1080
  • the aspect ratio is 16:9
  • the second calibration image The resolution is 2560*1440
  • the translation distance of the distorted image coordinates corresponding to the second calibration image is 0 in the horizontal direction
  • the translation distance in the vertical direction is 240
  • the distorted image coordinates after translation are scaled
  • the resolution of the first calibration image is 2560*1920
  • the resolution of the original distorted image is 1920*1080
  • the aspect ratio is 16:9
  • the resolution of the second calibration image The resolution is 2560*1440
  • the coordinates of the distorted image corresponding to the second calibration image are, for example, (72.8, 285.6), and the coordinates are translated to the left by 0 in the horizontal direction and 240 in the vertical direction to obtain (72.8, 45.6), Then divide by the proportional coefficient 1.33 to get the corrected distortion coordinates (54.6, 34.2).
  • 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.
  • the wide-angle lens has digital zoom
  • the digital zoom factor is 1.2x
  • the resolution of the first calibration image is 2560*1920
  • the resolution of the original distorted image is 1920*1080
  • the aspect ratio is 16:9
  • the second calibration The resolution of the image is 2560*1440
  • the translation distance of the distorted image coordinates corresponding to the second calibration image is 213.3 in the horizontal direction
  • the translation distance in the vertical direction is 360
  • the distorted image coordinates after translation are scaled, zoomed
  • the resolution of the first calibration image is 2560*1920
  • the resolution of the original distorted image is 1920*1080
  • the aspect ratio is 16:9.
  • the resolution of the second calibration image is 2560*1440
  • the coordinates of the distorted image corresponding to the second calibration image are, for example, (274,398), and the coordinates are translated 213.3 to the left in the horizontal direction and 360 in the vertical direction to obtain (60.7 , 38), and then divided by the proportional coefficient 1.1 to obtain the corrected distortion coordinates (54.6, 34.2).
  • the coordinates are not integers
  • select the integer coordinates closest to the coordinates and assign the pixel value corresponding to the integer coordinates to the corrected image
  • the pixel values corresponding to the coordinates are used to obtain the corrected image and output the corrected image.
  • 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.
  • steps in the flow chart of FIG. 1 are displayed sequentially as indicated by the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in Fig. 1 may include multiple sub-steps or multiple stages, these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, the execution of these sub-steps or stages The order is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
  • FIG. 3 is a schematic structural diagram of a device for correcting image distortion of a wide-angle lens according to an embodiment of the present disclosure. As shown in FIG. 3 , the device 10 includes:
  • the input module 11 is configured to input the original distorted image and a preset first calibration image
  • the determination module 12 is configured to determine a second calibration image according to the original distorted image and the first calibration image
  • a calculation module 13 It is 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
  • the correction module 14 is configured to determine the difference parameter of the second calibration image, according to the The difference parameter corrects the distorted image coordinates
  • the output module 15 is configured to output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
  • the determining module 12 is specifically configured to: determine an image corresponding to a maximum resolution under the resolution of the first calibration image that is the same as the aspect ratio of the original distorted image, as the Second calibration image.
  • the correction module 14 is specifically configured to: determine the difference parameter of the second calibration image, and then correct the coordinates of the distorted image according to the difference parameter, wherein the difference parameter includes : the scale factor between the second calibration image and the original distorted image, and the edge size difference between the first calibration image and the second calibration image.
  • the correction module 14 is specifically configured to: determine the ratio of the resolution of the second calibration image to the original distorted image as the size scale factor, and determine the ratio of the resolution of the first calibration image to the The difference between the number of pixels in the horizontal direction and the vertical direction of the second calibration image is the difference in the edge size.
  • the correction module 14 is further configured to: 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 the determined The size ratio factor, and determine the first ratio of the number of pixels in the horizontal direction of the second calibration image to the digital zoom factor, and determine the ratio of the number of pixels in the horizontal direction of the second calibration image to the first
  • the first difference of the ratio determines the second difference between the number of pixels in the horizontal direction between the first calibration image and the second calibration image; and determines the number of pixels in the vertical direction of the second calibration image and the second ratio of the digital zoom factor, determine the third difference between the number of pixels in the vertical direction of the second calibration image and the second ratio, and determine the difference between the first calibration image and the second calibration image
  • the fourth difference of the number of pixels in the vertical direction of the image determine the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference is the Edge size difference.
  • the correction module 14 is further configured to: translate the distorted image coordinates according to the edge size difference.
  • the correction module 14 is further configured to: scale the translated distorted image coordinates according to the size scale coefficient.
  • the device 10 does not need to calibrate multiple sets of distortion parameters, and 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 calibration process, and at the same time avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the calibration.
  • a further embodiment of the present disclosure also discloses a photographic device, which is provided with the device 10 for correcting image distortion of a wide-angle lens described in any one of the above embodiments.
  • the camera device is, for example but not limited to, a camera with a wide-angle lens, a mobile phone, a tablet computer, a wearable device and other electronic devices.
  • the photographic equipment does not need to calibrate multiple sets of distortion parameters, and 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 with any resolution, which greatly simplifies The correction process is simplified, and at the same time, the error of the calibrated distortion parameters is too large when the small-resolution image is calibrated, thereby improving the accuracy of the correction.
  • One or more non-volatile storage media storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the correction wide-angle lens provided by any embodiment of the present disclosure The steps of the image warping method.
  • the above-mentioned computer-readable storage medium may be a transitory computer-readable storage medium, or a non-transitory computer-readable storage medium.
  • the program for correcting the image distortion of the wide-angle lens stored thereon when executed by the processor, it only needs to calculate the distortion parameters corresponding to a set of maximum-resolution images to realize the original
  • the correction of the wide-angle distorted image greatly simplifies the correction process, and at the same time avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the correction.
  • a further embodiment of the present disclosure also discloses an electronic device.
  • the electronic device includes the device 10 for correcting image distortion of a wide-angle lens as described in any one of the above-mentioned embodiments of the present disclosure. 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 for determining a second calibration image according to the original distorted image and the first calibration image 12; and a calculation module 13 for calculating the coordinates of the distorted image corresponding to the second calibration image according to the distortion parameter of the first calibration image and the distortion mathematical model, and for determining the difference parameter of the second calibration image, A correction module 14 for correcting the distorted image coordinates according to the difference parameters, and an output module 15 for outputting a corrected image according to pixel values corresponding to the corrected distorted image coordinates.
  • the electronic device when used to correct the distortion of the wide-angle lens image, its specific implementation method is similar to the device 10 for correcting the wide-angle lens image distortion described in any of the above-mentioned embodiments of the present disclosure.
  • the description of the part of the device 10 is omitted here to reduce redundancy.
  • the electronic device includes: a processor 1000, a memory 2000; and a computer that is stored on the memory 2000 and can run on the processor 1000 to correct the image distortion of the wide-angle lens
  • the readable instructions when the computer-readable instructions for correcting the image distortion of the wide-angle lens are executed by the processor 1000 , cause the processor 1000 to execute the steps of the method for correcting the image distortion of the wide-angle lens provided by the embodiment of the present disclosure.
  • the electronic device is, for example, but not limited to a camera device
  • the camera device includes, for example, but not limited to a camera with a wide-angle lens, a mobile phone, a tablet computer, a wearable device, and the like.
  • the device does not need to calibrate multiple sets of distortion parameters, and 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 with any resolution, which greatly simplifies
  • the calibration process avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the calibration.
  • processors 1000 there may be one or more processors 1000 mentioned above, and one processor 1000 is taken as an example in FIG. 4 .
  • the electronic device may also include a communication interface (Communication Interface) 3000 and a bus 4000.
  • a communication interface Communication Interface
  • the processor 1000 , the memory 2000 , and the communication interface 3000 can communicate with each other through the bus 4000 .
  • the communication interface 3000 can be used for information transmission.
  • the processor 1000 may invoke logic instructions in the memory 2000 to execute the method for correcting image distortion of a wide-angle lens in the above embodiments.
  • logic instructions in the above-mentioned memory 2000 may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as an independent product.
  • the memory 2000 can be used to store software programs and computer-executable programs, such as program instructions/modules corresponding to the methods in the embodiments of the present disclosure.
  • the processor 1000 runs software programs, instructions and modules stored in the memory 2000 to execute functional applications and data processing, that is, to implement the method for correcting image distortion of the wide-angle lens in the above method embodiments.
  • 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 program required by at least one function; the data storage area may store data created according to the use of the terminal device, and the like.
  • the memory 2000 may include a high-speed random access memory, and may also include a non-volatile memory.
  • the technical solutions of the embodiments of the present disclosure can be embodied in the form of software products, which are stored in a storage medium and include one or more instructions to make a computer device (which can be a personal computer, a server, or a network equipment, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure.
  • the aforementioned storage medium can be a non-transitory storage medium, including: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
  • first element could be called a second element without changing the meaning of the description
  • second element could be called a first element, as long as all occurrences of "first element” are renamed consistently and all occurrences of "Second component” can be renamed consistently.
  • Both the first element and the second element are elements, but may not be the same element.
  • the aspects, implementations, implementations or features of the described embodiments can be used alone or in any combination. Aspects of the described embodiments can be implemented by software, hardware or a combination of hardware and software.
  • the described embodiments may also be embodied by a computer-readable medium storing computer-readable code comprising instructions executable by at least one computing device.
  • the computer readable medium can be associated with any data storage device that can store data that can be read by a computer system.
  • computer readable media may include read only memory, random access memory, CD-ROM, HDD, DVD, magnetic tape, and optical data storage devices, among others.
  • the computer readable medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.
  • references to the terms “one embodiment,” “some embodiments,” “exemplary embodiments,” “example,” “specific examples,” or “some examples” are intended to mean that the implementation A specific feature, structure, material, or characteristic described by an embodiment or example is included in at least one embodiment or example of the present disclosure.
  • schematic representations of the above terms do not necessarily refer to the same embodiment or example.
  • the correction method for wide-angle lens image distortion provided by this disclosure can realize the correction of the original wide-angle distorted image with any resolution, greatly simplifies the correction process, and effectively avoids the distortion parameter error of calibration when the small-resolution image is calibrated If the situation is too large, the accuracy of the correction is improved, and it has strong industrial applicability.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Abstract

A method and apparatus for correcting image distortion of a wide-angle lens, and a photographing device. The method comprises: inputting an original distorted image and a preset first calibration image (S1); determining a second calibration image according to the original distorted image and the first calibration image (S2); calculating, according to distortion parameters of the first calibration image and a distortion mathematical model, distorted image coordinates corresponding to the second calibration image (S3); determining difference parameters of the second calibration image, and correcting the distorted image coordinates according to the difference parameters (S4); and outputting a corrected image according to pixel values corresponding to the corrected distorted image coordinates (S5). According to the method, there is no need to calibrate a plurality of sets of distortion parameters, and correction of an original wide-angle distorted image of any resolution can be achieved only by calculating one set of distortion parameters corresponding to an image having the maximum resolution, thereby greatly simplifying the correction process, simultaneously avoiding the situation that calibrated distortion parameters have a large error when a small-resolution image is used for calibration, and thus improving correction accuracy.

Description

校正广角镜头图像畸变的方法、装置及照相设备Method and device for correcting wide-angle lens image distortion and photographic equipment
本公开要求于2021年10月25日提交中国专利局、申请号为202111239136.4、发明名称为“校正广角镜头图像畸变的方法、装置及照相设备”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。This disclosure claims the priority of the Chinese patent application with the application number 202111239136.4 and the title of the invention "Method, device and photographic equipment for correcting wide-angle lens image distortion" submitted to the China Patent Office on October 25, 2021, the entire contents of which are incorporated by reference in this disclosure.
技术领域technical field
本公开涉及一种校正广角镜头图像畸变的方法、装置及照相设备。The present disclosure relates to a method, device and camera equipment for correcting image distortion of a wide-angle lens.
背景技术Background technique
目前,广角镜头图像畸变的校正技术一般都是先使用棋盘格图像计算出符合畸变数学模型的畸变参数,然后通过畸变参数和畸变数学模型对畸变的图像进行坐标变换来达到校正的目的。但是相同相机在拍摄不同分辨率的图像时,由于不同分辨率图像计算出来的畸变参数存在误差,会导致直接使用之前分辨率计算的畸变参数对同一型号的相机镜头拍摄的不同分辨率的图像进行畸变校正时,出现校正异常的情况。At present, the correction technology of wide-angle lens image distortion generally uses the checkerboard image to calculate the distortion parameters conforming to the distortion mathematical model, and then performs coordinate transformation on the distorted image through the distortion parameters and the distortion mathematical model to achieve the purpose of correction. However, when the same camera shoots images with different resolutions, due to errors in the distortion parameters calculated from images with different resolutions, it will directly use the distortion parameters calculated from the previous resolutions to process images of different resolutions captured by the same model of camera lens. During distortion correction, correction abnormality occurs.
相关技术中,当广角相机拍摄的图像的分辨率比较多时,需要针对多个分辨率的图像标定多组畸变参数,这样在对拍摄的图像进行校正时,根据拍摄的图像的分辨率选择与该分辨率相对应的畸变参数来校正拍摄的图像。由此,当图像的分辨率较多时,需要对应标定很多组畸变参数,从而使得目前的校正方法十分繁琐,而且对小分辨率的图像进行标定时,计算出的畸变参数误差较大,导致校正的图像出现异常。此外,目前大多数的相机都支持数字变焦技术,但是广角镜头的数字变焦也会导致畸变图像的校正发生异常,然而目前的大多数相机都不支持对数字变焦后拍摄的图像进行校正的功能。In the related art, when the resolutions of the images captured by the wide-angle camera are relatively large, multiple sets of distortion parameters need to be calibrated for the images of multiple resolutions, so that when correcting the captured images, the resolution of the captured images is selected according to the resolution of the captured images. The distortion parameters corresponding to the resolution are used to correct the captured image. Therefore, when the resolution of the image is large, it is necessary to calibrate many sets of distortion parameters correspondingly, which makes the current correction method very cumbersome, and when calibrating an image with a small resolution, the calculated distortion parameter error is relatively large, resulting in the correction The image of is abnormal. In addition, most of the current cameras support digital zoom technology, but the digital zoom of the wide-angle lens will also cause abnormalities in the correction of distorted images. However, most of the current cameras do not support the function of correcting the images captured after digital zoom.
发明内容Contents of the invention
(一)要解决的技术问题(1) Technical problems to be solved
如何实现对任意分辨率的原始广角畸变图像的校正。How to implement the correction of the original wide-angle distorted image of arbitrary resolution.
(二)技术方案(2) Technical solutions
根据本公开的各种实施例,提供一种校正广角镜头图像畸变的方法、装置及照相设备。According to various embodiments of the present disclosure, a method, an apparatus, and a photographing apparatus for correcting image distortion of a wide-angle lens are provided.
一种校正广角镜头图像畸变的方法,所述方法包括:A method for correcting image distortion of a wide-angle lens, the method comprising:
输入原始畸变图像和预设的第一标定图像;Input the original distorted image and the preset first calibration image;
根据所述原始畸变图像和所述第一标定图像确定第二标定图像;determining a second calibration image based on 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;
根据校正后的畸变图像坐标对应的像素值,输出校正图像。Output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
另外,根据本公开实施例的校正广角镜头图像畸变的方法,还可以具有如下附加的技术特征:In addition, the method for correcting image distortion of a wide-angle lens according to an embodiment of the present disclosure may also have the following additional technical features:
进一步地,根据所述原始畸变图像和所述第一标定图像确定第二标定图像,包括:确定所述第一标定图像的分辨率之下与所述原始畸变图像的长宽比相同的最大分辨率对应的图像,作为所述第二标定图像。Further, determining the second calibration image according to the original distorted image and the first calibration image includes: determining a maximum resolution under the resolution of the first calibration image that is the same as the aspect ratio of the original distorted image The image corresponding to the rate is used as the second calibration image.
进一步地,所述差异参数,包括:所述第二标定图像与所述原始畸变图像的尺寸比例系数,以及所述第一标定图像与所述第二标定图像的边缘尺寸差值。Further, 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.
进一步地,确定所述第二标定图像的差异参数,包括:确定所述第二标定图像与所述原始畸变图像的分辨率比值为所述尺寸比例系数;确定所述第一标定图像与所述第二标定图像在横向和纵向上的像素个数差值为所述边缘尺寸差值。Further, determining the difference parameter of the second calibration image includes: determining the resolution ratio of the second calibration image to the original distorted image as the size scale factor; determining the ratio of the first calibration image to the The difference between the number of pixels in the horizontal direction and the vertical direction of the second calibration image is the difference in edge size.
进一步地,确定所述第二标定图像的差异参数,包括:确定所述第二标定图像与所述原始畸变图像的分辨率比值,将所述分辨率比值与广角镜头的数字变焦倍数的比值作为所述尺寸比例系数;确定所述第二标定图像在横向上的像素个数与所述数字变焦倍数的第一比值, 确定所述第二标定图像在横向上的像素个数与所述第一比值的第一差值,确定所述第一标定图像与所述第二标定图像在横向上的像素个数的第二差值;以及,确定所述第二标定图像在纵向上的像素个数与所述数字变焦倍数的第二比值,确定所述第二标定图像在纵向上的像素个数与所述第二比值的第三差值,确定所述第一标定图像与所述第二标定图像在纵向上的像素个数的第四差值;确定所述第一差值与所述第二差值之和,以及所述第三差值与所述第四差值之和为所述边缘尺寸差值。Further, determining the difference parameter of the second calibration image includes: determining a resolution ratio of the second calibration image to the original distorted image, and using the ratio of the resolution ratio to the digital zoom factor of the wide-angle lens as the ratio The size ratio factor; determine the first ratio of the number of pixels in the horizontal direction of the second calibration image to the digital zoom factor, and determine the number of pixels in the horizontal direction of the second calibration image and the first ratio Determine the first difference between the number of pixels in the horizontal direction of the first calibration image and the second calibration image; and determine the difference between the number of pixels in the vertical direction of the second calibration image and The second ratio of the digital zoom factor determines the third difference between the number of pixels in the vertical direction of the second calibration image and the second ratio, and determines the first calibration image and the second calibration image The fourth difference in the number of pixels 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.
进一步地,根据所述差异参数对所述畸变图像坐标进行校正,包括:根据所述边缘尺寸差值对所述畸变图像坐标进行平移;根据所述尺寸比例系数对平移后的畸变图像坐标进行缩放。Further, correcting the distorted image coordinates according to the difference parameter includes: translating the distorted image coordinates according to the edge size difference; scaling the translated distorted image coordinates according to the size ratio coefficient .
进一步地,根据所述第一标定图像的畸变参数和畸变数学模型计算所述第二标定图像对应的畸变图像坐标,包括:Further, 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 includes:
根据所述第一标定图像的畸变参数和畸变数学模型计算第二标定图像中每个像素点对应的畸变图像坐标。Calculate the distorted image coordinates corresponding to each pixel in the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model.
进一步地,根据所述第一标定图像的畸变参数和畸变数学模型计算所述第二标定图像对应的畸变图像坐标,还包括:Further, 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 further includes:
根据所述第一标定图像的畸变参数和畸变数学模型,按照预设间隔取出像素点,计算所述像素点对应的畸变图像坐标;According to the distortion parameters and the distortion mathematical model of the first calibration image, pixel points are taken out according to preset intervals, and the coordinates of the distorted image corresponding to the pixel points are calculated;
根据插值法估算所述像素点各相邻点之间的其他点对应的畸变图像坐标。Estimating the distorted image coordinates corresponding to other points between adjacent points of the pixel point according to an interpolation method.
进一步地,根据校正后的畸变图像坐标对应的像素值,输出校正图像,包括:Further, output the corrected image according to the pixel value corresponding to the corrected distorted image coordinates, including:
对校正后的畸变图像坐标对应的像素值进行取整,获取校正图像;Rounding the pixel value corresponding to the corrected distorted image coordinates to obtain the corrected image;
输出所述校正图像。The corrected image is output.
进一步地,根据所述边缘尺寸差值对所述畸变图像坐标进行平移,包括:Further, the translation of the distorted image coordinates according to the edge size difference includes:
将所述第二标定图像对应的畸变图像坐标在横向上平移的距离作为横向上的尺寸差值;Taking the distance translated in the lateral direction by the distorted image coordinates corresponding to the second calibration image as the lateral size difference;
将所述第二标定图像对应的畸变图像坐标在纵向上平移的距离作 为纵向上的尺寸差值。The distance that the distorted image coordinates corresponding to the second calibration image are translated in the vertical direction is taken as the size difference in the vertical direction.
一种校正广角镜头图像畸变的装置,该装置包括:A device for correcting image distortion of a wide-angle lens, the device comprising:
输入模块,配置成输入原始畸变图像和预设的第一标定图像;The input module is configured to input the original distorted image and the preset first calibration image;
确定模块,配置成根据所述原始畸变图像和所述第一标定图像确定第二标定图像;A determining 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 a difference parameter of the second calibration image, and correct the coordinates of the distorted image according to the difference parameter;
输出模块,配置成根据校正后的畸变图像坐标对应的像素值,输出校正图像。The output module is configured to output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
作为本公开实施例一种可选的实施方式,所述确定模块具体配置成:确定所述第一标定图像的分辨率之下与所述原始畸变图像的长宽比相同的最大分辨率对应的图像,作为所述第二标定图像。As an optional implementation manner of the embodiment of the present disclosure, the determining module is specifically configured to: determine the maximum resolution below the resolution of the first calibration image corresponding to the aspect ratio of the original distorted image image, as the second calibration image.
作为本公开实施例一种可选的实施方式,所述差异参数,包括:所述第二标定图像与所述原始畸变图像的尺寸比例系数,以及所述第一标定图像与所述第二标定图像的边缘尺寸差值。As an optional implementation manner of the embodiment of the present disclosure, the difference parameter includes: the size ratio coefficient between the second calibration image and the original distorted image, and the first calibration image and the second calibration image The edge size difference of the image.
作为本公开实施例一种可选的实施方式,校正模块具体配置成:确定所述第二标定图像与所述原始畸变图像的分辨率比值为所述尺寸比例系数,以及确定所述第一标定图像与所述第二标定图像在横向和纵向上的像素个数差值为所述边缘尺寸差值。As an optional implementation manner of the embodiment of the present disclosure, the correction module is specifically configured to: determine the ratio of the resolution of the second calibration image to the original distorted image as the size ratio coefficient, and determine the first calibration The difference in the number of pixels in the horizontal and vertical directions between the image and the second calibration image is the difference in edge size.
作为本公开实施例一种可选的实施方式,所述校正模块具体配置成:确定所述第二标定图像与所述原始畸变图像的分辨率比值,将所述分辨率比值与广角镜头的数字变焦倍数的比值作为所述尺寸比例系数;确定所述第二标定图像在横向上的像素个数与所述数字变焦倍数的第一比值,确定所述第二标定图像在横向上的像素个数与所述第一比值的第一差值,确定所述第一标定图像与所述第二标定图像在横向上的像素个数的第二差值;以及,确定所述第二标定图像在纵向上的像素个数与所述数字变焦倍数的第二比值,确定所述第二标定图像在纵向上的像素个数与所述第二比值的第三差值,确定所述第一标定图 像与所述第二标定图像在纵向上的像素个数的第四差值;确定所述第一差值与所述第二差值之和,以及所述第三差值与所述第四差值之和为所述边缘尺寸差值。As an optional implementation manner of the embodiment of the present disclosure, the correction module is specifically configured to: determine the resolution ratio between the second calibration image and the original distorted image, and combine the resolution ratio with the digital zoom of the wide-angle lens The ratio of multiples is used as the size scale factor; determine the first ratio between the number of pixels in the horizontal direction of the second calibration image and the digital zoom multiple, determine the number of pixels in the horizontal direction of the second calibration image and The first difference of the first ratio determines the second difference in the number of pixels in the horizontal direction between the first calibration image and the second calibration image; and determines the vertical direction of the second calibration image The second ratio of the number of pixels of the second calibration image to the digital zoom factor, determine the third difference between the number of pixels of the second calibration image in the vertical direction and the second ratio, and determine the first calibration image and the second ratio The fourth difference value of the number of pixels in the vertical direction of the second calibration image; determine the sum of the first difference value and the second difference value, and the difference between the third difference value and the fourth difference value and are the edge size difference.
作为本公开实施例一种可选的实施方式,所述校正模块还配置成:As an optional implementation manner of the embodiment of the present disclosure, the correction module is further configured to:
根据所述边缘尺寸差值对所述畸变图像坐标进行平移;Translating the distorted image coordinates according to the edge size difference;
根据所述尺寸比例系数对平移后的畸变图像坐标进行缩放。Scale the translated distorted image coordinates according to the size scale coefficient.
作为本公开实施例一种可选的实施方式,所述计算模块具体配置成:As an optional implementation manner of the embodiment of the present disclosure, the calculation module is specifically configured to:
根据所述第一标定图像的畸变参数和畸变数学模型计算第二标定图像中每个像素点对应的畸变图像坐标。Calculate the distorted image coordinates corresponding to each pixel in the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model.
作为本公开实施例一种可选的实施方式,所述计算模块具体配置成:As an optional implementation manner of the embodiment of the present disclosure, the calculation module is specifically configured to:
根据所述第一标定图像的畸变参数和畸变数学模型,按照预设间隔取出像素点,计算所述像素点对应的畸变图像坐标;According to the distortion parameters and the distortion mathematical model of the first calibration image, pixel points are taken out according to preset intervals, and the coordinates of the distorted image corresponding to the pixel points are calculated;
根据插值法估算所述像素点各相邻点之间的其他点对应的畸变图像坐标。Estimating the distorted image coordinates corresponding to other points between adjacent points of the pixel point according to an interpolation method.
一种照相设备,所述设备设置有上述任一实施例所述的校正广角镜头图像畸变的装置。A photographic device is provided with the device for correcting image distortion of a wide-angle lens according to any one of the above embodiments.
一种电子设备,该电子设备包括:存储器和一个或多个处理器,将所述存储器配置成存储计算机可读指令的模块,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行本公开任一实施例提供的校正广角镜头图像畸变方法的步骤。An electronic device comprising: a memory and one or more processors, the memory is configured as a module storing computer-readable instructions that, when executed by the processor, cause the One or more processors execute the steps of the method for correcting wide-angle lens image distortion provided by any embodiment of the present disclosure.
一个或多个存储有计算机可读指令的非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行本公开任一实施例提供的校正广角镜头图像畸变方法的步骤。One or more non-volatile storage media storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the correction wide-angle lens provided by any embodiment of the present disclosure The steps of the image warping method.
本公开的其他特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本公开而了解。本公开的目的和其他优点在说明书、权利要求书以及附图中所特别指出的结构来实现和获得,本公开的一个或多个实施例的细节在下面的附图和描述中提出。Additional features and advantages of the disclosure will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the disclosure. The objectives and other advantages of the disclosure will be realized and attained by the structure particularly pointed out in the written description, claims hereof as well as the accompanying drawings, the details of one or more embodiments of the disclosure being set forth in the accompanying drawings and the description below.
为使本公开的上述目的、特征和优点能更明显易懂,下文特举可选实施例,并配合所附附图,作详细说明如下。In order to make the above objects, features and advantages of the present disclosure more comprehensible, optional embodiments are given below and described in detail in conjunction with the accompanying drawings.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.
图1是根据本公开一个或多个实施例的校正广角镜头图像畸变方法的流程图;FIG. 1 is a flowchart of a method for correcting image distortion of a wide-angle lens according to one or more embodiments of the present disclosure;
图2是根据本公开一个或多个实施例的多分辨率尺寸图像畸变校正示意图;Fig. 2 is a schematic diagram of multi-resolution size image distortion correction according to one or more embodiments of the present disclosure;
图3是根据本公开一个或多个实施例的校正广角镜头图像畸变的装置的结构示意图;FIG. 3 is a schematic structural diagram of an apparatus for correcting image distortion of a wide-angle lens according to one or more embodiments of the present disclosure;
图4是根据本公开一个或多个实施例的电子设备的结构示意图。Fig. 4 is a schematic structural diagram of an electronic device according to one or more embodiments of the present disclosure.
具体实施方式Detailed ways
为了能够更加详尽地了解本公开实施例的特点与技术内容,下面结合附图对本公开实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本公开实施例。在以下的技术描述中,为方便解释起见,通过多个细节以提供对所披露实施例的充分理解。然而,在没有这些细节的情况下,一个或多个实施例仍然可以实施。在其它情况下,为简化附图,熟知的结构和装置可以简化展示。In order to understand the characteristics and technical content of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure will be described in detail below in conjunction with the accompanying drawings. The attached drawings are only for reference and description, and are not intended to limit the embodiments of the present disclosure. In the following technical description, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the disclosed embodiments. However, one or more embodiments may be practiced without these details. In other instances, well-known structures and devices may be shown simplified in order to simplify the drawings.
下面参考图1-图4描述根据本公开实施例的校正广角镜头图像畸变的方法、装置及照相设备。The method, device, and photographic equipment for correcting image distortion of a wide-angle lens according to embodiments of the present disclosure will be described below with reference to FIGS. 1-4 .
图1是根据本公开一个实施例的校正广角镜头图像畸变方法的流程图。如图1所示,该方法包括步骤S1至步骤S5:FIG. 1 is a flowchart of a method for correcting image distortion of a wide-angle lens according to an embodiment of the present disclosure. As shown in Figure 1, the method includes steps S1 to S5:
步骤S1:输入原始畸变图像和预设的第一标定图像。Step S1: Input the original distorted image and the preset first calibration image.
其中,原始畸变图像例如为相机的广角镜头拍摄的图像,该图像 具有因广角拍摄带来的畸变。第一标定图像为预设的标定图像。Wherein, the original distorted image is, for example, an image taken by a wide-angle lens of a camera, and the image has distortion caused by wide-angle shooting. The first calibration image is a preset calibration image.
步骤S2:根据原始畸变图像和第一标定图像确定第二标定图像。Step S2: Determine a second calibration image according to the original distorted image and the first calibration image.
步骤S3:根据第一标定图像的畸变参数和畸变数学模型计算第二标定图像对应的畸变图像坐标。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.
可以理解的是,由于第一标定图像是预设的标定图像,相应的,第一标定图像的畸变数学模型也可以预先设定,即预先计算出第一标定图像对应的畸变参数。举例而言,可以使用棋盘格图像计算出符合畸变数学模型的畸变参数,使用棋盘格图像计算畸变参数属于现有技术,在这里不做赘述。It can be understood that, since the first calibration image is a preset calibration image, correspondingly, the distortion mathematical model of the first calibration image may also be preset, that is, the distortion parameter corresponding to the first calibration image is calculated in advance. For example, a checkerboard image can be used to calculate a distortion parameter conforming to a distortion mathematical model, and the use of a checkerboard image to calculate a distortion parameter belongs to the prior art, and details will not be described here.
在具体实施例中,在计算第二标定图像对应的畸变图像坐标时,可以计算第二标定图像整张图像对应的畸变图像坐标,例如分别计算第二标定图像中每个像素点对应的畸变图像坐标,由此,可以提高数据的完整性和准确性,进而利于提高图像校正的准确性。In a specific embodiment, when calculating the distorted image coordinates corresponding to the second calibration image, the distorted image coordinates corresponding to the entire image of the second calibration image can be calculated, for example, the distorted image corresponding to each pixel in the second calibration image can be calculated separately Coordinates, thus, can improve the integrity and accuracy of data, which in turn helps to improve the accuracy of image correction.
在另一具体实施例中,也可以不用全部计算第二标定图像整张图像对应的畸变图像坐标,只需间隔的计算第二标定图像坐标相对应的畸变图像坐标,对于间隔内的坐标,可通过插值的方式估算出来。例如,在第二标定图像中,按照预设间隔取点,计算这些点相对应的畸变图像坐标,然后通过插值的方式估算各相邻点之间的其他点对应的畸变图像坐标,与计算整张图像对应的畸变图像坐标相比,该方式可以降低算法复杂度,减少运算量,提高计算效率。In another specific embodiment, instead of calculating all the distorted image coordinates corresponding to the entire image of the second calibration image, it is only necessary to calculate the distorted image coordinates corresponding to the coordinates of the second calibration image at intervals. For the coordinates in the interval, you can Estimated by interpolation. For example, in the second calibration image, points are taken according to preset intervals, the distorted image coordinates corresponding to these points are calculated, and then the distorted image coordinates corresponding to other points between adjacent points are estimated by interpolation, which is different from calculating the whole Compared with the distorted image coordinates corresponding to an image, this method can reduce the complexity of the algorithm, reduce the amount of calculation, and improve the calculation efficiency.
步骤S4:确定第二标定图像的差异参数,根据差异参数对所述畸变图像坐标进行校正。Step S4: Determine the difference parameter of the second calibration image, and correct the coordinates of the distorted image according to the difference parameter.
步骤S5:根据校正后的畸变图像坐标对应的像素值,输出校正图像。Step S5: output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
在具体实施例中,校正后的畸变图像坐标很可能不是整数,即坐标数值存在小数点,因而可以对计算出的坐标进行取整,例如选取与该坐标最近的整数坐标,将该整数坐标对应的像素值赋值给校正图像坐标对应的像素值,得到校正图像,并输出校正图像。在另一些实施例中,也可以采用插值方式来获得畸变图像坐标的像素值,比如双线性插值法等等。In a specific embodiment, the coordinates of the corrected distorted image are probably not integers, that is, there are decimal points in the coordinate values, so the calculated coordinates can be rounded, for example, the nearest integer coordinate to the coordinate is selected, and the corresponding integer coordinate The pixel value is assigned to the pixel value corresponding to the coordinates of the corrected image to obtain the corrected image and output the corrected image. In some other embodiments, an interpolation method may also be used to obtain pixel values of the distorted image coordinates, such as bilinear interpolation and the like.
从而,本公开实施例的校正广角镜头图像畸变方法,根据原始畸变图像和第一标定图像确定第二标定图像,通过计算第二标定图像对应的畸变图像坐标和第二标定图像的差异参数可以对任意分辨率的原始畸变图像进行校正,即将校正后的畸变图像坐标对应的像素值赋值给校正图像,输出校正图像即可。由于第一标定图像是预设的标定图像,相应的,第一标定图像的畸变数学模型也可以预先设定,即预先计算出第一标定图像对应的畸变参数。因此,该方法只需要计算出一组畸变参数,即计算对应于第一标定图像对应的畸变参数,即可实现对任意分辨率的原始广角畸变图像的校正,避免了在广角相机拍摄的图像存在多个分辨率时,需要标定多组畸变参数的情况,从而极大地简化了校正流程。Therefore, in the method for correcting the image distortion of the wide-angle lens in the embodiment of the present disclosure, the second calibration image is determined according to the original distorted image and the first calibration image, and the difference parameters of the distortion image corresponding to the second calibration image and the second calibration image can be calculated for any The resolution of the original distorted image is corrected, that is, the pixel value corresponding to the corrected distorted image coordinate is assigned to the corrected image, and the corrected image is output. Since the first calibration image is a preset calibration image, correspondingly, the distortion mathematical model of the first calibration image may also be preset, that is, the distortion parameter corresponding to the first calibration image is calculated in advance. Therefore, this method only needs to calculate a set of distortion parameters, that is, calculate the distortion parameters corresponding to the first calibration image, and then realize the correction of the original wide-angle distorted image with any resolution, avoiding the existence of distortion in the image captured by the wide-angle camera. When multiple resolutions are used, multiple sets of distortion parameters need to be calibrated, which greatly simplifies the calibration process.
在具体实施例中,第一标定图像为广角相机拍摄的最大分辨率的图像,该图像对应的畸变参数误差最小,由此,可以避免小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性。In a specific embodiment, the first calibration image is an image with the largest resolution captured by a wide-angle camera, and the distortion parameter error corresponding to this image is the smallest, thus, it is possible to avoid the distortion parameter error calibrated when the small resolution image is calibrated If it is too large, the accuracy of the correction is improved.
在本公开的一个实施例中,在步骤S2中,根据原始畸变图像和第一标定图像确定第二标定图像,包括:确定第一标定图像的分辨率之下与原始畸变图像的长宽比相同的最大分辨率对应的图像,作为第二标定图像。即言,在预设的第一标定图像对应的分辨率之下,查找与原始畸变图像的长宽比相同的最大分辨率对应的图像。举例而言,获取到畸变图像的分辨率大小,与预设的第一标定图像的最大分辨率进行比较,找到其内部与原始畸变图像相同长宽比且分辨率最大的图像,即为第二标定图像。假设第一标定图像的分辨率为2560x1920,当前拍摄的原始畸变图像的分辨率为1920x1080,其长宽比为16:9,则第一标定图像的分辨率之下,长宽比也是16:9的最大分辨率为2560x1440,该2560x1440分辨率对应的图像即为第二标定图像。In one embodiment of the present disclosure, in step S2, determining the second calibration image according to the original distorted image and the first calibration image includes: determining that the resolution of the first calibration image is the same as the aspect ratio of the original distorted image The image corresponding to the maximum resolution of is used as the second calibration image. In other words, under the preset resolution corresponding to the first calibration image, an image corresponding to the maximum resolution with the same aspect ratio as the original distorted image is searched for. For example, the acquired resolution of the distorted image is 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 largest resolution is found, which is the second Calibration image. Assuming that the resolution of the first calibration image is 2560x1920, the resolution of the currently captured original distorted image is 1920x1080, and its aspect ratio is 16:9, then under the resolution of the first calibration image, the aspect ratio is also 16:9 The maximum resolution of is 2560x1440, and the image corresponding to the resolution of 2560x1440 is the second calibration image.
在本公开的一个实施例中,第二标定图像的差异参数,包括:第二标定图像与原始畸变图像的尺寸比例系数,以及第一标定图像与第二标定图像的边缘尺寸差值。In an embodiment of the present disclosure, 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.
在本公开的一个实施例中,确定第二标定图像的差异参数,包括:In one embodiment of the present disclosure, determining the difference parameter of the second calibration image includes:
步骤S31-1:确定第二标定图像与原始畸变图像的分辨率比值为尺寸比例系数。Step S31-1: Determine the ratio of the resolution of the second calibration image to the original distorted image as the size ratio coefficient.
步骤S32-1:确定第一标定图像与第二标定图像在横向和纵向上的像素个数差值为边缘尺寸差值,该过程是在相机不存在数字变焦时的第二标定图像的差异参数的确定过程。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 the difference parameter of the second calibration image when there is no digital zoom in the camera determination process.
可以理解的是,分辨率指图像水平(横向)和竖直(纵向)方向的像素点个数,例如:1920x1080分辨率,即图像横向有1920个像素点,在纵向有1080个像素点,分辨率比值,即尺寸比例系数即为第二标定图像与原始畸变图像在横向上的像素点个数的比值,或者第二标定图像与原始畸变图像在纵向上的像素点个数的比值。也可以理解的是,第一标定图像和第二标定图像均包括多个边缘,因而边缘尺寸差值包括第一标定图像和第二标定图像在各个边缘处对应的尺寸差值。It can be understood that the resolution refers to the number of pixels in the horizontal (horizontal) and vertical (vertical) 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. Ratio, that is, the size ratio coefficient is the ratio of the number of pixels in the horizontal direction between the second calibration image and the original distorted image, or the ratio of the number of pixels in the vertical direction between the second calibration image and the original distorted image. It can also be understood that both the first calibration image and the second calibration image include a plurality of edges, and thus the edge size difference includes the corresponding size difference between the first calibration image and the second calibration image at each edge.
以图2为例进行说明,图2是根据本公开一个实施例的多分辨率尺寸图像畸变校正示意图。Taking FIG. 2 as an example for illustration, FIG. 2 is a schematic diagram of multi-resolution size image distortion correction according to an embodiment of the present disclosure.
在具体实施例中,如图2所示的示例中,第一标定图像的分辨率为2560*1920,原始畸变图像的分辨率为1920*1080,长宽比为16:9,则根据第一标定图像和原始畸变图像确定的第二标定图像的分辨率为2560*1440,其尺寸比例系数为4:3=1.1,边缘尺寸差值为1920-1440=480。可以理解的是,该边缘尺寸差值包括如图2中所示的上下和左右两个部分,则在横向上边缘多余的长度是0,即在左右方向上的尺寸差值均为0;在纵向上边缘多余的长度是(1920-1440)÷2=240,即在上下方向上的尺寸差值各为240。In a specific embodiment, in the example shown in Figure 2, 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 according to the first The resolution of the second calibration image determined by the calibration image and the original distorted image is 2560*1440, its size ratio factor 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 upper, lower and left and right parts as shown in Figure 2, then the excess length of the edge in the transverse direction is 0, that is, the size difference in the left and right directions is 0; The redundant length of the upper edge in the longitudinal direction is (1920-1440)÷2=240, that is, the size difference in the upper and lower directions is 240 respectively.
在本公开的一个实施例中,确定第二标定图像的差异参数,包括:In one embodiment of the present disclosure, determining the difference parameter of the second calibration image includes:
步骤S31-2:确定第二标定图像与原始畸变图像的分辨率比值,将分辨率比值与广角镜头的数字变焦倍数的比值作为尺寸比例系数。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 the size ratio factor.
步骤S32-2:确定第二标定图像在横向上的像素个数与数字变焦倍数的第一比值,确定第二标定图像在横向上的像素个数与第一比值的第一差值,确定第一标定图像与第二标定图像在横向上的像素个数的第二差值;以及,确定第二标定图像在纵向上的像素个数与数字变焦倍数的第二比值,确定第二标定图像在纵向上的像素个数与第二比值 的第三差值,确定第一标定图像与第二标定图像在纵向上的像素个数的第四差值;确定第一差值与第二差值之和,以及第三差值与第四差值之和为边缘尺寸差值,该过程是在相机存在数字变焦时的第二标定图像的差异参数的确定过程,数字变焦原理就是图像先放大再裁剪的过程,所以实际拍摄出来的图像是相对未变焦的图像做了一些裁剪,而在计算畸变参数时,需要将这部分裁剪的要减去。因此,需要考虑数字变焦倍数对计算畸变图像坐标带来的影响。Step S32-2: determine the first ratio between the number of pixels in the horizontal direction of the second calibration image and the digital zoom factor, determine the first difference between the number of pixels in the horizontal direction of the second calibration image and the first ratio, and determine the first ratio The second difference in the number of pixels in the horizontal direction between the first calibration image and the second calibration image; The third difference between the number of pixels in the vertical direction and the second ratio determines the fourth difference in the number of pixels in the vertical direction between the first calibration image and the second calibration image; determine the difference between the first difference and the second difference and, and the sum of the third difference and the fourth difference is the edge size difference. This process is the process of determining the difference parameters of the second calibration image when the camera has digital zoom. The principle of digital zoom is that the image is first enlarged and then cropped. process, so the actual captured image is cropped relative to the unzoomed image, and when calculating the distortion parameters, this part of the crop needs to be subtracted. Therefore, it is necessary to consider the influence of the digital zoom factor on the calculation of the distorted image coordinates.
具体而言,目前大多数照相设备都支持数字变焦技术,但是广角镜头的数字变焦会导致基于传统方法的畸变图像的校正出现异常,本公开实施例通过计算数字变焦下的第二标定图像的差异参数,并通过第二标定图像对应的畸变图像坐标可以对任意分辨率的原始畸变图像进行校正,该方法只需要计算第一标定图像对应的畸变参数,避免了在广角相机拍摄的图像存在多个分辨率时,需要标定多组畸变参数的情况,简化了校正流程,同时,考虑了数字变焦对计算畸变图像坐标的影响,进一步提高了校正的准确性。Specifically, most of the current camera equipment supports digital zoom technology, but the digital zoom of the wide-angle lens will cause the correction of the distorted image based on the traditional method to be abnormal. The embodiment of the present disclosure calculates the difference parameter of the second calibration image under the digital zoom , and the original distorted image with any resolution can be corrected through the distorted image coordinates corresponding to the second calibration image. This method only needs to calculate the distortion parameters corresponding to the first calibration image, which avoids multiple resolutions in the image captured by the wide-angle camera. When the rate is high, multiple sets of distortion parameters need to be calibrated, which simplifies the correction process. At the same time, the influence of digital zoom on the calculation of the distorted image coordinates is considered, which further improves the accuracy of the correction.
在具体实施例中,第一标定图像为广角相机拍摄的最大分辨率的图像,该图像的分辨率为2560*1920,原始畸变图像的分辨率为1920*1080,长宽比为16:9,则第二标定图像的分辨率为2560*1440,假设广角相机的数字变焦倍数为1.2x,尺寸比例系数为4:3:1.2=1.1,边缘尺寸差值需要在不存在数字变焦时边缘尺寸差值的基础上加上2560-2560/1.2=426和1440–1440/1.2=240。可以理解的是,边缘尺寸差值包括上下和左右两个部分,则在横向上边缘多余的长度是426÷2=213.3,在纵向上边缘多余的长度是240÷2+240=360。In a specific embodiment, the first calibration image is an image with the 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 factor is 4:3:1.2=1.1, and the edge size difference needs to be the edge size difference when there is no digital zoom Add 2560-2560/1.2=426 and 1440-1440/1.2=240 to the value. It can be understood that the edge size difference includes upper, lower and left and right parts, then 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.
在本公开的一个实施例中,根据差异参数对畸变图像坐标进行校正,包括:In one embodiment of the present disclosure, correcting the distorted image coordinates according to the difference parameters includes:
步骤S41:根据边缘尺寸差值对畸变图像坐标进行平移。Step S41: Translate the distorted image coordinates according to the edge size difference.
步骤S42:根据尺寸比例系数对平移后的畸变图像坐标进行缩放。Step S42: scaling the translated distorted image coordinates according to the size ratio coefficient.
具体而言,根据边缘尺寸差值对畸变图像坐标进行平移,包括:将所述第二标定图像对应的畸变图像坐标在横向上平移的距离为在横向上边缘多余的长度,即在横向上的尺寸差值,将所述第二标定图像 对应的畸变图像坐标在纵向上平移的距离为在纵向上边缘多余的长度,即在纵向上的尺寸差值。根据尺寸比例系数对平移后的畸变图像坐标进行缩放,缩放的缩放比例为尺寸比例系数。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 lateral direction by an excess length of the edge in the lateral direction, that is, For the size difference, the distance to translate the distorted image coordinates corresponding to the second calibration image in the vertical direction is the excess length of the edge in the vertical direction, that is, the size difference in the vertical direction. Scale the translated distorted image coordinates according to the size scale factor, and the zoom ratio is the size scale factor.
在具体实施例中,当广角镜头不存在数字变焦时,第一标定图像的分辨率为2560*1920,原始畸变图像的分辨率为1920*1080,长宽比为16:9,则第二标定图像的分辨率为2560*1440,所述第二标定图像对应的畸变图像坐标在横向上平移的距离为0,在纵向上平移的距离为240,然后对平移后的畸变图像坐标进行缩放,缩放的缩放比例为4:3=1.33。举例而言,当广角镜头不存在数字变焦时,假设第一标定图像的分辨率为2560*1920,原始畸变图像的分辨率为1920*1080,长宽比为16:9,则第二标定图像的分辨率为2560*1440,第二标定图像对应的畸变图像坐标例如为(72.8,285.6),对该坐标在横向上向左平移0,在纵向上向下平移240,得到(72.8,45.6),再除以比例系数1.33,得到校正后的畸变坐标(54.6,34.2),由于该坐标不是整数,选取与该坐标最近的整数坐标,将该整数坐标对应的像素值赋值给校正图像坐标对应的像素值,得到校正图像,并输出校正图像。也可以采用插值方式来获得畸变图像坐标的像素值,比如双线性插值法,进而将像素值赋值给校正图像坐标对应的像素值,得到校正图像。In a specific embodiment, when there is no digital zoom in the wide-angle lens, 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 second calibration image The resolution is 2560*1440, the translation distance of the distorted image coordinates corresponding to the second calibration image is 0 in the horizontal direction, and the translation distance in the vertical direction is 240, and then the distorted image coordinates after translation are scaled, and the scaled The scaling ratio is 4:3=1.33. For example, when there is no digital zoom in the wide-angle lens, 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 The resolution is 2560*1440, and the coordinates of the distorted image corresponding to the second calibration image are, for example, (72.8, 285.6), and the coordinates are translated to the left by 0 in the horizontal direction and 240 in the vertical direction to obtain (72.8, 45.6), Then divide by the proportional coefficient 1.33 to get the corrected distortion coordinates (54.6, 34.2). Since the coordinates are not integers, select the integer coordinates closest to the coordinates, and assign the pixel value corresponding to the integer coordinates to the pixel corresponding to the corrected image coordinates value, get the corrected image, and output the corrected image. 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.
当广角镜头存在数字变焦时,假设数字变焦倍数为1.2x,第一标定图像的分辨率为2560*1920,原始畸变图像的分辨率为1920*1080,长宽比为16:9,则第二标定图像的分辨率为2560*1440,所述第二标定图像对应的畸变图像坐标在横向上平移的距离为213.3,在纵向上平移的距离为360,然后对平移后的畸变图像坐标进行缩放,缩放的缩放比例为4:3:1.2=1.1。举例而言,当广角镜头存在数字变焦时,假设数字变焦倍数为1.2x,第一标定图像的分辨率为2560*1920,原始畸变图像的分辨率为1920*1080,长宽比为16:9,则第二标定图像的分辨率为2560*1440,第二标定图像对应的畸变图像坐标例如为(274,398),对该坐标在横向上向左平移213.3,在纵向上向下平移360,得到(60.7,38),再除以比例系数1.1,得到校正后的畸变坐标(54.6,34.2),由于该坐标不是整数,选取与该坐标最近的整数坐标,将该整数坐标对应 的像素值赋值给校正图像坐标对应的像素值,得到校正图像,并输出校正图像。也可以采用插值方式来获得畸变图像坐标的像素值,比如双线性插值法,进而将像素值赋值给校正图像坐标对应的像素值,得到校正图像。When the wide-angle lens has digital zoom, assuming that the digital zoom factor 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 second calibration The resolution of the image is 2560*1440, the translation distance of the distorted image coordinates corresponding to the second calibration image is 213.3 in the horizontal direction, and the translation distance in the vertical direction is 360, and then the distorted image coordinates after translation are scaled, zoomed 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 factor 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 coordinates of the distorted image corresponding to the second calibration image are, for example, (274,398), and the coordinates are translated 213.3 to the left in the horizontal direction and 360 in the vertical direction to obtain (60.7 , 38), and then divided by the proportional coefficient 1.1 to obtain the corrected distortion coordinates (54.6, 34.2). Since the coordinates are not integers, select the integer coordinates closest to the coordinates, and assign the pixel value corresponding to the integer coordinates to the corrected image The pixel values corresponding to the coordinates are used to obtain the corrected image and output the corrected image. 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.
综上所述,根据本公开实施例的校正广角镜头图像畸变方法,无需标定多组畸变参数,只需计算一组最大分辨率图像对应的畸变参数即可实现对任意分辨率的原始广角畸变图像的校正,极大地简化了校正流程,同时避免了小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性。To sum up, according to the method for correcting image distortion of a wide-angle lens according to the embodiment of the present disclosure, it is not necessary to calibrate multiple sets of distortion parameters, and it is only necessary to calculate a set of distortion parameters corresponding to a set of maximum resolution images to realize the correction of the original wide-angle distorted image of any resolution. Calibration greatly simplifies the calibration process, and at the same time avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the calibration.
应该理解的是,虽然图1的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flow chart of FIG. 1 are displayed sequentially as indicated by the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in Fig. 1 may include multiple sub-steps or multiple stages, these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, the execution of these sub-steps or stages The order is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
本公开的进一步实施例还公开了一种校正广角镜头图像畸变的装置,图3是根据本公开一个实施例的校正广角镜头图像畸变的装置的结构示意图,如图3所示,该装置10包括:A further embodiment of the present disclosure also discloses a device for correcting image distortion of a wide-angle lens. FIG. 3 is a schematic structural diagram of a device for correcting image distortion of a wide-angle lens according to an embodiment of the present disclosure. As shown in FIG. 3 , the device 10 includes:
输入模块11,配置成输入原始畸变图像和预设的第一标定图像,以及确定模块12,配置成根据所述原始畸变图像和所述第一标定图像确定第二标定图像,以及计算模块13,配置成根据所述第一标定图像的畸变参数和畸变数学模型计算所述第二标定图像对应的畸变图像坐标,以及校正模块14,配置成确定所述第二标定图像的差异参数,根据所述差异参数对所述畸变图像坐标进行校正,以及输出模块15,配置成根据校正后的畸变图像坐标对应的像素值,输出校正图像。The input module 11 is configured to input the original distorted image and a preset first calibration image, and the determination module 12 is configured to determine a second calibration image according to the original distorted image and the first calibration image, and a calculation module 13, It is 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, and the correction module 14 is configured to determine the difference parameter of the second calibration image, according to the The difference parameter corrects the distorted image coordinates, and the output module 15 is configured to output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
在本公开的一个实施例中,确定模块12具体配置成:确定所述第一标定图像的分辨率之下与所述原始畸变图像的长宽比相同的最大分辨率对应的图像,作为所述第二标定图像。In an embodiment of the present disclosure, the determining module 12 is specifically configured to: determine an image corresponding to a maximum resolution under the resolution of the first calibration image that is the same as the aspect ratio of the original distorted image, as the Second calibration image.
在本公开的一个实施例中,校正模块14具体配置成:确定所述第二标定图像的差异参数,然后根据所述差异参数对所述畸变图像坐标进行校正,其中的所述差异参数,包括:所述第二标定图像与所述原始畸变图像的尺寸比例系数,以及所述第一标定图像与所述第二标定图像的边缘尺寸差值。In an embodiment of the present disclosure, the correction module 14 is specifically configured to: determine the difference parameter of the second calibration image, and then correct the coordinates of the distorted image according to the difference parameter, wherein the difference parameter includes : the scale factor between the second calibration image and the original distorted image, and the edge size difference between the first calibration image and the second calibration image.
在本公开的一个实施例中,校正模块14具体配置成:确定所述第二标定图像与所述原始畸变图像的分辨率比值为所述尺寸比例系数,以及确定所述第一标定图像与所述第二标定图像在横向和纵向上的像素个数差值为所述边缘尺寸差值。In one embodiment of the present disclosure, the correction module 14 is specifically configured to: determine the ratio of the resolution of the second calibration image to the original distorted image as the size scale factor, and determine the ratio of the resolution of the first calibration image to the The difference between the number of pixels in the horizontal direction and the vertical direction of the second calibration image is the difference in the edge size.
在本公开的一个实施例中,校正模块14还配置成:确定所述第二标定图像与所述原始畸变图像的分辨率比值,将所述分辨率比值与广角镜头的数字变焦倍数的比值作为所述尺寸比例系数,以及确定所述第二标定图像在横向上的像素个数与所述数字变焦倍数的第一比值,确定所述第二标定图像在横向上的像素个数与所述第一比值的第一差值,确定所述第一标定图像与所述第二标定图像在横向上的像素个数的第二差值;以及,确定所述第二标定图像在纵向上的像素个数与所述数字变焦倍数的第二比值,确定所述第二标定图像在纵向上的像素个数与所述第二比值的第三差值,确定所述第一标定图像与所述第二标定图像在纵向上的像素个数的第四差值;确定所述第一差值与所述第二差值之和,以及所述第三差值与所述第四差值之和为所述边缘尺寸差值。In an embodiment of the present disclosure, the correction module 14 is further configured to: 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 the determined The size ratio factor, and determine the first ratio of the number of pixels in the horizontal direction of the second calibration image to the digital zoom factor, and determine the ratio of the number of pixels in the horizontal direction of the second calibration image to the first The first difference of the ratio determines the second difference between the number of pixels in the horizontal direction between the first calibration image and the second calibration image; and determines the number of pixels in the vertical direction of the second calibration image and the second ratio of the digital zoom factor, determine the third difference between the number of pixels in the vertical direction of the second calibration image and the second ratio, and determine the difference between the first calibration image and the second calibration image The fourth difference of the number of pixels in the vertical direction of the image; determine the sum of the first difference and the second difference, and the sum of the third difference and the fourth difference is the Edge size difference.
在本公开的一个实施例中,校正模块14还配置成:根据所述边缘尺寸差值对所述畸变图像坐标进行平移。In an embodiment of the present disclosure, the correction module 14 is further configured to: translate the distorted image coordinates according to the edge size difference.
校正模块14还配置成:根据所述尺寸比例系数对平移后的畸变图像坐标进行缩放。The correction module 14 is further configured to: scale the translated distorted image coordinates according to the size scale coefficient.
根据本公开实施例的校正广角镜头图像畸变装置10,该装置10无需标定多组畸变参数,只需计算一组最大分辨率图像对应的畸变参数即可实现对任意分辨率的原始广角畸变图像的校正,极大地简化了校正流程,同时避免了小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性。According to the device 10 for correcting wide-angle lens image distortion according to the embodiment of the present disclosure, the device 10 does not need to calibrate multiple sets of distortion parameters, and 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 calibration process, and at the same time avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the calibration.
本公开的进一步实施例还公开了一种照相设备,该照相设备设置有上述任一实施例所述的校正广角镜头图像畸变的装置10。A further embodiment of the present disclosure also discloses a photographic device, which is provided with the device 10 for correcting image distortion of a wide-angle lens described in any one of the above embodiments.
在具体实施例中,该照相设备例如为但不限于具有广角镜头的相机、手机、平板电脑、可穿戴设备等电子设备。In a specific embodiment, the camera device is, for example but not limited to, a camera with a wide-angle lens, a mobile phone, a tablet computer, a wearable device and other electronic devices.
需要说明的是,本公开实施例的照相设备在进行广角镜头图像畸变校正时,其具体实现方式与本公开实施例的校正广角镜头图像畸变装置的具体实现方式类似,具体请参见装置部分的描述,为了减少冗余,此处不再赘述。It should be noted that when the photographic equipment in the embodiment of the present disclosure corrects the image distortion of the wide-angle lens, its specific implementation method is similar to that of the device for correcting the image distortion of the wide-angle lens in the embodiment of the present disclosure. For details, please refer to the description of the device part. To reduce redundancy, details will not be repeated here.
根据本公开实施例的照相设备,该照相设备无需标定多组畸变参数,只需计算一组最大分辨率图像对应的畸变参数即可实现对任意分辨率的原始广角畸变图像的校正,极大地简化了校正流程,同时避免了小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性。According to the photographic equipment of the embodiments of the present disclosure, the photographic equipment does not need to calibrate multiple sets of distortion parameters, and 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 with any resolution, which greatly simplifies The correction process is simplified, and at the same time, the error of the calibrated distortion parameters is too large when the small-resolution image is calibrated, thereby improving the accuracy of the correction.
一个或多个存储有计算机可读指令的非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行本公开任一实施例提供的校正广角镜头图像畸变方法的步骤。One or more non-volatile storage media storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the correction wide-angle lens provided by any embodiment of the present disclosure The steps of the image warping method.
上述的计算机可读存储介质可以是暂态计算机可读存储介质,也可以是非暂态计算机可读存储介质。The above-mentioned computer-readable storage medium may be a transitory computer-readable storage medium, or a non-transitory computer-readable storage medium.
根据本公开实施例的计算机可读存储介质,其上存储的校正广角镜头图像畸变的程序被处理器执行时,只需计算一组最大分辨率图像对应的畸变参数即可实现对任意分辨率的原始广角畸变图像的校正,极大地简化了校正流程,同时避免了小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性。According to the computer-readable storage medium of the embodiment of the present disclosure, when the program for correcting the image distortion of the wide-angle lens stored thereon is executed by the processor, it only needs to calculate the distortion parameters corresponding to a set of maximum-resolution images to realize the original The correction of the wide-angle distorted image greatly simplifies the correction process, and at the same time avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the correction.
本公开的进一步实施例还公开了一种电子设备。A further embodiment of the present disclosure also discloses an electronic device.
在一些实施例中,该电子设备包括如本公开上述任意一个实施例所描述的校正广角镜头图像畸变的装置10。即该电子设备可包括:用于输入原始畸变图像和预设的第一标定图像的输入模块11;以及用于根据所述原始畸变图像和所述第一标定图像确定第二标定图像的确定模块12;以及用于根据所述第一标定图像的畸变参数和畸变数学模型计算所述第二标定图像对应的畸变图像坐标的计算模块13,以及用于 确定所述第二标定图像的差异参数,根据所述差异参数对所述畸变图像坐标进行校正的校正模块14,以及用于根据校正后的畸变图像坐标对应的像素值,输出校正图像的输出模块15。由此,在一些实施例中,当该电子设备用于校正广角镜头图像的畸变时,其具体实现方式与本公开上述任意一个实施例所描述的校正广角镜头图像畸变的装置10类似,具体可参见前述关于该装置10部分的描述,为减少冗余,此处不再赘述。In some embodiments, the electronic device includes the device 10 for correcting image distortion of a wide-angle lens as described in any one of the above-mentioned embodiments of the present disclosure. 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 for determining a second calibration image according to the original distorted image and the first calibration image 12; and a calculation module 13 for calculating the coordinates of the distorted image corresponding to the second calibration image according to the distortion parameter of the first calibration image and the distortion mathematical model, and for determining the difference parameter of the second calibration image, A correction module 14 for correcting the distorted image coordinates according to the difference parameters, and an output module 15 for outputting a corrected image according to pixel values corresponding to the corrected distorted image coordinates. Therefore, in some embodiments, when the electronic device is used to correct the distortion of the wide-angle lens image, its specific implementation method is similar to the device 10 for correcting the wide-angle lens image distortion described in any of the above-mentioned embodiments of the present disclosure. For details, please refer to the aforementioned The description of the part of the device 10 is omitted here to reduce redundancy.
在另一些实施例中,如图4所示,该电子设备包括:处理器1000、存储器2000;以及存储在所述存储器2000上并可在所述处理器1000上运行的校正广角镜头图像畸变的计算机可读指令,所述校正广角镜头图像畸变的计算机可读指令被所述处理器1000执行时,使得处理器1000执行本公开实施例提供的校正广角镜头图像畸变的方法的步骤。In some other embodiments, as shown in FIG. 4 , the electronic device includes: a processor 1000, a memory 2000; and a computer that is stored on the memory 2000 and can run on the processor 1000 to correct the image distortion of the wide-angle lens The readable instructions, when the computer-readable instructions for correcting the image distortion of the wide-angle lens are executed by the processor 1000 , cause the processor 1000 to execute the steps of the method for correcting the image distortion of the wide-angle lens provided by the embodiment of the present disclosure.
在具体实施例中,该电子设备例如为但不限于摄像设备,该摄像设备例如包括但不限于具有广角镜头的相机、手机、平板电脑、可穿戴设备等。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 not limited to a camera with a wide-angle lens, a mobile phone, a tablet computer, a wearable device, and the like.
根据本公开实施例的电子设备,该设备无需标定多组畸变参数,只需计算一组最大分辨率图像对应的畸变参数即可实现对任意分辨率的原始广角畸变图像的校正,极大地简化了校正流程,同时避免了小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性。According to the electronic device of the embodiment of the present disclosure, the device does not need to calibrate multiple sets of distortion parameters, and 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 with any resolution, which greatly simplifies The calibration process avoids the large error of the calibrated distortion parameters when the small-resolution image is calibrated, thereby improving the accuracy of the calibration.
其中,上述的处理器1000可以为一个或多个,图4中以一个处理器1000为例。Wherein, there may be one or more processors 1000 mentioned above, and one processor 1000 is taken as an example in FIG. 4 .
如图4所示,该电子设备还可以包括通信接口(Communication Interface)3000和总线4000。其中,处理器1000、存储器2000、通信接口3000可以通过总线4000完成相互间的通信。通信接口3000可以用于信息传输。处理器1000可以调用存储器2000中的逻辑指令,以执行上述实施例的校正广角镜头图像畸变的方法。As shown in FIG. 4 , the electronic device may also include a communication interface (Communication Interface) 3000 and a bus 4000. Wherein, the processor 1000 , the memory 2000 , and the communication interface 3000 can communicate with each other through the bus 4000 . The communication interface 3000 can be used for information transmission. The processor 1000 may invoke logic instructions in the memory 2000 to execute the method for correcting image distortion of a wide-angle lens in the above embodiments.
此外,上述的存储器2000中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。In addition, the logic instructions in the above-mentioned memory 2000 may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as an independent product.
存储器2000作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序,如本公开实施例中的方法对应的程序指令/模块。处理器1000通过运行存储在存储器2000中的软件程序、指令以及模块,从而执行功能应用以及数据处理,即实现上述方法实施例中的校正广角镜头图像畸变的方法。As a computer-readable storage medium, the memory 2000 can be used to store software programs and computer-executable programs, such as program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 1000 runs software programs, instructions and modules stored in the memory 2000 to execute functional applications and data processing, that is, to implement the method for correcting image distortion of the wide-angle lens in the above method embodiments.
存储器2000可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端设备的使用所创建的数据等。此外,存储器2000可以包括高速随机存取存储器,还可以包括非易失性存储器。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 program required by at least one function; the data storage area may store data created according to the use of the terminal device, and the like. In addition, the memory 2000 may include a high-speed random access memory, and may also include a non-volatile memory.
本公开实施例的技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括一个或多个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开实施例所述方法的全部或部分步骤。而前述的存储介质可以是非暂态存储介质,包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等多种可以存储程序代码的介质,也可以是暂态存储介质。The technical solutions of the embodiments of the present disclosure can be embodied in the form of software products, which are stored in a storage medium and include one or more instructions to make a computer device (which can be a personal computer, a server, or a network equipment, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. The aforementioned storage medium can be a non-transitory storage medium, including: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc. A medium that can store program code, or a transitory storage medium.
当用于本公开中时,虽然术语“第一”、“第二”等可能会在本公开中使用以描述各元件,但这些元件不应受到这些术语的限制。这些术语仅用于将一个元件与另一个元件区别开。比如,在不改变描述的含义的情况下,第一元件可以叫做第二元件,并且同样第,第二元件可以叫做第一元件,只要所有出现的“第一元件”一致重命名并且所有出现的“第二元件”一致重命名即可。第一元件和第二元件都是元件,但可以不是相同的元件。When used in the present disclosure, although the terms 'first', 'second', etc. may be used in the present disclosure to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be called a second element without changing the meaning of the description, and likewise, a second element could be called a first element, as long as all occurrences of "first element" are renamed consistently and all occurrences of "Second component" can be renamed consistently. Both the first element and the second element are elements, but may not be the same element.
所描述的实施例中的各方面、实施方式、实现或特征能够单独使用或以任意组合的方式使用。所描述的实施例中的各方面可由软件、硬件或软硬件的结合实现。所描述的实施例也可以由存储有计算机可读代码的计算机可读介质体现,该计算机可读代码包括可由至少一个计算装置执行的指令。所述计算机可读介质可与任何能够存储数据的数据存储装置相关联,该数据可由计算机系统读取。用于举例的计算 机可读介质可以包括只读存储器、随机存取存储器、CD-ROM、HDD、DVD、磁带以及光数据存储装置等。所述计算机可读介质还可以分布于通过网络联接的计算机系统中,这样计算机可读代码就可以分布式存储并执行。The aspects, implementations, implementations or features of the described embodiments can be used alone or in any combination. Aspects of the described embodiments can be implemented by software, hardware or a combination of hardware and software. The described embodiments may also be embodied by a computer-readable medium storing computer-readable code comprising instructions executable by at least one computing device. The computer readable medium can be associated with any data storage device that can store data that can be read by a computer system. By way of example, computer readable media may include read only memory, random access memory, CD-ROM, HDD, DVD, magnetic tape, and optical data storage devices, among others. The computer readable medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.
上述技术描述可参照附图,这些附图形成了本公开的一部分,并且通过描述在附图中示出了依照所描述的实施例的实施方式。虽然这些实施例描述的足够详细以使本领域技术人员能够实现这些实施例,但这些实施例是非限制性的;这样就可以使用其它的实施例,并且在不脱离所描述的实施例的范围的情况下还可以做出变化。比如,流程图中所描述的操作顺序是非限制性的,因此在流程图中阐释并且根据流程图描述的两个或两个以上操作的顺序可以根据若干实施例进行改变。作为另一个例子,在若干实施例中,在流程图中阐释并且根据流程图描述的一个或一个以上操作是可选的,或是可删除的。另外,某些步骤或功能可以添加到所公开的实施例中,或两个以上的步骤顺序被置换。所有这些变化被认为包含在所公开的实施例以及权利要求中。The above technical description may refer to the accompanying drawings, which form a part of this disclosure, and in which are shown by way of description implementations in accordance with the described embodiments. While these embodiments are described in sufficient detail to enable those skilled in the art to practice the embodiments, these embodiments are not limiting; as such, other embodiments can be used and without departing from the scope of the described embodiments Circumstances can also be changed. For example, the order of operations described in the flow diagrams is non-limiting, and thus the order of two or more operations illustrated in and described with respect to the flow diagrams may be changed according to several embodiments. As another example, in several embodiments, one or more operations illustrated in and described with respect to the flowcharts are optional, or may be deleted. Additionally, certain steps or functionality may be added to the disclosed embodiments, or the order of two or more steps permuted. All such variations are considered to be encompassed by the disclosed embodiments as well as the claims.
另外,上述技术描述中使用术语以提供所描述的实施例的透彻理解。然而,并不需要过于详细的细节以实现所描述的实施例。因此,实施例的上述描述是为了阐释和描述而呈现的。上述描述中所呈现的实施例以及根据这些实施例所公开的例子是单独提供的,以添加上下文并有助于理解所描述的实施例。上述说明书不用于做到无遗漏或将所描述的实施例限制到本公开的精确形式。根据上述教导,若干修改、选择适用以及变化是可行的。在某些情况下,没有详细描述为人所熟知的处理步骤以避免不必要地影响所描述的实施例。Additionally, terminology was used in the above technical description to provide a thorough understanding of the described embodiments. However, undue detail is not required to implement the described embodiments. Thus, the foregoing description of the embodiments has been presented for purposes of illustration and description. The embodiments presented in the foregoing description, and examples disclosed according to these embodiments, are provided individually to add context and to facilitate understanding of the described embodiments. The above description is not intended to be exhaustive or to limit the described embodiments to the precise form of the disclosure. Several modifications, alternatives, and variations are possible in light of the above teachings. In some instances, well known process steps have not been described in detail in order not to unnecessarily obscure the described embodiments.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示意性实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本公开的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。In the description of this specification, references to the terms "one embodiment," "some embodiments," "exemplary embodiments," "example," "specific examples," or "some examples" are intended to mean that the implementation A specific feature, structure, material, or characteristic described by an embodiment or example is included in at least one embodiment or example of the present disclosure. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example.
尽管已经示出和描述了本公开的实施例,本领域的普通技术人员可以理解:在不脱离本公开的原理和宗旨的情况下可以对这些实施例 进行多种变化、修改、替换和变型,本公开的范围由权利要求及其等同物限定。Although the embodiments of the present disclosure have been shown and described, those skilled in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principle and spirit of the present disclosure. The scope of the present disclosure is defined by the claims and their equivalents.
工业实用性Industrial Applicability
本公开提供的校正广角镜头图像畸变方法,可以实现对任意分辨率的原始广角畸变图像的校正,极大地简化了校正流程,同时有效避免了小分辨率图像在进行标定时,标定出的畸变参数误差偏大的情况,从而提高了校正的准确性,具有很强的工业实用性。The correction method for wide-angle lens image distortion provided by this disclosure can realize the correction of the original wide-angle distorted image with any resolution, greatly simplifies the correction process, and effectively avoids the distortion parameter error of calibration when the small-resolution image is calibrated If the situation is too large, the accuracy of the correction is improved, and it has strong industrial applicability.

Claims (20)

  1. 一种校正广角镜头图像畸变的方法,其特征在于,包括:A method for correcting image distortion of a wide-angle lens, characterized in that it comprises:
    输入原始畸变图像和预设的第一标定图像;Input the original distorted image and the preset first calibration image;
    根据所述原始畸变图像和所述第一标定图像确定第二标定图像;determining a second calibration image based on 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;
    根据校正后的畸变图像坐标对应的像素值,输出校正图像。Output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
  2. 根据权利要求1所述的校正广角镜头图像畸变的方法,其特征在于,根据所述原始畸变图像和所述第一标定图像确定第二标定图像,包括:确定所述第一标定图像的分辨率之下与所述原始畸变图像的长宽比相同的最大分辨率对应的图像,作为所述第二标定图像。The method for correcting image distortion of a wide-angle lens according to claim 1, wherein determining a second calibration image according to the original distorted image and the first calibration image comprises: determining the resolution of the first calibration image An image corresponding to the maximum resolution with the same aspect ratio as the original distorted image is used as the second calibration image.
  3. 根据权利要求1所述的校正广角镜头图像畸变的方法,其特征在于,所述差异参数,包括:所述第二标定图像与所述原始畸变图像的尺寸比例系数,以及所述第一标定图像与所述第二标定图像的边缘尺寸差值。The method for correcting image distortion of a wide-angle lens according to claim 1, wherein the difference parameters include: a size ratio coefficient between the second calibration image and the original distorted image, and the first calibration image and the original distorted image. The edge size difference of the second calibration image.
  4. 根据权利要求3所述的校正广角镜头图像畸变的方法,其特征在于,确定所述第二标定图像的差异参数,包括:The method for correcting wide-angle lens image distortion according to claim 3, wherein determining the difference parameter of the second calibration image comprises:
    确定所述第二标定图像与所述原始畸变图像的分辨率比值为所述尺寸比例系数;determining the resolution ratio of the second calibration image to the original distorted image as the size scaling factor;
    确定所述第一标定图像与所述第二标定图像在横向和纵向上的像素个数差值为所述边缘尺寸差值。Determining 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 as the edge size difference.
  5. 根据权利要求3所述的校正广角镜头图像畸变的方法,其特征在于,确定所述第二标定图像的差异参数,包括:The method for correcting wide-angle lens image distortion according to claim 3, wherein determining the difference parameter of the second calibration image comprises:
    确定所述第二标定图像与所述原始畸变图像的分辨率比值,将所述分辨率比值与广角镜头的数字变焦倍数的比值作为所述尺寸比例系数;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 the size ratio factor;
    确定所述第二标定图像在横向上的像素个数与所述数字变焦倍数 的第一比值,确定所述第二标定图像在横向上的像素个数与所述第一比值的第一差值,确定所述第一标定图像与所述第二标定图像在横向上的像素个数的第二差值;以及,确定所述第二标定图像在纵向上的像素个数与所述数字变焦倍数的第二比值,确定所述第二标定图像在纵向上的像素个数与所述第二比值的第三差值,确定所述第一标定图像与所述第二标定图像在纵向上的像素个数的第四差值;确定所述第一差值与所述第二差值之和,以及所述第三差值与所述第四差值之和为所述边缘尺寸差值。Determine the first ratio of the number of pixels in the horizontal direction of the second calibration image to the digital zoom factor, and determine the first difference between the number of pixels in the horizontal direction of the second calibration image and the first ratio , determining a second difference between the number of pixels in the horizontal direction of the first calibration image and the second calibration image; and determining the number of pixels in the vertical direction of the second calibration image and the digital zoom factor The second ratio, determine the third difference between the number of pixels in the vertical direction of the second calibration image and the second ratio, and determine the pixels in the vertical direction of the first calibration image and the second calibration image A fourth difference in number; 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.
  6. 根据权利要求3-5任一项所述的校正广角镜头图像畸变的方法,其特征在于,根据所述差异参数对所述畸变图像坐标进行校正,包括:The method for correcting wide-angle lens image distortion according to any one of claims 3-5, wherein correcting the distorted image coordinates according to the difference parameters includes:
    根据所述边缘尺寸差值对所述畸变图像坐标进行平移;Translating the distorted image coordinates according to the edge size difference;
    根据所述尺寸比例系数对平移后的畸变图像坐标进行缩放。Scale the translated distorted image coordinates according to the size scale coefficient.
  7. 根据权利要求1所述的方法,其中,所述根据所述第一标定图像的畸变参数和畸变数学模型计算所述第二标定图像对应的畸变图像坐标,包括:The method according to claim 1, wherein the 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 comprises:
    根据所述第一标定图像的畸变参数和畸变数学模型计算第二标定图像中每个像素点对应的畸变图像坐标。Calculate the distorted image coordinates corresponding to each pixel in the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model.
  8. 根据权利要求1所述的方法,其中,所述根据所述第一标定图像的畸变参数和畸变数学模型计算所述第二标定图像对应的畸变图像坐标,还包括:The method according to claim 1, wherein the 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 further comprises:
    根据所述第一标定图像的畸变参数和畸变数学模型,按照预设间隔取出像素点,计算所述像素点对应的畸变图像坐标;According to the distortion parameters and the distortion mathematical model of the first calibration image, pixel points are taken out according to preset intervals, and the coordinates of the distorted image corresponding to the pixel points are calculated;
    根据插值法估算所述像素点各相邻点之间的其他点对应的畸变图像坐标。Estimating the distorted image coordinates corresponding to other points between adjacent points of the pixel point according to an interpolation method.
  9. 根据权利要求1所述的方法,其中,所述根据校正后的畸变图像坐标对应的像素值,输出校正图像,包括:The method according to claim 1, wherein said outputting the corrected image according to the pixel value corresponding to the corrected distorted image coordinates comprises:
    对校正后的畸变图像坐标对应的像素值进行取整,获取校正图像;Rounding the pixel value corresponding to the corrected distorted image coordinates to obtain the corrected image;
    输出所述校正图像。The corrected image is output.
  10. 根据权利要求6所述的方法,其中,所述根据所述边缘尺寸差值对所述畸变图像坐标进行平移,包括:The method according to claim 6, wherein said translating said distorted image coordinates according to said edge size difference comprises:
    将所述第二标定图像对应的畸变图像坐标在横向上平移的距离作为横向上的尺寸差值;Taking the distance translated in the lateral direction by the distorted image coordinates corresponding to the second calibration image as the lateral size difference;
    将所述第二标定图像对应的畸变图像坐标在纵向上平移的距离作为纵向上的尺寸差值。The distance that the coordinates of the distorted image corresponding to the second calibration image are translated in the longitudinal direction is taken as the dimension difference in the longitudinal direction.
  11. 一种校正广角镜头图像畸变的装置,其特征在于,包括:A device for correcting image distortion of a wide-angle lens, characterized in that it comprises:
    输入模块,配置成输入原始畸变图像和预设的第一标定图像;The input module is configured to input the original distorted image and the preset first calibration image;
    确定模块,配置成根据所述原始畸变图像和所述第一标定图像确定第二标定图像;A determining 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 a difference parameter of the second calibration image, and correct the coordinates of the distorted image according to the difference parameter;
    输出模块,配置成根据校正后的畸变图像坐标对应的像素值,输出校正图像。The output module is configured to output the corrected image according to the pixel values corresponding to the corrected distorted image coordinates.
  12. 根据权利要求11所述的装置,其中,所述确定模块还配置成:The device according to claim 11, wherein the determining module is further configured to:
    确定所述第一标定图像的分辨率之下与所述原始畸变图像的长宽比相同的最大分辨率对应的图像,作为所述第二标定图像。An image corresponding to a maximum resolution below the resolution of the first calibration image and having the same aspect ratio as the original distorted image is determined as the second calibration image.
  13. 根据权利要求11所述的装置,其中,所述校正模块具体配置成:The device according to claim 11, wherein the correction module is specifically configured to:
    确定所述第二标定图像与所述原始畸变图像的分辨率比值为所述尺寸比例系数,以及确定所述第一标定图像与所述第二标定图像在横向和纵向上的像素个数差值为所述边缘尺寸差值。determining the resolution ratio of the second calibration image to the original distorted image as the size scaling factor, and determining the difference in the number of pixels between the first calibration image and the second calibration image in the horizontal and vertical directions is the edge size difference.
  14. 根据权利要求11所述的装置,其中,所述校正模块具体配置成:The device according to claim 11, wherein the correction module is specifically configured to:
    确定所述第二标定图像与所述原始畸变图像的分辨率比值,将所述分辨率比值与广角镜头的数字变焦倍数的比值作为所述尺寸比例系数;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 the size ratio factor;
    确定所述第二标定图像在横向上的像素个数与所述数字变焦倍数的第一比值,确定所述第二标定图像在横向上的像素个数与所述第一比值的第一差值,确定所述第一标定图像与所述第二标定图像在横向 上的像素个数的第二差值;以及确定所述第二标定图像在纵向上的像素个数与所述数字变焦倍数的第二比值,确定所述第二标定图像在纵向上的像素个数与所述第二比值的第三差值,确定所述第一标定图像与所述第二标定图像在纵向上的像素个数的第四差值;确定所述第一差值与所述第二差值之和,以及所述第三差值与所述第四差值之和为所述边缘尺寸差值。Determine the first ratio of the number of pixels in the horizontal direction of the second calibration image to the digital zoom factor, and determine the first difference between the number of pixels in the horizontal direction of the second calibration image and the first ratio , determining a second difference between the number of pixels in the horizontal direction between the first calibration image and the second calibration image; and determining the difference between the number of pixels in the vertical direction of the second calibration image and the digital zoom factor The second ratio is to determine the third difference between the number of pixels in the vertical direction of the second calibration image and the second ratio, and to determine the number of pixels in the vertical direction between the first calibration image and the second calibration image A fourth difference of the number; 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.
  15. 根据权利要求11所述的装置,其中,所述校正模块具体配置成:The device according to claim 11, wherein the correction module is specifically configured to:
    根据所述边缘尺寸差值对所述畸变图像坐标进行平移;Translating the distorted image coordinates according to the edge size difference;
    根据所述尺寸比例系数对平移后的畸变图像坐标进行缩放。Scale the translated distorted image coordinates according to the size scale coefficient.
  16. 根据权利要求11所述的装置,其中,所述计算模块具体配置成:The device according to claim 11, wherein the calculation module is specifically configured to:
    根据所述第一标定图像的畸变参数和畸变数学模型计算第二标定图像中每个像素点对应的畸变图像坐标。Calculate the distorted image coordinates corresponding to each pixel in the second calibration image according to the distortion parameters of the first calibration image and the distortion mathematical model.
  17. 根据权利要求11所述的装置,其中,所述计算模块具体配置成:The device according to claim 11, wherein the calculation module is specifically configured to:
    根据所述第一标定图像的畸变参数和畸变数学模型,按照预设间隔取出像素点,计算所述像素点对应的畸变图像坐标;According to the distortion parameters and the distortion mathematical model of the first calibration image, pixel points are taken out according to preset intervals, and the coordinates of the distorted image corresponding to the pixel points are calculated;
    根据插值法估算所述像素点各相邻点之间的其他点对应的畸变图像坐标。Estimating the distorted image coordinates corresponding to other points between adjacent points of the pixel point according to an interpolation method.
  18. 一种照相设备,其特征在于,设置有如权利要求11所述的校正广角镜头图像畸变的装置。A photographic device, characterized in that it is provided with a device for correcting image distortion of a wide-angle lens as claimed in claim 11.
  19. 一种电子设备,其特征在于,包括:存储器和一个或多个处理器,将所述存储器配置成存储计算机可读指令的模块,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行权利要求1-10任一项所述的校正广角镜头图像畸变的方法。An electronic device, characterized by comprising: a memory and one or more processors, the memory is configured as a module storing computer-readable instructions, and when the computer-readable instructions are executed by the processor, the The one or more processors execute the method for correcting image distortion of a wide-angle lens according to any one of claims 1-10.
  20. 一个或多个存储有计算机可读指令的非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行权利要求1-10任一项所述的校正广角镜头图像畸变的方法。One or more non-volatile storage media storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute any one of claims 1-10 A method for correcting image distortions of wide-angle lenses.
PCT/CN2021/137562 2021-10-25 2021-12-13 Method and apparatus for correcting image distortion of wide-angle lens, and photographing device WO2023070862A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111239136.4A CN113962892A (en) 2021-10-25 2021-10-25 Method and device for correcting wide-angle lens image distortion and photographic equipment
CN202111239136.4 2021-10-25

Publications (1)

Publication Number Publication Date
WO2023070862A1 true WO2023070862A1 (en) 2023-05-04

Family

ID=79466540

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/137562 WO2023070862A1 (en) 2021-10-25 2021-12-13 Method and apparatus for correcting image distortion of wide-angle lens, and photographing device

Country Status (2)

Country Link
CN (1) CN113962892A (en)
WO (1) WO2023070862A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115222631B (en) * 2022-09-13 2022-12-13 武汉中导光电设备有限公司 Distorted image correction method, device and equipment and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1096777A1 (en) * 1999-10-28 2001-05-02 Hewlett-Packard Company, A Delaware Corporation Document imaging system
CN109671028A (en) * 2018-11-30 2019-04-23 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment, computer readable storage medium
CN109961401A (en) * 2017-12-14 2019-07-02 西安全志科技有限公司 A kind of method for correcting image and storage medium of binocular camera
CN110264426A (en) * 2019-06-24 2019-09-20 Oppo广东移动通信有限公司 Image distortion correction method and apparatus
CN111951193A (en) * 2020-08-21 2020-11-17 安谋科技(中国)有限公司 Method and apparatus for correcting horizontal distortion of image
CN112258418A (en) * 2020-10-29 2021-01-22 黑芝麻智能科技(上海)有限公司 Image distortion correction method, device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1096777A1 (en) * 1999-10-28 2001-05-02 Hewlett-Packard Company, A Delaware Corporation Document imaging system
CN109961401A (en) * 2017-12-14 2019-07-02 西安全志科技有限公司 A kind of method for correcting image and storage medium of binocular camera
CN109671028A (en) * 2018-11-30 2019-04-23 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment, computer readable storage medium
CN110264426A (en) * 2019-06-24 2019-09-20 Oppo广东移动通信有限公司 Image distortion correction method and apparatus
CN111951193A (en) * 2020-08-21 2020-11-17 安谋科技(中国)有限公司 Method and apparatus for correcting horizontal distortion of image
CN112258418A (en) * 2020-10-29 2021-01-22 黑芝麻智能科技(上海)有限公司 Image distortion correction method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113962892A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
JP5403557B2 (en) System and method for image correction
US8823842B2 (en) Image processing device
US11669942B2 (en) Image de-warping system
US20170330311A1 (en) Image processing device and method, image capturing device, program, and record medium
WO2021185130A1 (en) Digital zoom method and system, electronic device, medium, and digital imaging device
TWI517094B (en) Image calibration method and image calibration circuit
WO2021195829A1 (en) Image processing method and apparatus, and movable platform
TWI492187B (en) Method and device for processing a super-resolution image
WO2023070862A1 (en) Method and apparatus for correcting image distortion of wide-angle lens, and photographing device
US10395337B2 (en) Image processing apparatus, image processing method, and storage medium
KR101140953B1 (en) Method and apparatus for correcting distorted image
JP2012033007A (en) Image processing device and image processing method
US20200294208A1 (en) Image processing apparatus and distortion correction coefficient calculation method
US8509568B2 (en) Image processing apparatus and image processing method
JP6295619B2 (en) Image processing apparatus and method, and electronic apparatus
CN103929584B (en) Method for correcting image and image calibrating circuit
JP6273881B2 (en) Image processing apparatus, image processing method, and program
JP6491445B2 (en) Image processing apparatus, imaging apparatus, image processing method, and program
KR102655332B1 (en) Device and method for image correction
JP4194889B2 (en) Image processing device
JP6091082B2 (en) Image processing apparatus, image processing method, and program
JP2009159404A (en) Image processing method, image processing device, and image formation device
JP6080728B2 (en) Distortion correction apparatus, distortion correction method, and distortion correction program
JP2015154455A (en) image processing apparatus, image processing method and image processing program
JP2013187630A (en) Picture processing device and method, and imaging device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21962205

Country of ref document: EP

Kind code of ref document: A1