Lens shadow correction interpolation method and device based on grid method and storage medium

Through the interpolation method of lens shadow correction based on the grid method, the problems of high costs and poor correction effects caused by large or small gain points in the prior art are solved, and lens shadow correction with lower storage space to achieve high storage space calibration effect is achieved.

CN119991535AActive Publication Date: 2025-05-13ZHEJIANG XINMAI SILICON CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing lens shadow correction methods have the problem that high costs or low gain points but poor correction results due to large demand for gain points.

Method used

The lens shadow correction interpolation method based on the grid method is adopted. By acquiring the calibration image and performing lens shadow correction using the grid method, a blank grid is inserted to form a second grid map, the target grid group is extracted and the interpolated gain data is calculated, and finally bilinear interpolation is performed to achieve correction.

Benefits of technology

While reducing the number of gain points, avoid the interpolation result deviation problem caused by too few gain points, achieve better lens shadow correction effect and reduce costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991535A_ABST
    Figure CN119991535A_ABST
Patent Text Reader

Abstract

The invention discloses a lens shadow correction interpolation method and device based on a grid method and a storage medium, and belongs to the technical field of image processing, and the method comprises the steps: obtaining a calibration image, and carrying out the calibration of the calibration image through employing the grid method, and obtaining a first grid chart containing calibration gain data; blank grids are inserted between all adjacent first grids to obtain a second grid chart, and a plurality of target grid groups are extracted from the second grid chart according to a preset direction; determining a coordinate point of a first grid in each target grid group, and calculating first interpolation gain data of a blank grid in the same group according to the coordinate point; and 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. According to the method, before the bilinear interpolation is used, the high-sampling interpolation is firstly performed on the low-sampling data, and then the bilinear interpolation is performed to obtain the interpolation result, so that a calibration effect achieved by a high storage space can be realized with a 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 shading correction interpolation method, device and storage medium based on a grid method. Background Art

[0002] During the image capture process, due to the matching problem between the lens and the sensor, the captured image often has dark edges. This phenomenon is called lens shading. In order to correct lens shading, there are currently two main methods: the center of circle method and the grid method. The center of circle method is based on the fact that lens shading basically conforms to the characteristics of concentric circles. The correction strength of the current pixel is determined by calculating the distance between the pixel and the center of the shadow. However, when the lens is eccentric, the lens shading no longer completely conforms to the characteristics of concentric circles. At this time, the correction result of the center of circle method will be biased. The most obvious manifestation is that the correction result will have color cast.

[0003] The grid rule divides the image into multiple grids, each with a different gain value, and achieves lens shading correction by storing a large amount of gain point data. The grid method can be divided into evenly divided grids and unevenly divided grids, but no matter which grid method is used, a large amount of gain point data needs to be stored. Taking the basic 17×17 gain point grid method as an example, 289 points of gain are required, and the gain points cannot be stored in a symmetrical way, otherwise the same problem will exist as the center of circle method. If the number of gain points is directly reduced, for example, from 17×17 gain points to 9×9 gain points, although the storage requirements can be reduced, it will cause problems with the results 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 shading correction methods have certain limitations. The center of circle method requires fewer gain points, but the effect is average in some cases; while the grid method has a better correction effect, it needs to store a large amount of gain point data, which is not conducive to cost control. Therefore, a new lens shading correction method is needed, which can reduce the number of gain points while avoiding the problem of interpolation result deviation caused by too few gain points, so as to achieve better correction effect and reduce cost. Summary of the invention

[0005] The purpose of the present invention is to provide a lens shading correction interpolation method, device and storage medium based on the grid method, so as to solve the problem of high cost due to large gain point demand or poor correction effect due to small gain point demand in the lens shading correction method in the prior art.

[0006] To achieve the above objectives, this application adopts the following technical solutions:

[0007] A lens shading correction interpolation method based on a grid method of the present application comprises the following steps:

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

[0009] Inserting blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extracting a plurality of target grid groups including first grids and blank grids from the second grid map according to a preset direction, wherein each target grid group includes at least three first grids;

[0010] Determine the coordinate point 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 grid in the same group according to the coordinate point;

[0011] Bilinear interpolation is performed on the calibration image according to all the first interpolation gain data and the calibration gain data to obtain target interpolation gain data.

[0012] Preferably, extracting a plurality of target grid groups including first grids and blank grids from the second grid map according to a preset direction, each target grid group including at least 3 first grids, includes:

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

[0014] Remove the initial grid group whose number of first grids is less than 3 to obtain a grid group to be processed;

[0015] Each to-be-processed grid group is divided into a plurality of target grid groups according to a preset grid selection rule, and the number of first grids in the target grid group is 3.

[0016] Preferably, each to-be-processed grid group is divided into a plurality of target grid groups according to a preset grid selection rule, and the number of first grids in the target grid group is 3, including:

[0017] From left to right, three first grids and two blank grids between them are selected from the first grid in the grid group to be processed to form a target grid group;

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

[0019] Preferably, the step of determining the coordinate point of each first grid in the target grid group based on the position of each first grid in the second grid map and the calibration gain data thereof comprises:

[0020] A coordinate system is constructed with the position of the grid in the second grid map as the horizontal axis and the corresponding gain data as the vertical axis, and the coordinate point of each first grid is obtained according to the position of the first grid in the second grid map and the corresponding calibration gain data.

[0021] Preferably, the step of calculating the first interpolation gain data of the blank grid in the same group according to the coordinate point comprises:

[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] Calculating a second straight line according to the slope of the first straight line and the coordinate points of the first middle grid of the target grid group, and calculating initial interpolation gain data of the blank grid according to the second straight line and the horizontal coordinates of the blank grids in the target grid group;

[0024] Each initial interpolation gain data is compensated to obtain first interpolation gain data corresponding to each blank grid.

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

[0026] The absolute value of the calibration gain data difference between the last first grid and the middle first grid in the target grid group and the absolute value of the calibration gain data difference between the first first grid and the middle first grid are calculated respectively to obtain a first target difference and a 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 the product of the initial interpolation gain data thereof plus 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 the product of the initial interpolation gain data thereof plus the preset compensation strength and the corresponding first target difference.

[0029] Preferably, the method further comprises:

[0030] When the first interpolation gain data of the same blank grid is calculated in different target grid groups, an average value of all the corresponding first interpolation gain data is taken.

[0031] Preferably, the method further comprises:

[0032] In the target grid group division 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 are determined by the values ​​of the blank grids calculated in the opposite directions.

[0033] A lens shading correction interpolation device based on a grid method, comprising:

[0034] A calibration module, used for acquiring a calibration image, and performing lens shading correction on the calibration image using a grid method to obtain a first grid image containing calibration gain data;

[0035] a partitioning 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 according to a preset direction, wherein each target grid group includes at least three first grids;

[0036] A first interpolation module is used to determine the coordinate point 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 grid in the same group according to the coordinate point;

[0037] The second interpolation module is used 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, wherein the computer program enables a computer to implement a lens shading correction interpolation method based on a grid method as described in any one of the above when executed.

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

[0040] Before using bilinear interpolation, the present invention first performs a high sampling interpolation on the low sampling data, that is, uses the information of surrounding known points to construct a linear relationship, first interpolates a preliminary result, 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 achieved by high storage space with lower storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

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

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

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

[0045] Figure 4 is a first distribution regularity diagram of g1, g2 and g3 of the embodiment of the present application on the coordinate axis;

[0046] Figure 5 is a second distribution regularity diagram of the embodiments g1, g2 and g3 of the present application on the coordinate axis;

[0047] Figure 6 is a third distribution regularity diagram of the embodiments g1, g2 and g3 of the present application on the coordinate axis;

[0048] Figure 7 is a fourth distribution regularity diagram of the embodiments g1, g2 and g3 of the present application on the coordinate axis;

[0049] Figure 8 This is an example diagram of the overall interpolation result at 45 degrees in the embodiment of the present application;

[0050] Fig. 9 This is an example diagram of the overall interpolation result in the 135 degree direction in the embodiment of the present application;

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

[0052] Fig.11 This is an example diagram of bidirectional interpolation within a block in an embodiment of the present application;

[0053] Fig.12 This is an example diagram of performing linear interpolation in the horizontal direction within a block in an embodiment of the present application;

[0054] Fig.13 This is an example diagram of performing vertical linear interpolation within a block in an embodiment of the present application. DETAILED DESCRIPTION

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

[0056] Example 1

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

[0058] S110, obtaining a calibration image, and performing lens shading correction on the calibration image using a grid method to obtain a first grid image containing calibration gain data.

[0059] First, an object such as a white wall is photographed in a scene with uniform light to obtain an image for calibration, and then a computer program is used to divide the calibration image into uniform grids to obtain a first grid map. In this embodiment, the first grid map is 9*9, and the average brightness value of each first grid is calculated, and the first grid with the highest brightness value is selected as the reference value. For all first grids, the ratio of the reference value divided by the current grid brightness value is calculated as the gain value, and these gain values ​​are saved as calibration gain data.

[0060] S120, inserting blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extracting a plurality of target grid groups including first grids and blank grids from the second grid map according to a preset direction, wherein each target grid group includes at least 3 first grids.

[0061] A blank grid is inserted between two adjacent first grids, and each blank grid refers to a grid whose rated gain data is 0, i.e., a grid to be interpolated. In the present embodiment, only one blank grid is inserted between adjacent first grids. Therefore, a 9*9 first grid diagram is obtained after the blank grid is inserted to obtain a 17*17 second grid diagram.

[0062] Further, taking the first grid at the lower left of the second grid as a base point, the second grid is divided along the horizontal, vertical, 45-degree and 135-degree directions respectively to obtain a plurality of initial grid groups including first grids and blank grids;

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

[0064] Each to-be-processed grid group is divided into a number of target grid groups according to a preset grid selection rule, and the number of first grids in the target grid group is 3.

[0065] In this embodiment, the preset directions include four interpolation directions: horizontal, vertical, 45 degree and 135 degree. 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. Figure 2 As shown, the black dots represent the calibration gain points, which can also be understood as the first grid, which is evenly distributed in the 17*17 second grid map; the white dots are the points to be interpolated, which can also be understood as blank grids, which are also evenly distributed in the 17*17 second grid map; based on the black dots in the middle of the red, blue, yellow and green dots, the red dots are their horizontal interpolation, the blue dots are their vertical interpolation, the green dots are their 45-degree interpolation, and the yellow dots are their 135-degree interpolation. At the same time, these four directions are all 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 initial grid group obtained by division.

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

[0067] It should be noted here that which first grid in the second grid diagram 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 first grid in the upper left corner of the second grid diagram, or the first first grid in the lower right corner of the second grid diagram, or the first first grid in the upper right corner of the second grid group. No specific limitation is made here.

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

[0069] Further, starting from the first first grid in the grid group to be processed, three first grids and two blank grids therebetween are selected in order from left to right to form a target grid group;

[0070] The first first grid in the to-be-processed grid group and the blank grid connected to its right are removed, and when the number of remaining first grids in the to-be-processed grid group is greater than or equal to 3, the step of forming a target grid group is repeated until the number of remaining first grids is less than 3.

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

[0072] According to the direction of the horizontal axis, the first first grid in the grid group to be processed is g1, and the target grid group selected from it for the first time includes five grids, g1, p1, g2, p2 and g3. The target grid group selected from it for the second time includes five grids, g2, p2, g3, p3 and g4. The third includes g3, p3, g4, p4 and g5. The fourth includes g4, p4, g5, p5 and g6. The fifth includes g5, p5, g6, p6 and g7. The sixth includes g6, p6, g7, p7 and g8. The seventh includes g7, p7, g8, p8 and g9. Starting from g8, the number of remaining first grids in the grid group to be processed is less than 3, and the division of the grid group to be processed is completed. At the same time, in the division of this embodiment, p2-p7 is repeated twice, and p2-p7 will also undergo two interpolation calculations later. At this time, its interpolation gain data takes the average value of the two calculations.

[0073] The construction methods of the target grid groups in the longitudinal, 45-degree and 135-degree directions are exactly the same as the horizontal principles, and will not be repeated here.

[0074] S130, determining the coordinate point 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 grid in the same group according to the coordinate point.

[0075] In this embodiment, a coordinate system is first constructed. In this coordinate system, the horizontal axis represents the position of the grid in the second grid map, and the vertical axis represents the gain data corresponding to the grid, thereby determining the coordinate point of each first grid and the horizontal coordinate of the blank grid.

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

[0077] by Figure 3 For example, g1 is the first grid in the lower left corner of the second grid map, and its horizontal coordinate is 1, g2 is the third grid, and its horizontal coordinate is 3, and so on, g9 is the seventeenth grid, and the horizontal coordinate of g9 is 17. Similarly, p1 is the second grid, and the horizontal coordinate of p1 is 2, p2 is the fourth grid, and the horizontal coordinate of p2 is 4. And so on, p8 is the sixteenth grid, and the horizontal coordinate of p8 is 16. At the same time, the vertical coordinates of g1-g9 are all their calibration gain data, and the vertical coordinates of p1-p8 are all their first interpolation gain data.

[0078] Further, a first straight line is calculated according to the coordinate points of the first first grid 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 point of the first middle grid of the target grid group, and calculate the initial interpolation gain data of the blank grid according to the second straight line and the horizontal coordinate of the blank grid in the target grid group;

[0080] Each initial interpolation gain data is compensated to obtain first interpolation gain data corresponding to each blank grid.

[0081] In this embodiment, the principle of determining a straight line by two points 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, and the order of the beginning and the end is the same 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 based on the coordinate points of g1 and g3, where k is the slope and b1 is the intercept, thereby obtaining its slope k, and then the straight line passing through the first grid in the middle of the target grid group, that is, the second first grid g2 coordinate point and having a slope k is set as the second straight line y2=kx2+b2, and the g2 coordinate point is brought into the second straight line expression, and the intercept b2 of the straight line with a slope k when passing through the g2 point can be obtained, and then, the horizontal coordinates of p1 and p2 are substituted into the second straight line to obtain the vertical coordinates of p1 and p2, 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 smaller than the value of the straight line formed by the line connecting g1 and g2 when x=2, and p2 is smaller than the value of the straight line formed by the line connecting the coordinate points of g2 and g3 when x=4. Therefore, the values ​​on the lines connecting g1 and g2, and g2 and g3 can be regarded as linear interpolation results, and at this time the linear interpolation results will be larger than the actual values, so p1 and p2 with relatively small values ​​will often 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 when x=2, and p2 is greater than the value of the straight line formed by connecting the coordinate points of g2 and g3 when x=4. At this time, the linear interpolation result will be smaller than the actual value, and the relatively larger values ​​of p1 and p2 will be closer to the actual value.

[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 are compensated according to the different relationships between the three points g1, g2 and g3.

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

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

[0087] Further, in the target grid group division 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 are determined by the values ​​of the blank grids calculated in the opposite direction.

[0088] After interpolating all blank grids suitable for horizontal interpolation, continue with vertical interpolation, 45-degree directional interpolation, and 135-degree directional interpolation. The vertical interpolation process is exactly the same as the horizontal interpolation process, and the 45-degree directional interpolation and 135-degree directional difference interpolation are basically the same as the horizontal interpolation process, except that if only one or two first grids can be obtained in the oblique direction, then the direction interpolation will not interpolate the blank grids included in this direction, but will rely on another direction to interpolate them. Among them, the blank grids that are not interpolated in the 45-degree directional interpolation are as follows: Figure 8 As shown, the blank grid without interpolation in the 135 degree direction is as follows Fig. 9 As shown, Figure 8 and Fig. 9 The dark red points indicate points that are interpolated only once in the horizontal interpolation, and the red points indicate points that are interpolated twice and averaged. The dark blue points indicate points that are interpolated only once in the vertical interpolation, and the blue points indicate points that are interpolated twice and averaged. The dark green points indicate points that are interpolated only once in the 45-degree direction interpolation, and the green points indicate points that are interpolated twice in the 45-degree direction and averaged. The orange points indicate points that are interpolated only once in the 135-degree direction interpolation, and the yellow points indicate points that are interpolated twice in the 135-degree direction and averaged. At the same time, Figure 8 The white points in the figure represent the points where no interpolation is performed in the 45-degree direction interpolation. Fig. 9The white points in the figure represent the points that are not interpolated in the 135-degree interpolation. After the 45-degree and 135-degree interpolation are completed, the values ​​of the points that are not interpolated after the 45-degree interpolation are taken from the values ​​of the points calculated by the 135-degree interpolation. The values ​​of the points that are not interpolated after the 135-degree interpolation are taken from the values ​​of the points calculated by the 45-degree 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 values ​​calculated in each direction.

[0089] After interpolation in four directions, a 17*17 interpolation gain point is obtained by interpolating the 9*9 calibration gain point. Finally, the 17*17 interpolation gain point is used to perform bilinear interpolation on the calibration image to obtain the full-resolution gain value.

[0090] S140 . 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.

[0091] The steps of bilinear interpolation include: dividing the calibration image into 16*16 blocks, corresponding to 17*17 interpolation gain points, such as Fig.10 As 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 interpolation gain points. The interpolation result of the current point under the action of the four interpolation gain points is calculated inside each block.

[0092] Fig.11 This is a schematic diagram of bilinear interpolation within a block, such as Fig.11 As shown, the length of the block is side_x, and the width is side_y. The points in the block are interpolated. gain_11, gain_12, gain_21 and gain_22 are the four red interpolation gain points corresponding to the block where the interpolation point is located. K is the length of the interpolation point to be interpolated from the interpolation gain point gain_12 in the longitudinal direction, and L is the length of the interpolation point to be interpolated from the interpolation gain point gain_11 in the lateral direction. The width of the block is side_x = floor(width / 16), and the length is side_y = floor(height / 16), where width and height are the width and height of the entire calibration image, respectively.

[0093] Bilinear interpolation can be seen as a combination of two linear interpolations, the first being the linear interpolation of L in the horizontal direction.

[0094] like Fig.12 As shown, the interpolation result L1 of gain_11 and gain_12 and the interpolation result L2 of gain_21 and gain_22 are obtained.

[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] like Fig.13 As shown, the linear interpolation of K in the vertical direction is calculated.

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

[0099] K1 is the interpolation point obtained.

[0100] Bilinear interpolation is performed on all pixels in the current block to obtain a full-resolution gain, and the full-resolution gain is used to correct the image and then output the correction result.

[0101] Before using bilinear interpolation, this embodiment first performs high sampling interpolation on the low sampling data, that is, uses the information of surrounding known points to construct a linear relationship, first interpolates a preliminary result, 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 achieved by high storage space with lower storage space.

[0102] Example 2

[0103] This embodiment provides a lens shading correction interpolation device based on a grid method, comprising:

[0104] A calibration module, used for acquiring a calibration image, and performing lens shading correction on the calibration image using a grid method to obtain a first grid image containing calibration gain data;

[0105] a partitioning 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 according to a preset direction, wherein each target grid group includes at least three first grids;

[0106] A first interpolation module is used to determine the coordinate point 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 grid in the same group according to the coordinate point;

[0107] The second interpolation module is used 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 by the above embodiment, and has the corresponding beneficial effects of the above method. For technical details not fully described in this embodiment, please refer to the methods provided by all the above embodiments of the present invention.

[0109] Example 3

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

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

[0112] This embodiment provides a computer-readable storage medium storing a computer program, and the computer program enables a computer to implement the above-mentioned grid-based lens shading correction interpolation method when executed.

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

[0114] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may include, but is not limited to, a memory and a processor. Those skilled in the art may understand that this embodiment is only an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components, or a combination of certain 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), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

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

[0117] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A lens shading correction interpolation method based on a grid method, characterized in that: The following steps are involved: Acquire a calibration image, and perform lens shading correction on the calibration image using a grid method to obtain a first grid image containing calibration gain data; Inserting blank grids between all adjacent first grids in the first grid map to obtain a second grid map, and extracting a plurality of target grid groups including first grids and blank grids from the second grid map according to a preset direction, wherein each target grid group includes at least three first grids; Determine the coordinate point 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 grid in the same group according to the coordinate point; Bilinear interpolation is performed on the calibration image according to all the first interpolation gain data and the calibration gain data to obtain target interpolation gain data.

2. The lens shading correction interpolation method based on the grid method according to claim 1, characterized in that: The step of extracting a plurality of target grid groups including first grids and blank grids from the second grid map according to a preset direction, wherein each target grid group includes at least three first grids, includes: Taking the first first grid at the lower left of the second grid as a base point, dividing the second grid along the horizontal, vertical, 45-degree and 135-degree directions respectively to obtain a plurality of initial grid groups including first grids and blank grids; Remove the initial grid group whose number of first grids is less than 3 to obtain a grid group to be processed; Each to-be-processed grid group is divided into a plurality of target grid groups according to a preset grid selection rule, and the number of first grids in the target grid group is 3.

3. The lens shading correction interpolation method based on the grid method according to claim 2, characterized in that: The method divides each to-be-processed grid group into a plurality of target grid groups according to a preset grid selection rule, wherein the number of first grids in the target grid group is 3, including: From left to right, three first grids and two blank grids between them are selected from the first grid in the grid group to be processed to form a target grid group; The first first grid in the to-be-processed grid group and the blank grid connected to its right are removed, and when the number of remaining first grids in the to-be-processed grid group is greater than or equal to 3, the step of forming a target grid group is repeated until the number of remaining first grids is less than 3.

4. The lens shading correction interpolation method based on the grid method according to claim 1, characterized in that: The step of determining the coordinate point of each first grid in the target grid group based on the position of each first grid in the second grid map and the calibration gain data thereof comprises: A coordinate system is constructed with the position of the grid in the second grid map as the horizontal axis and the corresponding gain data as the vertical axis, and the coordinate point of each first grid is obtained according to the position of the first grid in the second grid map and the corresponding calibration gain data.

5. The lens shading correction interpolation method based on the grid method according to claim 1, characterized in that: The step of calculating first interpolation gain data of blank grids in the same group according to the coordinate points includes: 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; Calculating a second straight line according to the slope of the first straight line and the coordinate points of the first middle grid of the target grid group, and calculating initial interpolation gain data of the blank grid according to the second straight line and the horizontal coordinates of the blank grids in the target grid group; Each initial interpolation gain data is compensated to obtain first interpolation gain data corresponding to each blank grid.

6. The lens shading correction interpolation method based on the grid method according to claim 5, characterized in that: The compensating each initial interpolation gain data to obtain first interpolation gain data corresponding to each blank grid includes: The absolute value of the calibration gain data difference between the last first grid and the middle first grid in the target grid group and the absolute value of the calibration gain data difference between the first first grid and the middle first grid are calculated 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 the product of the initial interpolation gain data thereof plus 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 the product of the initial interpolation gain data thereof plus the preset compensation strength and the corresponding first target difference.

7. The lens shading correction interpolation method based on the grid method according to claim 1, characterized in that: The method further comprises: When the first interpolation gain data of the same blank grid is calculated in different target grid groups, an average value of all the corresponding first interpolation gain data is taken.

8. The lens shading correction interpolation method based on the grid method according to claim 1, characterized in that: The method further comprises: In the target grid group division 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 are determined by the values ​​of the blank grids calculated in the opposite directions.

9. A lens shading correction interpolation device based on a grid method, characterized in that: include: A calibration module, used for acquiring a calibration image, and performing lens shading correction on the calibration image using a grid method to obtain a first grid image containing calibration gain data; a partitioning 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 according to a preset direction, wherein each target grid group includes at least three first grids; A first interpolation module is used to determine the coordinate point 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 grid in the same group according to the coordinate point; The second interpolation module is used 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.

10. A computer-readable storage medium storing a computer program, characterized in that: The computer program enables a computer to implement a lens shading correction interpolation method based on a grid method as claimed in any one of claims 1 to 8 when executed.

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

  • Image sensor lens shadow correction method and device

    CN114007055A

  • Grid storage gain lens shadow correction optimization algorithm

    CN118115413A

  • Surface mesh matching for lens roll-off correction

    US20090043524A1