Lens Shadow Correction Interpolation Method, Device and Storage Medium Based on Grid Method

By inserting blank grids into the calibration image and performing high sampling interpolation and compensation, the grid-based lens shadow correction method solves the problem of large demand for gain points or poor results, and achieves efficient lens shadow correction effect and storage cost reduction.

CN119991535BActive Publication Date: 2025-07-18ZHEJIANG XINMAI SILICON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510466499.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-07-18
Estimated Expiration
2045-04-15

AI Technical Summary

Technical Problem

The existing lens shadow correction methods have the problem that high demand for gain points leads to high costs or low demand for gain points but poor correction effect, especially the grid method leads to bias and periodic differences in bilinear interpolation results after reducing the number of gain points.

Method used

The lens shadow correction interpolation method based on the grid method is adopted. By inserting a blank grid into the calibration image, a second grid map is formed, the target grid group is extracted, the coordinate points of each grid are calculated and bilinear interpolated, high sampling interpolation and compensation are performed using the information of the surrounding known points, and finally bilinear interpolation is performed to reduce the number of gain points.

Benefits of technology

With low storage space requirements, high-quality lens shadow correction effect is achieved, avoiding the deviation and periodic differences in interpolation results caused by the reduction of the number of gain points, and reducing storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991535B_ABST
    Figure CN119991535B_ABST
Patent Text Reader

Abstract

The present invention discloses a lens shadow correction interpolation method, device and storage medium based on a grid method, belonging to the technical field of image processing, including: obtaining a calibration image, and calibrating the calibration image by using the grid method to obtain a first grid map containing calibration gain data; inserting blank grids between all adjacent first grids to obtain a second grid map, and extracting a plurality of target grid groups from the second grid map according to a preset direction; determining the coordinate points of the first grids in each target grid group, and calculating the first interpolation gain data of the blank grids in the same group according to the coordinate points; performing bilinear interpolation on the calibration image according to all the first interpolation gain data and the calibration gain data to obtain target interpolation gain data. Before using bilinear interpolation, the present application first performs high-sampling interpolation on the low-sampling data and then performs bilinear interpolation to obtain an interpolation result, which can achieve the calibration effect of high storage space with lower storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular, to a lens shadow correction interpolation method, device, and storage medium based on the grid method. Background Art

[0002] During the image shooting process, due to the matching problem between the lens and the sensor, the captured images often show a dark edge, and this phenomenon is called lens shadow. To correct the lens shadow, there are currently two main methods: the center method and the grid method. The center method is based on the characteristic that the lens shadow basically conforms to concentric circles, and the correction intensity of the current pixel is determined by calculating the distance between the pixel and the shadow center. However, when the lens is eccentric or in other situations, the lens shadow no longer completely conforms to the characteristic of concentric circles, and at this time, the correction result of the center method will deviate, and the most obvious manifestation is that the correction result will show color cast.

[0003] The grid method divides the image into multiple grids, and each grid has different gain values. The lens shadow correction is achieved by storing a large amount of gain point data. The grid method can be divided into evenly divided grids and unevenly divided grids. However, no matter which grid method it is, a large amount of gain point data needs to be stored. Taking the basic grid method with 17×17 gain points as an example, 289 points of gain are required, and the gain points cannot be stored using a symmetric method, otherwise, the same problem as the center method will exist. If the number of gain points is directly reduced, for example, from 17×17 gain points to 9×9 gain points, although the storage requirement can be reduced, it will cause problems in the result of bilinear interpolation. Because the fewer the gain points, the greater the difference between the bilinear interpolation result and the actual value, and it will show a periodic difference, which will cause the final image to show periodic stripes.

[0004] In summary, the existing lens shadow correction methods have certain limitations. The center method requires fewer gain points, but the effect is average in some cases; while the grid method has a better correction effect, but it needs to store a large amount of gain point data, which is not conducive to cost control. Therefore, a new lens shadow correction method is needed, which can reduce the number of gain points while avoiding the deviation problem of the interpolation result caused by too few gain points, so as to achieve a better correction effect and reduce costs. Summary of the Invention

[0005] The purpose of the present invention is to provide a lens shadow correction interpolation method, device, and storage medium based on the grid method to solve the problems in the existing lens shadow correction methods, that is, the high cost caused by the large demand for gain points or the poor correction effect with fewer gain points required.

[0006] To achieve the above object, the present application adopts the following technical solutions:

[0007] A lens shadow correction interpolation method based on the grid method of the present application includes the following steps:

[0008] Obtain a calibration image, and perform lens shadow correction on the calibration image using the grid method to obtain a first grid map containing calibration gain data;

[0009] Insert blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extract several target grid groups containing first grids and blank grids from the second grid map in a preset direction, where each target grid group contains at least 3 first grids;

[0010] Determine the coordinate points of each first grid in the target grid group based on the position of each first grid in the second grid map and its calibration gain data, and calculate the first interpolation gain data of the blank grids in the same group according to the coordinate points;

[0011] Perform bilinear interpolation on the calibration image according to all the first interpolation gain data and calibration gain data to obtain target interpolation gain data.

[0012] Preferably, the step of extracting several target grid groups containing first grids and blank grids from the second grid map in a preset direction, where each target grid group contains at least 3 first grids, includes:

[0013] Taking the first first grid in the lower left of the second grid map as the base point, divide the second grid map along the horizontal, vertical, 45-degree and 135-degree directions respectively to obtain a plurality of initial grid groups containing first grids and blank grids;

[0014] Remove the initial grid groups with less than 3 first grids to obtain the grid groups to be processed;

[0015] Divide each grid group to be processed into several target grid groups according to the preset grid selection rule, and the number of first grids in the target grid group is 3.

[0016] Preferably, the step of dividing each grid group to be processed into several target grid groups according to the preset grid selection rule, and the number of first grids in the target grid group is 3, includes:

[0017] Select 3 first grids and the 2 blank grids between them in sequence from the first first grid in the grid group to be processed in the order from left to right to form a target grid group;

[0018] Remove the first first grid in the grid group to be processed and the blank grids connected to its right, and repeat the step of forming a target grid group when the number of remaining first grids in the grid group to be processed is greater than or equal to 3 until the number of remaining first grids is less than 3.

[0019] Preferably, determining the coordinate points of each first grid in the target grid group based on the positions of the respective first grids in the second grid map and their calibrated gain data includes:

[0020] Construct a coordinate system with the position of the grid in the second grid map as the horizontal axis and its corresponding gain data as the vertical axis, and obtain the coordinate points of each first grid according to the position of the first grid in the second grid map and its corresponding calibrated gain data.

[0021] Preferably, calculating the first interpolation gain data of the blank grids in the same group according to the coordinate points includes:

[0022] Calculate the first straight line according to the coordinate points of the first first grid and the last first grid in the target grid group;

[0023] Calculate the second straight line according to the slope of the first straight line and the coordinate points of the middle first grid in the target grid group, and calculate the initial interpolation gain data of the blank grids according to the second straight line and the abscissas of the blank grids in the target grid group;

[0024] Compensate each initial interpolation gain data to obtain the first interpolation gain data corresponding to each blank grid.

[0025] Preferably, compensating each initial interpolation gain data to obtain the first interpolation gain data corresponding to each blank grid includes:

[0026] Calculate the absolute value of the difference between the calibrated gain data of the last first grid and the middle first grid in the target grid group and the absolute value of the difference between the calibrated gain data of the first first grid and the middle first grid in the target grid group respectively, to obtain the first target difference and the second target difference;

[0027] When the first target difference is greater than the second target difference, the first interpolation gain data of the first blank grid in the target grid group is its initial interpolation gain data plus the product of the preset compensation strength and the corresponding first target difference;

[0028] When the first target difference is less than or equal to the second target difference, the first interpolation gain data of the last blank grid in the target grid group is its initial interpolation gain data plus the product of the preset compensation strength and the corresponding first target difference.

[0029] Preferably, the method further includes:

[0030] When calculating the first interpolation gain data of the same blank grid in different target grid groups, take the average value of all the corresponding first interpolation gain data.

[0031] Preferably, the method further includes:

[0032] In the division of the target grid groups in the 45-degree direction and the 135-degree direction, there are respectively two unparticipated blank grids, and the first interpolation gain data of the unparticipated blank grids is determined by the values of the blank grids calculated from their opposite directions.

[0033] A lens shadow correction interpolation device based on the grid method, comprising:

[0034] A calibration module, configured to obtain a calibration image, and perform lens shadow correction on the calibration image by using the grid method to obtain a first grid map including calibration gain data;

[0035] A division module, configured to insert blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extract several target grid groups including first grids and blank grids from the second grid map according to a preset direction, and each target grid group includes at least 3 first grids;

[0036] A first interpolation module, configured to determine the coordinate points of each first grid in the target grid group based on the positions of the first grids in the second grid map and their calibration gain data, and calculate the first interpolation gain data of the blank grids in the same group according to the coordinate points;

[0037] A second interpolation module, configured to perform bilinear interpolation on the calibration image according to all the first interpolation gain data and the calibration gain data to obtain target interpolation gain data.

[0038] A computer-readable storage medium storing a computer program, where the computer program, when executed by a computer, implements a lens shadow correction interpolation method based on the grid method as described in any one of the above.

[0039] The present invention has the following beneficial effects:

[0040] Before using bilinear interpolation, the present invention first performs high-sampling interpolation on low-sampling data, that is, constructs a linear relationship by using the information of surrounding known points, interpolates a preliminary result first, then compensates the preliminary result according to the relationship between the known points, and finally performs bilinear interpolation to obtain the interpolation result, which can achieve the calibration effect of high storage space with lower storage space. Description of the Drawings

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0042] Figure 1 It is a flowchart of a lens shadow correction interpolation method based on the grid method provided by an embodiment of the present application;

[0043] Figure 2 It is an example diagram of four interpolation directions in an embodiment of the present application;

[0044] Figure 3 It is an example diagram of a grid group to be processed in an embodiment of the present application;

[0045] Figure 4 It is the first distribution pattern diagram of g1, g2, and g3 on the coordinate axes in an embodiment of the present application;

[0046] Figure 5 It is the second distribution pattern diagram of g1, g2, and g3 on the coordinate axes in an embodiment of the present application;

[0047] Figure 6 It is the third distribution pattern diagram of g1, g2, and g3 on the coordinate axes in an embodiment of the present application;

[0048] Figure 7 It is the fourth distribution pattern diagram of g1, g2, and g3 on the coordinate axes in an embodiment of the present application;

[0049] Figure 8 It is an example diagram of the overall interpolation result in the 45-degree direction in an embodiment of the present application;

[0050] Figure 9 It is an example diagram of the overall interpolation result in the 135-degree direction in an embodiment of the present application;

[0051] Figure 10 It is an example diagram of the correspondence between the calibrated image blocks and the interpolation gain points in an embodiment of the present application;

[0052] Figure 11 It is an example diagram of performing two-way interpolation within a block in an embodiment of the present application;

[0053] Figure 12 It is an example diagram of performing horizontal linear interpolation within a block in an embodiment of the present application;

[0054] Figure 13 It is an example diagram of performing vertical linear interpolation within a block in an embodiment of the present application. Detailed implementation manner

[0055] To make the technical solution of this application clearer, the following further elaborates on the present invention in conjunction with the accompanying drawings and specific embodiments. The terms "first", "second", etc. in the claims and the specification of this application are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances. This is only a way of distinguishing objects with the same attributes when describing the embodiments of this application. In addition, the terms "include" and "have" and any of their variations are intended to cover non-exclusive inclusion, so that a process, method, system, product or device including a series of units does not have to be limited to those units, but may include other units not clearly listed or inherent to these processes, methods, products or devices.

[0056] Embodiment 1

[0057] As Figure 1 shown, this embodiment provides a lens shadow correction interpolation method based on the grid method, including the following steps:

[0058] S110. Obtain a calibration image, and use the grid method to perform lens shadow correction on the calibration image to obtain a first grid map containing calibration gain data.

[0059] First, photograph an object such as a white wall in a uniform light scene to obtain an image for calibration. Then, use a computer program to divide the calibration image into uniform grids to obtain a first grid map. In this embodiment, the first grid map is 9*9. Calculate the average brightness value of each first grid, select the first grid with the highest brightness value as the reference value, and calculate the ratio of the reference value divided by the brightness value of the current grid as the gain value for all first grids. Save these gain values as calibration gain data.

[0060] S120. Insert blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extract several target grid groups containing first grids and blank grids from the second grid map in a preset direction. Each target grid group contains at least 3 first grids.

[0061] Insert a blank grid between two adjacent first grids. Each blank grid refers to a grid with calibration gain data of 0, that is, a grid to be interpolated. In this embodiment, only one blank grid is inserted between adjacent first grids. Therefore, after inserting blank grids into the 9*9 first grid map, a 17*17 second grid map is obtained.

[0062] Further, taking the first first grid in the lower left of the second grid map as the base point, divide the second grid map along the horizontal, vertical, 45-degree and 135-degree directions respectively to obtain multiple initial grid groups containing first grids and blank grids;

[0063] Remove the initial grid group with the number of the first grids less than 3 to obtain the grid group to be processed;

[0064] Divide each grid group to be processed into several target grid groups according to the preset grid selection rule, where the number of the first grids in the target grid group is 3.

[0065] In this embodiment, the preset directions include four interpolation directions: horizontal, vertical, 45-degree direction, and 135-degree direction. Among them, the horizontal direction represents the horizontal axis direction, the vertical direction represents the vertical axis direction, the 45-degree direction represents the diagonal direction from the lower left to the upper right, and the 135-degree direction represents the diagonal direction from the upper left to the lower right. As Figure 2 shown, the black dots therein represent the calibrated gain points, which can also be understood as the first grids, and are evenly distributed in the 17*17 second grid map; the white areas are the points to be interpolated, which can also be understood as blank grids, and are also evenly distributed in the 17*17 second grid map; based on the black dots among the red, blue, yellow, and green dots, the red dots are the horizontal interpolation thereof, the blue dots are the vertical interpolation thereof, the green dots are the 45-degree direction interpolation thereof, and the yellow dots are the 135-degree direction interpolation thereof. At the same time, these four directions are relative to the first grid. That is, when dividing the second grid map, the starting grid must be the first grid. In other words, the first grid in the initial grid group cannot be a blank grid, and in the same direction, there will be no repeated grids in the divided initial grid group.

[0066] Exemplarily, the specific division method of the initial grid group includes: when dividing horizontally, taking the column where the first grid at the lower left corner of the second grid map is located as the reference, and taking each first grid in this column as the starting point, the grid rows divided horizontally (to the right horizontally) all constitute an initial grid group; when dividing vertically, taking the row where the first grid at the lower left corner of the second grid map is located as the reference, and taking each first grid in this row as the starting point, the grid columns divided vertically (upward vertically) all constitute an initial grid group; when dividing in the 45-degree direction, taking the row and column where the first grid at the lower left corner of the second grid map is located as the reference, and taking each first grid in this row or column as the starting point, the oblique grid sequences divided in the 45-degree direction all constitute an initial grid group; when dividing in the 135-degree direction, taking the row where the first grid at the lower left corner of the second grid map is located and the column where the last first grid in this row is located as the reference, and taking each first grid in this row and this column as the starting point, the oblique grid sequences divided in the 135-degree direction all constitute an initial grid group.

[0067] It should be noted here that which first grid in the second grid map is used as the base point for dividing the initial grid group can be determined according to actual needs. For example, it can be the first grid at the upper left corner of the second grid map, or the first grid at the lower right corner of the second grid map, or the first grid at the upper right corner of the second grid group. No specific limitation is made here.

[0068] After obtaining all the initial grid groups, first determine whether the number of the first grids in each initial grid group is greater than or equal to 3. If there is an initial grid group in which the number of the first grids is less than 3, remove the corresponding initial grid group to obtain the grid groups to be processed. Here, 3 is used as the judgment basis because there must be 3 first grids in the subsequent target grid groups in this embodiment. Removing here facilitates subsequent operations.

[0069] Further, starting from the first first grid in the grid groups to be processed in the order from left to right, sequentially select 3 first grids and 2 blank grids between them to form a target grid group;

[0070] Remove the first first grid in the grid groups to be processed and the blank grids connected to its right, and repeat the step of forming the target grid group when the number of the remaining first grids in the grid groups to be processed is greater than or equal to 3 until the number of the remaining first grids is less than 3.

[0071] Specifically, as Figure 3 shown, horizontally, from bottom to top, take 17 points of the first row of grids in the second grid diagram for interpolation. Since the number of the first grids in this row of grids is greater than or equal to 3, this row of grids is the grid groups to be processed. Among them, g1 - g9 are the original 9 gain points, that is, calibration gain points, which can also be regarded as the first grids, and p1 - p8 are the gain points to be interpolated, that is, interpolation gain points, which can also be regarded as blank grids.

[0072] In the direction of the horizontal axis, the first first grid in the grid groups to be processed is g1. Then, the first selected target grid group contains five grids: g1, p1, g2, p2, and g3. The second selected target grid group contains five grids: g2, p2, g3, p3, and g4. The third one contains g3, p3, g4, p4, and g5. The fourth one contains g4, p4, g5, p5, and g6. The fifth one contains g5, p5, g6, p6, and g7. The sixth one contains g6, p6, g7, p7, and g8. The seventh one contains g7, p7, g8, p8, and g9. Starting from g8, the number of the remaining first grids in the grid groups to be processed is less than 3, and the division of the grid groups to be processed ends. At the same time, in the division of this embodiment, p2 - p7 appear twice. Subsequently, p2 - p7 will also go through two interpolation calculations, and at this time, the interpolation gain data is taken as the average of the two calculations.

[0073] The composition methods of the target grid groups in the vertical direction, 45 - degree direction, and 135 - degree direction are exactly the same as the horizontal principle, and will not be elaborated here.

[0074] S130. Determine the coordinate points of each first grid in the target grid group based on the positions of the first grids in the second grid map and their calibrated gain data, and calculate the first interpolation gain data of the blank grids in the same group according to the coordinate points.

[0075] In this embodiment, first construct a coordinate system. In this coordinate system, the abscissa represents the position of the grid in the second grid map, and the ordinate represents the gain data corresponding to the grid. Thus, the coordinate points of each first grid and the abscissa of the blank grids can be determined.

[0076] It should be noted here that the grids mentioned here include blank grids and first grids, and the gain data includes calibrated gain data and interpolation gain data.

[0077] Take Figure 3 as an example. g1 is the first grid at the lower left of the second grid map, and its abscissa is 1. g2 is its third grid, and the abscissa is 3, and so on. g9 is its seventeenth grid, and the abscissa of g9 is 17. Similarly, p1 is its second grid, and the abscissa of p1 is 2. p2 is its fourth grid, and the abscissa of p2 is 4, and so on. p8 is its sixteenth grid, and the abscissa of p8 is 16. At the same time, the ordinates of g1 - g9 are all their calibrated gain data, and the ordinates of p1 - p8 are all their first interpolation gain data.

[0078] Furthermore, calculate the first straight line according to the coordinate points of the first grid at the beginning and the last first grid in the target grid group.

[0079] Calculate the second straight line according to the slope of the first straight line and the coordinate points of the middle first grid in the target grid group, and calculate the initial interpolation gain data of the blank grids according to the second straight line and the abscissas of the blank grids in the target grid group.

[0080] Compensate each initial interpolation gain data to obtain the first interpolation gain data corresponding to each blank grid.

[0081] In this embodiment, the principle that two points determine a straight line is used. In the coordinate axis, the coordinate points of the first first grid and the last first grid of the target grid group are connected. The head and tail are in the same order as that followed when determining the target grid group. Taking the target grid group including g1, p1, g2, p2, and g3 as an example, the first straight line y1 = kx1 + b1 passing through these two coordinate points can be calculated according to the coordinate points of g1 and g3. Among them, k is the slope and b1 is the intercept. Thus, its slope k is obtained. Then, the straight line passing through the coordinate point of the second first grid, i.e., the middle first grid g2 of the target grid group and with a slope of k is set as the second straight line y2 = kx2 + b2. Substituting the coordinate point of g2 into the expression of the second straight line, the intercept b2 when the straight line with a slope of k passes through the point g2 can be obtained. Then, substituting the abscissas of p1 and p2 into the second straight line, the ordinates of p1 and p2 can be obtained, that is, the initial interpolation gain data of p1 and p2 are obtained.

[0082] At the same time, when abs(g32) > abs(g21), where abs represents the absolute value, g32 represents the difference between the calibration gain data of g3 and g2, and g21 represents the difference between the calibration gain data of g2 and g1, the interpolated gain p1 is less than the value of the straight line formed by connecting g1 and g2 at x = 2, and p2 is less than the value of the straight line formed by connecting the coordinate points of g2 and g3 at x = 4. Therefore, the values on the straight lines connecting g1 and g2, and g2 and g3 can be regarded as the linear interpolation results. And at this time, the linear interpolation results are larger than the actual values. Therefore, the relatively smaller p1 and p2 tend to be closer to the actual values.

[0083] Correspondingly, when abs(g32) <= abs(g21), the interpolated gain p1 is greater than the value of the straight line formed by connecting g1 and g2 at x = 2, and p2 is greater than the value of the straight line formed by connecting the coordinate points of g2 and g3 at x = 4. And at this time, the linear interpolation results are smaller than the actual values, and the relatively larger p1 and p2 are closer to the actual values.

[0084] In addition, even if the interpolation result is closer to the actual value, there will still be a certain deviation. Therefore, in this embodiment, the values of p1 and p2 will be compensated according to the different relationships among the three points g1, g2, and g3.

[0085] Specifically, if abs(g32) > abs(g21), that is, the absolute value of the difference in gain between g2 and g3 is greater than the absolute value of the difference in gain between g1 and g2, the distribution law of g1, g2, and g3 on the coordinate axis is as Figure 4 or Figure 5As shown, the interpolation result of p1 is compensated, and the compensated value is kgain*(g32 - g21), where kgain is the preset compensation strength, and p11 = p1 + kgain*(g32 - g21), and p11 is the gain value of p1 after compensation.

[0086] If abs(g32) <= abs(g21), that is, the absolute value of the difference in gain between g2 and g3 is less than or equal to the absolute value of the difference in gain between g1 and g2, then the distribution law of g1, g2, and g3 on the coordinate axis is as Figure 6 or Figure 7 As shown, the interpolation result of p2 is compensated, and the compensated value is kgain*(g32 - g21), and p22 = p2 + kgain*(g32 - g21), and p22 is the gain value of p2 after compensation.

[0087] Furthermore, in the division of the target grid groups in the 45-degree direction and the 135-degree direction, there are respectively two unparticipated blank grids, and the first interpolation gain data of the unparticipated blank grids is determined by the values of the blank grids calculated from the opposite direction.

[0088] After interpolating all the blank grids applicable to horizontal interpolation, vertical interpolation, 45-degree direction interpolation, and 135-degree direction interpolation are continued. Among them, the vertical interpolation process is exactly the same as the horizontal interpolation, and the 45-degree direction interpolation and the 135-degree direction interpolation are basically the same as the horizontal interpolation, except that if only one or two first grids can be obtained in the oblique direction, then the interpolation in this direction does not interpolate the blank grids included in this direction, but relies on the other direction to interpolate them. Among them, the blank grids that are not interpolated in the 45-degree direction interpolation are as Figure 8 shown, and the blank grids that are not interpolated in the 135-degree direction interpolation are as Figure 9 shown. Figure 8 and Figure 9 In [figure] and [figure], the dark red points represent the points that are only interpolated once in the horizontal interpolation, the red points are the points that are interpolated twice and the average value is taken, the dark blue points represent the points that are only interpolated once in the vertical interpolation, the blue points are the points that are interpolated twice and the average value is taken, the dark green points represent the points that are only interpolated once in the 45-degree direction interpolation, the green points are the points that are interpolated twice in the 45-degree direction and the average value is taken, the orange points represent the points that are only interpolated once in the 135-degree direction interpolation, the yellow points are the points that are interpolated twice in the 135-degree direction and the average value is taken. At the same time, Figure 8 the white points in [figure] represent the points that are not interpolated in the 45-degree direction interpolation. Figure 9The white dots in it indicate the points where interpolation is not performed in the 135-degree direction interpolation. After the interpolation in the 45-degree direction and the 135-degree direction is completed, the values of the points without interpolation after the 45-degree direction interpolation are taken from the values of these points calculated by the 135-degree direction interpolation, and the values of the points without interpolation after the 135-degree direction interpolation are taken from the values of these points calculated by the 45-degree direction interpolation. During the entire interpolation process, if a white point is repeatedly calculated in the horizontal, vertical, 45-degree, and 135-degree directions, its value is the average of all the values calculated in each direction.

[0089] After interpolation in four directions, a 17*17 interpolated gain point obtained by interpolating 9*9 calibrated gain points is obtained. Finally, the bilinear interpolation of the calibrated image is performed using the 17*17 interpolated gain point to obtain the gain value at full resolution.

[0090] S140. Perform bilinear interpolation on the calibrated image according to all the first interpolated gain data and the calibrated gain data to obtain the target interpolated gain data.

[0091] The steps of bilinear interpolation include: dividing the calibrated image into 16*16 blocks corresponding to the 17*17 interpolated gain points. As Figure 10 shown, the four red vertices around the first block blk are the points in the first and second rows and the first and second columns of the 17*17 interpolated gain points respectively. Calculate the interpolation result of the current point under the action of the four interpolated gain points inside each block.

[0092] Figure 11 It is a schematic diagram of bilinear interpolation inside a block. As Figure 11 shown, the length of this block is side_x and the width is side_y. Interpolate the points in the block. gain_11, gain_12, gain_21, and gain_22 are the four red interpolated gain points corresponding to the block where the point to be interpolated is located. K is the length of the point to be interpolated in the vertical direction from the interpolated gain point gain_12, and L is the length of the point to be interpolated in the horizontal direction from the interpolated gain point gain_11. The width side_x of this block = floor(width / 16), and the length side_y = floor(height / 16), where width and height are the width and height of the entire calibrated image respectively.

[0093] Bilinear interpolation can be regarded as the combination of two linear interpolations. First, it is the linear interpolation in the horizontal direction of L.

[0094] As Figure 12 shown, obtain the interpolation result L1 of gain_11 and gain_12, and the interpolation result L2 of gain_21 and gain_22.

[0095] L1 = (gain_11 * (L - 1) + gain_12 * (side_x + 1 - L)) / side_x.

[0096] L2 = (gain_21 * (L - 1) + gain_22 * (side_x + 1 - L)) / side_x.

[0097] As Figure 13 shown, calculate the linear interpolation of K in the vertical direction.

[0098] K1 = (L1 * (K - 1) + L2 * (side_y + 1 - K)) / side_y.

[0099] K1 is the obtained interpolation point.

[0100] Performing bilinear interpolation on all pixel points within the current block can obtain the gain at full resolution. After correcting the image using the gain at full resolution, the corrected result is output.

[0101] Before using bilinear interpolation in this embodiment, a high-sampling interpolation is first performed on the low-sampling data, that is, a linear relationship is constructed using the information of surrounding known points to interpolate a preliminary result first, and then the preliminary result is compensated according to the relationship between the known points. Finally, bilinear interpolation is performed to obtain the interpolation result, which can achieve the calibration effect achieved by high storage space with lower storage space.

[0102] Embodiment 2

[0103] This embodiment provides a lens shadow correction interpolation device based on the grid method, including:

[0104] A calibration module, configured to obtain a calibration image and perform lens shadow correction on the calibration image using the grid method to obtain a first grid map containing calibration gain data;

[0105] A division module, configured to insert blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extract a plurality of target grid groups including first grids and blank grids from the second grid map in a preset direction, where each target grid group contains at least 3 first grids;

[0106] A first interpolation module, configured to determine the coordinate points of each first grid in the target grid group based on the position of each first grid in the second grid map and its calibration gain data, and calculate the first interpolation gain data of the blank grids in the same group according to the coordinate points;

[0107] A second interpolation module, configured to perform bilinear interpolation on the calibration image according to all the first interpolation gain data and the calibration gain data to obtain target interpolation gain data.

[0108] This embodiment is used to implement the method provided in the above embodiment, and has the corresponding beneficial effects of the above method. For technical details not described in detail in this embodiment, reference may be made to the methods provided in all the foregoing embodiments of the present invention.

[0109] Embodiment 3

[0110] This embodiment provides an electronic device, including a memory and a processor. The memory is used to store one or more computer instructions. Among them, the one or more computer instructions are executed by the processor to implement the above-mentioned lens shadow correction interpolation method based on the grid method.

[0111] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the above-described electronic device can refer to the corresponding process in the foregoing method embodiment, and will not be elaborated here.

[0112] This embodiment provides a computer-readable storage medium storing a computer program, and the computer program, when executed by a computer, implements the above-mentioned lens shadow correction interpolation method based on the grid method.

[0113] Exemplarily, the computer program can be divided into one or more modules / units. One or more modules / units are stored in the memory and executed by the processor, and the I / O interface transmission of data is completed by the input interface and the output interface to complete the present invention. One or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program in the computer device.

[0114] The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer device may include, but is not limited to, a memory and a processor. Those skilled in the art can understand that this embodiment is only an example of the computer device and does not constitute a limitation on the computer device. It may include more or fewer components, or combine some components, or different components. For example, the computer device may also include an input device 907, a network access device, a bus, etc.

[0115] The processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0116] The memory may be an internal storage unit of the computer device, such as the hard disk or memory of the computer device. The memory may also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory may also include both the internal storage unit and the external storage device of the computer device. The memory is used to store computer programs and other programs and data required by the computer device. The memory may also be used to temporarily store data in the output device, and the aforementioned storage media include various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory ROM, random access memory RAM, diskettes or optical discs.

[0117] The above-described embodiments merely represent several implementation manners of the present invention, and the description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent for the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention shall be subject to the appended claims.

Claims

1. A lens shadow correction interpolation method based on the grid method, characterized in that Including the following steps: Obtain a calibration image, and use the grid method to perform lens shadow calibration on the calibration image to obtain a first grid map containing calibration gain data; Insert blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extract several target grid groups containing first grids and blank grids from the second grid map in a preset direction, where each target grid group contains at least 3 first grids; Determine the coordinate points of each first grid in the target grid group based on the position of each first grid in the second grid map and its calibration gain data, and calculate the first interpolation gain data of the blank grids in the same group according to the coordinate points; Perform bilinear interpolation on the calibration image according to all the first interpolation gain data and calibration gain data to obtain target interpolation gain data; Among them, the step of extracting several target grid groups containing first grids and blank grids from the second grid map in a preset direction, where each target grid group contains at least 3 first grids, includes: Taking the first first grid in the lower left of the second grid map as a base point, divide the second grid map in the horizontal, vertical, 45-degree and 135-degree directions respectively to obtain multiple initial grid groups containing first grids and blank grids; Remove the initial grid groups with the number of first grids less than 3 to obtain the grid groups to be processed; Divide each grid group to be processed into several target grid groups according to the preset grid selection rule, and the number of first grids in the target grid group is 3; The step of determining the coordinate points of each first grid in the target grid group based on the position of each first grid in the second grid map and its calibration gain data, and calculating the first interpolation gain data of the blank grids in the same group according to the coordinate points, includes: Construct a coordinate system with the position of the grid in the second grid map as the horizontal axis and its corresponding gain data as the vertical axis, and obtain the coordinate points of each first grid according to the position of the first grid in the second grid map and its corresponding calibration gain data; Calculate the first straight line according to the coordinate points of the first first grid and the last first grid in the target grid group; Calculate the second straight line according to the slope of the first straight line and the coordinate points of the middle first grid in the target grid group, and calculate the initial interpolation gain data of the blank grids according to the second straight line and the abscissa of the blank grids in the target grid group; Compensate each initial interpolation gain data to obtain the first interpolation gain data corresponding to each blank grid, including: Calculate the absolute value of the difference between the calibration gain data of the last first grid and the middle first grid and the absolute value of the difference between the calibration gain data of the first first grid and the middle first grid in the target grid group respectively to obtain a first target difference and a second target difference; When the first target difference is greater than the second target difference, the first interpolation gain data of the first blank grid in the target grid group is its initial interpolation gain data plus the product of the preset compensation strength and the corresponding first target difference; When the first target difference is less than or equal to the second target difference, the first interpolation gain data of the last blank grid in the target grid group is its initial interpolation gain data plus the product of the preset compensation strength and the corresponding first target difference.

2. The lens shadow correction interpolation method based on the grid method according to claim 1, characterized in that, Dividing each grid group to be processed into several target grid groups according to the preset grid selection rule, the number of the first grids in the target grid group is 3, including: Selecting 3 first grids and 2 blank grids between them in sequence from the first first grid in the grid group to be processed in the order from left to right to form a target grid group; Removing the first first grid in the grid group to be processed and the blank grids connected to its right, and repeating the step of forming a target grid group when the number of the remaining first grids in the grid group to be processed is greater than or equal to 3 until the number of the remaining first grids is less than 3.

3. A lens shadow correction interpolation method based on the grid method according to claim 1, characterized in that The method further includes: When calculating the first interpolation gain data of the same blank grid in different target grid groups, taking the average value of all its corresponding first interpolation gain data.

4. A lens shadow correction interpolation method based on the grid method according to claim 1, wherein The method further includes: In the division of the target grid groups in the 45-degree direction and the 135-degree direction, there are two unparticipated blank grids respectively, and the first interpolation gain data of the unparticipated blank grids is determined by the values of the blank grids calculated in the opposite direction.

5. A lens shadow correction interpolation device based on the grid method, characterized in that, Including: A calibration module, configured to obtain a calibration image, and perform lens shadow calibration on the calibration image by using a grid method to obtain a first grid map including calibration gain data; A division module, configured to insert blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extract several target grid groups including first grids and blank grids from the second grid map in a preset direction, and each target grid group includes at least 3 first grids; A first interpolation module, configured to determine the coordinate points of each first grid in the target grid group based on the positions of the first grids in the second grid map and their calibration gain data, and calculate the first interpolation gain data of the blank grids in the same group according to the coordinate points; A second interpolation module, configured to perform bilinear interpolation on the calibration image according to all the first interpolation gain data and the calibration gain data to obtain target interpolation gain data; Wherein, the division module extracts several target grid groups including first grids and blank grids from the second grid map in a preset direction, and each target grid group includes at least 3 first grids, including: Taking the first first grid at the lower left of the second grid map as a base point, dividing the second grid map in the horizontal, vertical, 45-degree and 135-degree directions respectively to obtain a plurality of initial grid groups including first grids and blank grids; Removing the initial grid groups with the number of first grids less than 3 to obtain grid groups to be processed; Dividing each grid group to be processed into several target grid groups according to the preset grid selection rule, and the number of the first grids in the target grid group is 3; The first interpolation module determines the coordinate points of each first grid in the target grid group based on the positions of the first grids in the second grid map and their calibrated gain data, and calculates the first interpolation gain data of the blank grids in the same group according to the coordinate points, including: Construct a coordinate system with the position of the grid in the second grid map as the horizontal axis and its corresponding gain data as the vertical axis, and obtain the coordinate points of each first grid according to the position of the first grid in the second grid map and its corresponding calibrated gain data; Calculate the first straight line according to the coordinate points of the first first grid and the last first grid in the target grid group; Calculate the second straight line according to the slope of the first straight line and the coordinate points of the middle first grid in the target grid group, and calculate the initial interpolation gain data of the blank grids according to the second straight line and the abscissas of the blank grids in the target grid group; Compensate each initial interpolation gain data to obtain the first interpolation gain data corresponding to each blank grid, including: Calculate the absolute value of the difference between the calibrated gain data of the last first grid and the middle first grid in the target grid group and the absolute value of the difference between the calibrated gain data of the first first grid and the middle first grid in the target grid group respectively, to obtain the first target difference and the second target difference; When the first target difference is greater than the second target difference, the first interpolation gain data of the first blank grid in the target grid group is its initial interpolation gain data plus the product of the preset compensation strength and the corresponding first target difference; When the first target difference is less than or equal to the second target difference, the first interpolation gain data of the last blank grid in the target grid group is its initial interpolation gain data plus the product of the preset compensation strength and the corresponding first target difference.

6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a computer, it implements a grid method-based lens shadow correction interpolation method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Image sensor, processing system and method, electronic equipment and storage medium

    CN111432099A

  • Correction method and device of image sensor and electronic equipment

    CN113709392A