Image correction method and device
By acquiring image and parameter information in the vehicle-mounted camera, and determining the pixel mapping relationship according to the correction coefficient, the problem of image distortion under large field of view is solved, the balance between image correction and field of view is achieved, and the authenticity of the image and observation are improved. scope.
Patent Information
- Application Number
- CN202410634730.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-09-03
AI Technical Summary
When a vehicle-mounted camera captures a large field of view, the image is prone to severe distortion, resulting in image distortion, making it difficult to meet the requirements of image authenticity and large field of view at the same time.
By obtaining image and camera parameter information, the pixel mapping relationship is determined according to the correction coefficient, and the image correction process is implemented to ensure that the corrected image resolution is the same, retaining a larger field of view while reducing image distortion.
It achieves a balance between retaining a large field of view, reducing image distortion, improving image authenticity, avoiding user misjudgments, and meeting the needs of image correction and field of view.
Smart Images

Figure CN118587131A
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to an image correction method and device thereof. Background Art
[0002] In the field of automotive cameras, in addition to requiring the camera to accurately capture the real scene around the car, it is also required to capture a wider range of scenes for human observation. Therefore, automotive cameras usually use lenses with a larger field of view to capture external light. However, there will be serious image distortion after imaging with a large field of view lens, that is, image distortion. In order to observe the real scene, it is often necessary to correct the distorted image, but image correction will sacrifice the field of view, which is inconsistent with the original intention of introducing a large field of view lens.
[0003] It can be seen that it is necessary to provide an image correction method that can simultaneously meet the requirements of image authenticity and large field of view. Summary of the invention
[0004] The embodiments of the present application provide an image correction method and device thereof to simultaneously meet the requirements of image authenticity and a large field of view.
[0005] In a first aspect, an embodiment of the present application provides an image correction method, comprising:
[0006] Acquire a first image and parameter information of an image acquisition device for acquiring the first image,
[0007] According to the correction coefficient and parameter information, the pixel mapping relationship between the second image and the first image is determined, and the resolution of the second image is the same as that of the first image.
[0008] According to the pixel mapping relationship, the pixel value of the first pixel in the first image is determined as the pixel value of the second pixel in the second image to obtain a corrected second image, where the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0009] In a second aspect, an embodiment of the present application provides an image correction device, comprising:
[0010] an acquisition module, used to acquire a first image and parameter information of an image acquisition device for acquiring the first image,
[0011] A determination module is used to determine the pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information, and the second image has the same resolution as the first image.
[0012] A correction module is used to determine the pixel value of a first pixel in the first image as the pixel value of a second pixel in the second image according to a pixel mapping relationship, so as to obtain a corrected second image, wherein the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising:
[0014] A processor and a memory storing programs or instructions;
[0015] The above method is implemented when the processor executes the program or instruction.
[0016] In a fourth aspect, an embodiment of the present application provides a machine-readable storage medium, on which a program or instruction is stored, and the program or instruction implements the above method when executed by a processor.
[0017] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the above method.
[0018] The image correction method and device of the embodiment of the present application can obtain a first image and parameter information of an image acquisition device that acquires the first image, and determine a pixel mapping relationship between a second image and the first image based on the correction coefficient and the parameter information. The second image has the same resolution as the first image. Based on the pixel mapping relationship, the pixel value of a first pixel in the first image is determined as the pixel value of a second pixel in the second image to obtain a corrected second image. The second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0019] In this way, the pixel position relationship before and after the distorted image can be determined based on the correction coefficient and the parameter information of the image acquisition device to achieve different degrees of distortion correction. While restoring the authenticity of the image, a larger field of view angle is retained as much as possible, so that the user can observe the largest possible range of scenes without the degree of image distortion causing misjudgment by the user. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] Figure 1 is a flowchart of an image correction method provided by an embodiment of the present application;
[0022] Figure 2 is a schematic diagram of a three-dimensional optical path in an image correction method provided in an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of image height data at different field angles in the image correction method provided in an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of the correction effect in the image correction method provided in an embodiment of the present application;
[0025] Figure 5 It is a flowchart of a specific scenario embodiment of the image correction method provided in the embodiment of the present application;
[0026] Figure 6 is a schematic structural diagram of an image correction device provided by another embodiment of the present application;
[0027] Figure 7 It is a structural schematic diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0028] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0029] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0030] In order to solve the problems in the prior art, the present application provides an image correction method and a device thereof. The image correction method provided by the present application is first introduced below.
[0031] Figure 1 FIG. 1 is a flow chart of an image correction method provided by an embodiment of the present application. Figure 1 As shown, the image correction method may include the following steps:
[0032] Step 101: Acquire a first image and parameter information of an image acquisition device for acquiring the first image.
[0033] In step 101, a first image captured by an image acquisition device and its parameter information may be obtained, wherein the image acquisition device may include a camera, a video camera, a camera, a scanner, and other devices. Taking the image acquisition device as a camera as an example, its parameter information may include resolution, pixel size, focal length, and distortion information, and the distortion information may include the field of view angle and the real image height and reference image height under corresponding conditions. The first image may be a distorted image to be corrected.
[0034] It can be understood that the field of view angle can be defined as the angle between the incident light and the main optical axis of the camera, and the image height can be defined as the distance between a certain pixel and the center of the image. The true image height can be defined as the image height formed on the imaging plane by the light incident on the camera for a certain field of view angle Y0, that is, the image height after distortion. The reference image height can be defined as the image height formed if the light with a field of view angle of Y0 propagates along a straight line and is incident on the imaging plane, that is, the image height without considering refraction and distortion. In order to more vividly illustrate the relationship between the field of view angle, the true image height and the reference image height, Figure 2 The figure shows the imaging process of a light ray emitted from a point P in the real world passing through a lens with a large field of view. It can be considered that the lens and the imaging plane are parallel and have no angle. At this time, the angle Y0 between the light ray PA propagating in a straight line and the principal optical axis (z axis) is the field of view of point P, and the distance |O1A| is the reference image height. Since the lens distorts and refracts the incident light, the actual point where point P is finally imaged is B, and the distance |O1B| is the actual image height.
[0035] Step 102: Determine the pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information, and the second image has the same resolution as the first image.
[0036] In step 102, the correction coefficient may be pre-set and stored, or may be selected by the user each time image correction is performed, or may be pre-matched from a preset correspondence based on parameter information, which is not specifically limited here.
[0037] The second image may be considered as a corrected image, and the resolution of the second image may be the same as the resolution of the first image. For example, if the resolution of the first image is m*n, then the resolution of the second image is also m*n.
[0038] It is understandable that for a wide field of view lens, due to the presence of distortion, there will be a significant difference between the real image height and the reference image height. The larger the difference, the more serious the image distortion, and the smaller the difference, the less severe the image distortion. The key to image correction is to find the corresponding relationship between the pixel positions before and after the distortion, that is, the pixel mapping relationship between the second image and the first image. Figure 2 In the figure shown, the pixel point after distortion at point A is point B. If point B is restored to the position of point A, the distortion correction for point B is completed. In this case, point B is located according to the real image height when point A corresponds to the field of view angle Y0, which will completely eliminate the distortion. If the pixel point after distortion is located according to the reference image height when point A corresponds to the field of view angle Y0, both the points before and after distortion will be at point A, that is, no pixel point of the distorted image will be restored, and the distortion will be completely retained.
[0039] Based on this, when calculating the pixel point corresponding to point A after distortion, a certain image height value can be found in the range of the real image height and the reference image height when point A corresponds to the field of view angle Y0 according to the correction coefficient, and the image height value is used to calculate the pixel point after distortion, so as to retain a certain degree of distortion and a larger field of view at the same time. If the image height value is closer to the real image height, the image distortion degree is lower and the field of view is smaller. If the image height value is closer to the reference image height, the image distortion degree is higher and the field of view is larger. Therefore, the correction coefficient can be set according to actual needs, and the pixel mapping relationship between the second image and the first image that meets the actual needs can be calculated.
[0040] Step 103, according to the pixel mapping relationship, determine the pixel value of the first pixel in the first image as the pixel value of the second pixel in the second image to obtain a corrected second image, the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0041] In step 103, according to the pixel mapping relationship, the second image I dst Each pixel in corresponds to the first image I src The pixel value of the pixel in is assigned to the second image I dst The pixel point in the image has completed the distortion correction of the pixel point, and the second image I dst All pixels in the first image can be completed Isrc The distortion is corrected to obtain a corrected second image.
[0042] In an embodiment of the present application, the image correction method can obtain a first image and parameter information of an image acquisition device that acquires the first image, and determine a pixel mapping relationship between a second image and the first image based on the correction coefficient and the parameter information. The second image has the same resolution as the first image, and the pixel value of a first pixel in the first image is determined as the pixel value of a second pixel in the second image to obtain a corrected second image. The second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0043] In this way, the pixel position relationship before and after the distorted image can be determined based on the correction coefficient and the parameter information of the image acquisition device to achieve different degrees of distortion correction. While restoring the authenticity of the image, a larger field of view angle is retained as much as possible, so that the user can observe the largest possible range of scenes without the degree of image distortion causing misjudgment by the user.
[0044] In some embodiments, before the above step 102, the image correction method may further include the following steps:
[0045] Receive the first input from the user,
[0046] In response to a first input, a correction factor associated with the first input is determined.
[0047] In this embodiment, a first input from a user may be received. The first input may refer to the user directly inputting a correction coefficient, or may refer to receiving the user's input for a certain correction coefficient when different correction coefficients are displayed, or may refer to receiving the user's input for different correction levels. No specific limitation is made here.
[0048] A correction coefficient may be determined in response to the first input, and the correction coefficient is associated with the first input. For example, the correction coefficient may be a value corresponding to the first input, or a value determined according to a correction level corresponding to the first input, which is not specifically limited here.
[0049] In this embodiment, the user can set the correction coefficient according to actual needs, so that a satisfactory corrected second image can be obtained later, which improves the flexibility of image correction.
[0050] In some embodiments, before the above step 102, the image correction method may further include the following steps:
[0051] According to the resolution, a pixel matrix is constructed as the second image with empty pixel values.
[0052] In this embodiment, taking the resolution of the first image as m*n as an example, an m*n pixel matrix can be constructed and the pixel matrix can be used as the second image with empty pixel values, that is, the pixel points in the pixel matrix can be used as the pixel points of the second image, and the pixel points corresponding to the pixel points in the first image can be calculated according to the positions of the pixel points in the pixel matrix, thereby calculating the pixel mapping relationship between the second image and the first image.
[0053] In some embodiments, the parameter information includes focal length and distortion information, and the above step 102 may include the following steps:
[0054] The optical center of the second image is determined as the origin of the rectangular coordinate system.
[0055] According to the pixel coordinates of the third pixel point and the optical center of the second image, the first polar coordinates of the third pixel point are obtained after transformation, and the third pixel point is any pixel point in the second image.
[0056] According to the first polar coordinate and focal length, determine the target field of view angle,
[0057] According to the correction coefficient, the target field of view and the distortion information, the second polar coordinates of the third pixel after distortion are determined.
[0058] A pixel mapping relationship between the second image and the first image is determined according to the pixel coordinates of the third pixel and the second polar coordinates after the third pixel is distorted.
[0059] In this embodiment, the parameter information may include focal length and distortion information, and the distortion information may include field of view angle and real image height and reference image height under corresponding conditions.
[0060] For any third pixel point in the second image, the optical center (h c , v c ) as the coordinate origin of the rectangular coordinate system, and translate the coordinate origin of the pixel coordinate system where the third pixel point of the pixel coordinate (x, y) is located to the optical center (h c , v c ), the rectangular coordinates of the third pixel in the rectangular coordinate system are (xh c , yv c ), (xh c , yv c ) to convert the polar coordinates to obtain the first polar coordinates (φ, r) of the third pixel. At this time, r can be the reference image height of the third pixel.
[0061] The target field of view angle can be determined according to the first polar coordinate and the focal length. For example, the target field of view angle can be calculated by formula (1):
[0062] Y = arctan(r / f) (1)
[0063] Among them, Y is the field of view, r is the reference image height, and f is the focal length.
[0064] The second polar coordinates of the third pixel after distortion may be determined according to the correction coefficient, the target field of view and the distortion information. In other words, the second polar coordinates may be the polar coordinates of the corresponding pixel after distortion of the third pixel.
[0065] For example, the real image height and reference image height of the third pixel point can be obtained according to the target field of view angle and distortion information, and then the real image height and reference image height can be calculated based on the correction coefficient to obtain the simulated image height r0, and then the second polar coordinate (φ, r0) of the third pixel point after distortion can be determined.
[0066] It is also possible to first determine the field of view angle and the simulated image height under corresponding conditions based on the correction coefficient and the distortion information, and then match the corresponding simulated image height r0 based on the target field of view angle, and then determine the second polar coordinate (φ, r0) of the third pixel after distortion. This is not specifically limited here.
[0067] It is understandable that if only the radial distortion caused by the lens is considered, and the tangential distortion caused by the installation error is not considered, then the positions of the pixels before and after the distortion can be considered to be in the same direction. In other words, the polar coordinates of the distorted pixel corresponding to the third pixel (x, y) are (φ, r0), and the polar coordinates are converted to the optical center (h c , v c ) is the rectangular coordinate of the rectangular coordinate system of the coordinate origin, and the pixel point corresponding to the third pixel point after distortion can be found in the first image. Repeat the above operation to obtain the pixel mapping relationship between the second image and the first image.
[0068] In some embodiments, determining the pixel mapping relationship between the second image and the first image according to the pixel coordinates of the third pixel and the second polar coordinates after the third pixel is distorted may include the following steps:
[0069] The distorted second polar coordinates of the third pixel are converted into rectangular coordinates in a rectangular coordinate system.
[0070] Determine the fourth pixel point in the first image according to the rectangular coordinates in the rectangular coordinate system,
[0071] The fourth pixel point is determined as a pixel point corresponding to the third pixel point, wherein the pixel mapping relationship between the second image and the first image includes a corresponding relationship between the third pixel point and the fourth pixel point.
[0072] In this embodiment, the second polar coordinates (φ, r0) after the third pixel is distorted can be converted into rectangular coordinates in a rectangular coordinate system, that is, the origin can be obtained as (h c , v c ) The rectangular coordinates of the pixel after distortion are (x0, y0). According to the rectangular coordinates (x0, y0), the first image I src The fourth pixel point in the rectangular coordinate system is the second image I dst The third pixel in the first image I src The corresponding relationship of the fourth pixel in .
[0073] For the second image I dst Repeat the above operation for each pixel in the image to obtain the second image I dst Each pixel in the first image I src The corresponding relationship between each pixel in the second image is the mapping relationship between the pixels of the first image and the second image.
[0074] In this way, the pixel position relationship before and after the distorted image can be determined based on the correction coefficient, so as to subsequently achieve different degrees of distortion correction. While restoring the authenticity of the image, a larger field of view angle is retained as much as possible, so that the user can observe the largest possible range of scenes without the degree of image distortion causing misjudgment by the user.
[0075] In some embodiments, the distortion information includes a correspondence between the field of view angle and the real image height and the reference image height. The above-mentioned determining the second polar coordinates of the third pixel after distortion according to the correction coefficient, the target field of view angle and the distortion information may include the following steps:
[0076] According to the correction coefficient and distortion information, the corresponding relationship between the field of view angle and the simulated image height is determined. The simulated image height is determined based on the correction coefficient, the real image height and the reference image height.
[0077] According to the target field of view angle and the corresponding relationship between the field of view angle and the simulated image height, the simulated image height of the third pixel point is determined by interpolation method.
[0078] The distorted second polar coordinates of the third pixel are determined according to the simulated image height of the third pixel.
[0079] In this embodiment, the correspondence between the field of view angle and the simulated image height can be determined according to the correction coefficient and the distortion information. For example, the distortion information may include the correspondence between the field of view angle and the real image height and the reference image height, that is, the field of view angle 1 corresponds to the real image height 1 and the reference image height 1; the field of view angle 2 corresponds to the real image height 2 and the reference image height 2... the field of view angle n corresponds to the real image height n and the reference image height n.
[0080] The simulated image height can be calculated based on the correction coefficient, the real image height and the reference image height. For example, the correction coefficient can correspond to the weight value of the real image height, and the weight value of the reference image height can be 1 minus the correction coefficient. The simulated image height can be obtained by the weighted sum of the real image height and the reference image height. The specific calculation formula can be designed according to actual needs and is not specifically limited here.
[0081] The corresponding simulated image heights under different viewing angles can be calculated according to the correction coefficient. For example, the simulated image height 1 can be calculated according to the correction coefficient, the real image height 1 and the reference image height 1, and the field of view angle 1 corresponds to the simulated image height 1; the simulated image height 2 can be calculated according to the correction coefficient, the real image height 2 and the reference image height 2, and the field of view angle 2 corresponds to the simulated image height 2... The simulated image height n can be calculated according to the correction coefficient, the real image height n and the reference image height n, and the field of view angle n corresponds to the simulated image height n.
[0082] The simulated image height of the third pixel can be determined by interpolation method according to the target field of view angle and the correspondence between the field of view angle and the simulated image height. It can be understood that the above-mentioned simulated image height 1, simulated image height 2...simulated image height n are multiple discrete points. When the third pixel is actually calculated, the target field of view angle Y and the corresponding image height data obtained will be distributed between the discrete points. At this time, the interpolation method can be used to obtain the simulated image height corresponding to the pixel position. The interpolation method includes but is not limited to linear interpolation, quadratic interpolation, nearest neighbor interpolation and spline interpolation, etc., which are not specifically limited here.
[0083] The distorted second polar coordinates (φ, r0) of the third pixel point may be determined according to the simulated image height r0 of the third pixel point.
[0084] In some embodiments, the above-mentioned determination of the correspondence between the field of view angle and the simulated image height according to the correction coefficient and the distortion information may include the following steps:
[0085] According to the correction coefficient, the first weight of the real image height and the second weight of the reference image height are determined.
[0086] According to the real image height, the reference image height, the first weight and the second weight under the first field of view, the simulated image height corresponding to the first field of view is determined, and the first field of view is an arbitrary field of view.
[0087] In this embodiment, the first weight of the real image height and the second weight of the reference image height can be determined according to the correction coefficient. For example, if the correction coefficient can be the first weight, then the second weight can be 1 minus the correction coefficient. For another example, if the correction coefficient can be the second weight, then the first weight can be 1 minus the correction coefficient.
[0088] For any field of view angle, the simulated image height corresponding to the first field of view angle can be determined according to the real image height, the reference image height, the first weight and the second weight. For example, a first product of the real image height and the first weight, a second product of the reference image height and the second weight can be calculated, and the simulated image height can be equal to the sum of the first product and the second product.
[0089] In some embodiments, the expression for simulated image height is:
[0090] simu_height=[L*real_height+(100-L)*ref_height] / 100 (2)
[0091] Among them, simu_height is the simulated image height, real_height is the real image height, ref_height is the reference image height, and L is the correction coefficient.
[0092] In this embodiment, the correction coefficient L can be between 0 and 100. The closer the value of the distortion correction coefficient L is to 100, the greater the degree of distortion correction and the greater the loss of the field of view. When L=100, the distortion of the image will be completely eliminated, and the loss of the field of view will be the greatest. The closer the value of the distortion correction coefficient L is to 0, the lower the degree of distortion correction and the smaller the loss of the field of view. When L=0, no distortion correction will be performed on the image, and the field of view will not be lost.
[0093] Based on this, the distortion correction coefficient L can be used as the weight of the real image height, and (100-L) can be used as the weight of the reference image height. The simulated image height can be calculated according to the above formula (2). The relationship between the real image height, the reference image height and the simulated image height can be expressed as follows: Figure 3 shown.
[0094] Figure 4 Schematic diagram showing different correction effects, where Figure 4 Part a is a schematic diagram of a correction effect of 0%, part b is a schematic diagram of a correction effect of 20%, part c is a schematic diagram of a correction effect of 40%, part d is a schematic diagram of a correction effect of 60%, part e is a schematic diagram of a correction effect of 80%, and part f is a schematic diagram of a correction effect of 100%. It can be seen that as the correction effect increases, the degree of image curvature becomes lower and lower until the image is completely restored to reality, but this process is also accompanied by a decrease in the field of view, and the smaller the scene range is observed.
[0095] In some embodiments, the above step 102 may include the following steps:
[0096] Down-sampling the first image and the second image according to a preset sampling factor to obtain a plurality of first pixel grids of the first image and a plurality of second pixel grids of the second image,
[0097] Determine the mapping relationship between each second pixel grid in the second image and each first pixel grid in the first image according to the correction coefficient and the parameter information,
[0098] The above step 103 may include the following steps:
[0099] The pixel value of the third pixel grid in the first image is determined as the pixel value of the fourth pixel grid in the second image to obtain a corrected second image, the fourth pixel grid is any pixel grid among multiple second pixel grids, and the fourth pixel grid and the third pixel grid correspond to each second pixel grid in the second image and each first pixel grid in the first image.
[0100] In this embodiment, in order to reduce the amount of data calculation, a downsampling method may be used to determine the pixel mapping relationship between the second image and the first image.
[0101] For example, the first image and the second image may be downsampled according to a preset sampling factor k to obtain a plurality of first pixel grids of the first image and a plurality of second pixel grids of the second image. That is, the two images are divided into a grid according to k*k pixel points. The preset sampling factor k may be set according to actual needs and is not specifically limited here.
[0102] The center point of the pixel grid can be selected as the representative point of the pixel grid, and the mapping relationship between the representative point and the pixel points of the second image and the first image can be calculated. The calculation method is as described above and will not be repeated here. The calculation result is applicable to the entire pixel grid, that is, the mapping relationship between each second pixel grid in the second image and each first pixel grid in the first image can be obtained based on the mapping relationship of the representative point.
[0103] The pixel value of the third pixel grid in the first image can be determined as the pixel value of the fourth pixel grid in the second image to obtain the corrected second image. In other words, when performing image correction, the correction can be performed based on pixel grids. In this way, the amount of calculation can be reduced and computing resources can be saved.
[0104] In some embodiments, after the above step 103, the image correction method may further include the following steps:
[0105] receiving a second input from the user,
[0106] In response to the second input, an updated correction coefficient is determined, and the updated correction coefficient is used to redetermine the pixel mapping relationship between the second image and the first image to obtain an updated second image.
[0107] In this embodiment, the corrected second image can be displayed. If the user is not satisfied with the correction effect, a second input from the user can be received, and the second input can be associated with the updated correction coefficient. In other words, the correction coefficient can be modified, and the image correction can be performed again according to the updated correction coefficient until the corrected second image meets the user's expectations.
[0108] In this way, the image correction effect can be further guaranteed and the flexibility of image correction is increased.
[0109] Based on the image correction method provided in the above embodiment, the present application also provides a specific scenario embodiment of the image correction method. Figure 5 As shown, this scenario embodiment may include the following steps:
[0110] Step 501, obtaining a distorted image (first image) and camera parameters (parameter information).
[0111] Step 502: The user sets the correction coefficient.
[0112] Step 503: simulate lens distortion data according to the correction coefficient, that is, determine the corresponding relationship between the field of view angle and the simulated image height according to the correction coefficient and the distortion information in the parameter information.
[0113] Step 504: construct a pixel matrix as an empty rectified image, that is, construct a pixel matrix according to the resolution as a second image with empty pixel values.
[0114] Step 505: determine the pixel mapping relationship between the distorted image (first image) and the corrected image (second image).
[0115] Step 506, performing distortion correction, that is, determining the pixel value of the first pixel in the first image as the pixel value of the second pixel in the second image to obtain a corrected second image, where the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0116] Step 507, determine whether the correction result is satisfactory, if so, end, if not, return to step 502.
[0117] Based on the image correction method provided in the above embodiment, the present application also provides an embodiment of an image correction device.
[0118] Figure 6 A schematic structural diagram of an image correction device provided in another embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0119] Reference Figure 6 , the image correction device 600 may include:
[0120] The acquisition module 601 is used to acquire a first image and parameter information of an image acquisition device for acquiring the first image.
[0121] The determination module 602 is used to determine the pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information, and the second image has the same resolution as the first image.
[0122] The correction module 603 is used to determine the pixel value of the first pixel in the first image as the pixel value of the second pixel in the second image according to the pixel mapping relationship, so as to obtain a corrected second image, where the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
[0123] In some embodiments, the image correction device 600 may further include:
[0124] A receiving module, configured to receive a first input from a user,
[0125] The correction coefficient determination module is configured to determine a correction coefficient associated with the first input in response to the first input.
[0126] In some embodiments, the image correction device 600 may further include:
[0127] The construction module is used to construct a pixel matrix according to the resolution as the second image with empty pixel values.
[0128] In some embodiments, the parameter information includes focal length and distortion information, and the determination module 602 may also be used to:
[0129] The optical center of the second image is determined as the origin of the rectangular coordinate system.
[0130] According to the pixel coordinates of the third pixel point and the optical center of the second image, the first polar coordinates of the third pixel point are obtained after transformation, and the third pixel point is any pixel point in the second image.
[0131] According to the first polar coordinate and focal length, determine the target field of view angle,
[0132] According to the correction coefficient, the target field of view and the distortion information, the second polar coordinates of the third pixel after distortion are determined.
[0133] A pixel mapping relationship between the second image and the first image is determined according to the pixel coordinates of the third pixel and the second polar coordinates after the third pixel is distorted.
[0134] In some embodiments, determining a pixel mapping relationship between the second image and the first image according to the pixel coordinates of the third pixel and the second polar coordinates after the third pixel is distorted includes:
[0135] The distorted second polar coordinates of the third pixel are converted into rectangular coordinates in a rectangular coordinate system.
[0136] Determine the fourth pixel point in the first image according to the rectangular coordinates in the rectangular coordinate system,
[0137] The fourth pixel point is determined as a pixel point corresponding to the third pixel point, wherein the pixel mapping relationship between the second image and the first image includes a corresponding relationship between the third pixel point and the fourth pixel point.
[0138] In some embodiments, the distortion information includes the correspondence between the field of view angle and the real image height and the reference image height. The determination module 602 may also be used to:
[0139] According to the correction coefficient and distortion information, the corresponding relationship between the field of view angle and the simulated image height is determined. The simulated image height is determined based on the correction coefficient, the real image height and the reference image height.
[0140] According to the target field of view angle and the corresponding relationship between the field of view angle and the simulated image height, the simulated image height of the third pixel point is determined by interpolation method.
[0141] The distorted second polar coordinates of the third pixel are determined according to the simulated image height of the third pixel.
[0142] In some embodiments, the determination module 602 may also be used to:
[0143] According to the correction coefficient, the first weight of the real image height and the second weight of the reference image height are determined.
[0144] According to the real image height and the reference image height under the first field of view angle, as well as the first weight and the second weight, the simulated image height corresponding to the first field of view angle is determined, and the first field of view angle is an arbitrary field of view angle.
[0145] The expression of simulated image height is:
[0146] simu_height=[L*real_height+(100-L)*ref_height] / 100
[0147] Among them, simu_height is the simulated image height, real_height is the real image height, ref_height is the reference image height, and L is the correction coefficient.
[0148] In some embodiments, the determination module 602 may also be used to:
[0149] Down-sampling the first image and the second image according to a preset sampling factor to obtain a plurality of first pixel grids of the first image and a plurality of second pixel grids of the second image,
[0150] Determine the mapping relationship between each second pixel grid in the second image and each first pixel grid in the first image according to the correction coefficient and the parameter information,
[0151] Accordingly, the correction module 603 may also be used to:
[0152] The pixel value of the third pixel grid in the first image is determined as the pixel value of the fourth pixel grid in the second image to obtain a corrected second image, the fourth pixel grid is any pixel grid among multiple second pixel grids, and the fourth pixel grid and the third pixel grid correspond to each second pixel grid in the second image and each first pixel grid in the first image.
[0153] In some embodiments, the receiving module may also be used to receive a second input from the user.
[0154] The correction coefficient determination module can also be used to determine an updated correction coefficient in response to a second input, and the updated correction coefficient is used to redetermine the pixel mapping relationship between the second image and the first image to obtain an updated second image.
[0155] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application, and are devices corresponding to the above-mentioned image correction method. All implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device. Its specific functions and technical effects brought about can be found in the method embodiment part, which will not be repeated here.
[0156] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0157] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in yet another embodiment of the present application is shown.
[0158] The device may include a processor 701 and a memory 702 storing programs or instructions.
[0159] When the processor 701 executes the program, the steps in any of the above method embodiments are implemented.
[0160] Exemplarily, the program may be divided into one or more modules / units, one or more modules / units are stored in the memory 702 and executed by the processor 701 to complete the present application. One or more modules / units may be a series of program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the program in the device.
[0161] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0162] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 702 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 702 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 702 is a non-volatile solid-state memory.
[0163] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) machine-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0164] The processor 701 implements any one of the methods in the above embodiments by reading and executing the program or instruction stored in the memory 702 .
[0165] In one example, the electronic device may further include a communication interface 703 and a bus 704. The processor 701, the memory 702, and the communication interface 703 are connected via the bus 704 and communicate with each other.
[0166] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0167] Bus 704 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 704 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0168] In addition, in combination with the method in the above embodiment, the embodiment of the present application may provide a machine-readable storage medium for implementation. The machine-readable storage medium stores a program or instruction; when the program or instruction is executed by a processor, any one of the methods in the above embodiment is implemented. The machine-readable storage medium can be read by a machine such as a computer.
[0169] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0170] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0171] An embodiment of the present application provides a computer program product, which is stored in a machine-readable storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0172] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0173] The functional modules shown in the above block diagram can be implemented as hardware, software, firmware or their combination. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), suitable firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer grids such as the Internet, intranets, etc.
[0174] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0175] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by a computer program or instruction. These programs or instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0176] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. An image correction method, It is characterized in that The method comprises: acquiring a first image and parameter information of an image acquisition device for acquiring the first image, Determine a pixel mapping relationship between a second image and the first image according to the correction coefficient and the parameter information, wherein the second image has the same resolution as the first image. According to the pixel mapping relationship, the pixel value of the first pixel in the first image is determined as the pixel value of the second pixel in the second image to obtain a corrected second image, wherein the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
2. The method according to claim 1, It is characterized in that Before determining the pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information, the method further includes: Receive the first input from the user, In response to the first input, a correction factor associated with the first input is determined.
3. The method according to claim 1, It is characterized in that The parameter information includes resolution. Before determining the pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information, the method further includes: According to the resolution, a pixel matrix is constructed as a second image whose pixel values are empty.
4. The method according to claim 1, It is characterized in that The parameter information includes focal length and distortion information, and determining the pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information includes: Determine the optical center of the second image as the coordinate origin of the rectangular coordinate system, According to the pixel coordinates of the third pixel point and the optical center of the second image, the first polar coordinates of the third pixel point are obtained after transformation, and the third pixel point is any pixel point in the second image. Determine the target field of view angle according to the first polar coordinates and the focal length, Determine the second polar coordinates of the third pixel after distortion according to the correction coefficient, the target field of view and the distortion information, A pixel mapping relationship between the second image and the first image is determined according to the pixel coordinates of the third pixel and the second polar coordinates of the third pixel after distortion.
5. The method according to claim 4, It is characterized in that The determining, according to the pixel coordinates of the third pixel and the second polar coordinates of the third pixel after distortion, a pixel mapping relationship between the second image and the first image includes: The distorted second polar coordinates of the third pixel point are converted into rectangular coordinates in the rectangular coordinate system. determining a fourth pixel point in the first image according to the rectangular coordinates in the rectangular coordinate system, The fourth pixel point is determined as a pixel point corresponding to the third pixel point, wherein the pixel mapping relationship between the second image and the first image includes a corresponding relationship between the third pixel point and the fourth pixel point.
6. The method according to claim 4, It is characterized in that The distortion information includes a correspondence between a field of view angle and a real image height and a reference image height, and determining the second polar coordinates of the third pixel after distortion according to the correction coefficient, the target field of view angle and the distortion information includes: According to the correction coefficient and the distortion information, determining a corresponding relationship between a field of view angle and a simulated image height, wherein the simulated image height is determined based on the correction coefficient, the real image height and the reference image height, According to the target field of view angle and the corresponding relationship between the field of view angle and the simulated image height, an interpolation method is used to determine the simulated image height of the third pixel point, The distorted second polar coordinates of the third pixel are determined according to the simulated image height of the third pixel.
7. The method according to claim 6, It is characterized in that Determining the corresponding relationship between the field of view angle and the simulated image height according to the correction coefficient and the distortion information includes: According to the correction coefficient, a first weight of the real image height and a second weight of the reference image height are determined, According to the real image height and the reference image height at a first field of view angle, as well as the first weight and the second weight, a simulated image height corresponding to the first field of view angle is determined, and the first field of view angle is an arbitrary field of view angle. The expression of the simulated image height is: simu_height=[L*real_height+(100-L)*ref_height] / 100 Among them, simu_height is the simulated image height, real_height is the real image height, ref_height is the reference image height, and L is the correction coefficient.
8. The method according to claim 1, It is characterized in that The step of determining a pixel mapping relationship between the second image and the first image according to the correction coefficient and the parameter information includes: Down-sampling the first image and the second image according to a preset sampling factor to obtain a plurality of first pixel grids of the first image and a plurality of second pixel grids of the second image, Determine, according to the correction coefficient and the parameter information, a mapping relationship between each second pixel grid in the second image and each first pixel grid in the first image, The step of determining the pixel value of a first pixel in the first image as the pixel value of a second pixel in the second image according to the pixel mapping relationship to obtain a corrected second image includes: The pixel value of the third pixel grid in the first image is determined as the pixel value of the fourth pixel grid in the second image to obtain a corrected second image, wherein the fourth pixel grid is any pixel grid among the multiple second pixel grids, and the fourth pixel grid and the third pixel grid correspond to each second pixel grid in the second image and each first pixel grid in the first image.
9. The method according to claim 1, It is characterized in that After determining the pixel value of the first pixel in the first image as the pixel value of the second pixel in the second image to obtain the corrected second image, the method further includes: receiving a second input from the user, In response to the second input, an updated correction coefficient is determined, and the updated correction coefficient is used to redetermine a pixel mapping relationship between the second image and the first image to obtain an updated second image.
10. An image correction device, It is characterized in that The device comprises: an acquisition module, used to acquire a first image and parameter information of an image acquisition device for acquiring the first image, a determination module, configured to determine a pixel mapping relationship between a second image and the first image according to the correction coefficient and the parameter information, wherein the second image has the same resolution as the first image, A correction module is used to determine the pixel value of a first pixel in the first image as the pixel value of a second pixel in the second image according to the pixel mapping relationship, so as to obtain a corrected second image, wherein the second pixel is any pixel in the second image, and the second pixel corresponds to the first pixel in the pixel mapping relationship.
Citation Information
Patent Citations
Image correction method and terminal
CN111656391A
Image conversion method and device, computer readable storage medium and electronic equipment
CN112489114A
Distortion correction method for images shot by redundant fisheye cameras
CN113538283A
Method and equipment for correcting geometric distortion of image
CN116416143A
Image distortion calibration method, correction method, computer device and computer readable storage medium
CN116543055A
