Image correction method, storage method, device, electronic device and storage medium
By using a pre-stored correction table for image correction, the problem that the correction table occupies a large amount of storage space in the prior art is solved, and the effect of saving storage space and reducing equipment costs is achieved while ensuring correction accuracy.
Patent Information
- Application Number
- CN202111044218.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-09-07
AI Technical Summary
In the prior art, the correction table for image correction occupies a large amount of storage space, resulting in a higher cost for image sensors or electronic devices.
An image correction method is provided, by obtaining a pre-stored correction table, the storage space of the correction table is smaller than the target correction table, and the correction accuracy of the correction table is consistent with the target correction table. The method includes acquiring a pre-stored correction table, determining a pixel position corresponding to the correction table node position in the target image acquired by the image sensor, and performing image correction on the target image according to these correspondence relationships.
On the basis of ensuring image correction accuracy, by using pre-stored correction tables, storage space is significantly saved, thereby reducing the cost of image sensors or electronic devices.
Smart Images

Figure CN113744332B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to a field, and in particular to an image correction method, a storage method, a device, an electronic device, and a storage medium. Background Art
[0002] Image sensors such as charge coupled device (CCD) image sensors or complementary metal oxide semiconductor (CMOS) image sensors have good image processing performance and low cost, and are widely used in various terminal devices or electronic devices with image processing capabilities. Due to factors such as the optical characteristics of the image sensor lens, the imaging effect is not ideal, and image correction is required for the image captured by the image sensor.
[0003] For example, the color channel filters in the image sensor are arranged in a specific array. In order to improve the image resolution, the image sensitivity difference needs to be corrected (Adjacent 2×2 pixel sensitivity difference correction, ASDC).
[0004] For another example, factors such as the optical characteristics of the lens of the image sensor may cause uneven color or brightness of the output image, so it is necessary to perform lens shading correction (LSC) on the image.
[0005] In the prior art, a preset correction table is used to perform image correction such as ASDC or LSC on the pixels of an image, but such correction table occupies a considerable storage space. Summary of the invention
[0006] In view of this, embodiments of the present invention provide an image correction method, a storage method, an apparatus, an electronic device, and a storage medium to at least partially solve the above problems.
[0007] According to a first aspect of an embodiment of the present invention, there is provided an image correction method, which is applied to an image sensor and comprises: obtaining a pre-stored correction table, the storage space occupied by the correction table being smaller than the storage space occupied by a target correction table, the correction table indicating a mapping relationship between a plurality of first node positions of a first preset grid and a plurality of first image correction values corresponding to the plurality of first node positions, the target correction table indicating a mapping relationship between a plurality of second node positions of a second preset grid and a plurality of second image correction values corresponding to the plurality of second node positions, the correction accuracy of the correction table being consistent with the correction accuracy of the target correction table; determining a plurality of pixel positions corresponding to the plurality of first node positions in a target image acquired by the image sensor, and obtaining a correspondence between the plurality of pixel positions and the plurality of first image correction values; and performing image correction on the target image according to the correspondence between the plurality of pixel positions and the plurality of first image correction values.
[0008] According to a second aspect of an embodiment of the present invention, a storage method is provided, comprising: determining the correction table so that the storage space occupied by the correction table is smaller than the storage space occupied by a target correction table, wherein the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid that divides a target image and a plurality of first image correction values corresponding to the plurality of first node positions, and the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid that divides the target image and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table; and storing the correction table.
[0009] According to a third aspect of an embodiment of the present invention, there is provided an image correction device, which uses an image sensor and includes: an acquisition module, which acquires a pre-stored correction table, the storage space occupied by the correction table is smaller than the storage space occupied by a target correction table, the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid and a plurality of first image correction values corresponding to the plurality of first node positions, the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table; determining a plurality of pixel positions corresponding to the plurality of first node positions in a target image captured by the image sensor, and obtaining a correspondence between the plurality of pixel positions and the plurality of first image correction values; and a correction module, which performs image correction on the target image according to the correspondence between the plurality of pixel positions and the plurality of first image correction values.
[0010] According to a fourth aspect of an embodiment of the present invention, a storage device is provided, the device comprising: a determination module, determining the correction table so that the storage space occupied by the correction table is smaller than the storage space occupied by a target correction table, wherein the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid that divides a target image and a plurality of first image correction values corresponding to the plurality of first node positions, the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid that divides the target image and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table; and a storage module, storing the correction table.
[0011] According to a fifth aspect of an embodiment of the present invention, there is provided an electronic device, comprising: at least one processor, a memory, a bus and a communication interface, wherein the memory stores a program, the processor, the communication interface and the memory communicate with each other via the communication bus, the communication interface is used to communicate with other devices or components, and the processor executes the program to implement the method described in the first aspect or the second aspect.
[0012] According to a sixth aspect of an embodiment of the present invention, a computer storage medium is provided, wherein the computer storage medium includes a stored program, wherein when the program is running, a device including the storage medium is controlled to execute the method according to the first aspect or the second aspect.
[0013] In the scheme of the embodiment of the present invention, since the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table, and the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, compared with the target correction table, the correction table pre-stored in the embodiment of the present invention saves occupied storage space while ensuring the image correction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present invention 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 recorded in the embodiments of the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0015] Figure 1 is a flowchart of the steps of an image correction method according to an embodiment of the present invention;
[0016] Figure 2A is a flowchart of the steps of an image correction method according to another embodiment of the present invention;
[0017] Figure 2B is a flowchart of the steps of an image correction method according to another embodiment of the present invention;
[0018] Figure 2C is a flowchart of the steps of an image correction method according to another embodiment of the present invention;
[0019] Figure 2D is a flowchart of the steps of an image correction method according to another embodiment of the present invention;
[0020] Figure 2E is a flowchart of the steps of an image correction method according to another embodiment of the present invention;
[0021] Figure 3 is a schematic block diagram of an image correction method according to another embodiment of the present invention;
[0022] Figure 4 is a flowchart of a storage method according to another embodiment of the present invention;
[0023] Figure 5 is a structural block diagram of an image correction device according to another embodiment of the present invention;
[0024] Figure 6 is a structural block diagram of a storage device according to another embodiment of the present invention; and
[0025] Figure 7 FIG. 4 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in the field based on the embodiments in the embodiments of the present invention should fall within the scope of protection of the embodiments of the present invention.
[0027] The specific implementation of the embodiment of the present invention is further described below in conjunction with the accompanying drawings of the embodiment of the present invention.
[0028] When the image sensor is calibrated, a correction table such as an LSC correction table or an ASDC correction table can be used for calibration. The correction table can indicate the mapping relationship between the positions of some pixels and the corresponding correction values, thereby achieving a good correction effect of sensitivity difference correction and lens shading correction. The correction table can be stored in a one-time programmable (OTP) memory of the image sensor itself, or in an electrically erasable programmable read only memory (EEPROM) set in an electronic device. Regardless of which memory is used for storing the correction table, a certain amount of storage resources are required, which correspondingly makes the cost of the image sensor or the electronic device higher.
[0029] Figure 1 The figure is a flowchart of an image correction method according to an embodiment of the present invention.
[0030] S110: Obtain a pre-stored correction table, the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid and a plurality of first image correction values corresponding to the plurality of first node positions, the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table.
[0031] Specifically, the correction table and the target correction table can perform LSC correction or ASDC correction. When performing LSC correction, the image correction value can be an LSC gain value. When performing ASDC correction, the image correction value can be an ASDC gain value.
[0032] In addition, the multiple first node positions of the first preset grid may be the same as or correspond to the multiple second node positions of the second preset grid. The number of the multiple first node positions of the first preset grid may also be less than the number of the multiple second node positions of the second preset grid. The pre-stored correction table may be obtained from a storage unit in the image sensor. The pre-stored correction table may also be obtained from a storage unit disposed outside the image sensor, for example, the image sensor is disposed in an electronic device having image processing capabilities, and the storage unit of the electronic device is disposed outside the image sensor. The processing unit in the image sensor may obtain the correction table from the above-mentioned storage unit.
[0033] In addition, the grid size formed by the multiple first node positions in the first preset grid can be uniformly distributed or non-uniformly distributed. The multiple second node positions in the second preset grid can be uniformly distributed or non-uniformly distributed. The multiple first node positions in the first preset grid and the multiple second node positions in the second preset grid can be represented by the pixel position of each node position, for example, based on the position coordinates.
[0034] In addition, the first preset grid can be used to divide any image captured by the image sensor in any scene to obtain a correction table. For example, any image can be captured through a lens and a photosensitive area of an image sensor with the same specifications.
[0035] In addition, the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table, which can indicate that the first result of image correction using the correction table is consistent with the second result of image correction using the target correction table, or there is roughly no deviation between the first result and the second result, or the difference in correction effect evaluation between the first result and the second result is within a preset range.
[0036] S120: Determine a plurality of pixel positions corresponding to a plurality of first node positions in a target image acquired by an image sensor, and obtain a correspondence between the plurality of pixel positions and a plurality of first image correction values.
[0037] Specifically, a plurality of pixel positions in the target image corresponding to a plurality of first node positions of the first preset grid may be determined, and the pixels at the plurality of pixel positions may be corrected using a plurality of first image correction values, respectively.
[0038] S130: performing image correction on the target image according to the correspondence between the plurality of pixel positions and the plurality of first image correction values.
[0039] Specifically, the positional relationship between each pixel in the target image and multiple pixel positions can be used to perform interpolation processing on multiple first image correction values to obtain an image correction value for each pixel in the target image.
[0040] For example, when performing LSC correction, various interpolation operations may be used to interpolate multiple LSC gain values to obtain the LSC gain value (i.e., full-pixel LSC gain value) of each pixel in the target image (e.g., original image). Then, the LSC gain value of each pixel may be used to perform color correction and shading correction on each pixel.
[0041] For another example, when performing ASDC correction, various interpolation operations can be used to interpolate multiple ASDC gain values to obtain the ASDC gain value of each pixel in the target image (e.g., the original image), i.e., the full-pixel ASDC gain value. Then, the ASDC gain value of each pixel can be used to perform color correction and shadow correction on each pixel. It should be understood that in the case where the target image is a color image, each pixel in the target image can correspond to a single color channel.
[0042] In the solution of the embodiment of the present invention, since the correction accuracy of the correction table is the same as that of the target correction table, and the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, compared with the target correction table, on the basis of ensuring the image correction accuracy, the pre-stored correction table saves the occupied storage space.
[0043] In addition, when the correction table is stored in the storage unit of the image sensor, since the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, the occupation of the resources of the storage unit is saved, which is beneficial to reducing the cost of the image sensor.
[0044] In some other implementation manners, the first preset grid is an m*n grid, the second preset grid is an M*N grid, m = k1*M, and n = k2*N, where m, n, M, and N are all positive integers. 0 < k1 < 1 and 0 < k2 < 1, and k1 and k2 indicate that the correction accuracy of the correction table and the target correction table for image correction of image data is the same.
[0045] Since 0 < k1 < 1 and 0 < k2 < 1, the storage space occupied by the correction table with m*n grids is larger than the storage space occupied by the target correction table with M*N grids. In addition, k1 and k2 indicate that the correction results of the correction table and the target correction table for image correction of image data are the same, so that image correction by pre-storing the correction table reduces the occupied storage space while ensuring the image correction effect.
[0046] In some other implementation manners, the m*n grid is composed of grids (i, j), where i indicates the grid ordinal number in the first dimension and j indicates the grid ordinal number in the second dimension, 1 ≤ i ≤ m, 1 ≤ j ≤ n. Here, L(i) represents the grid size corresponding to the i-th grid in the first dimension, and W(j) represents the grid size corresponding to the j-th grid in the second dimension. For example, the grid size can indicate the number of pixels corresponding to the grid in the target image. In the first preset grid, the first dimension includes (m + 1) nodes dividing m grids, and the second dimension includes (n + 1) nodes dividing n grids. In the second preset grid, the first dimension includes (M + 1) nodes dividing M grids, and the second dimension includes (N + 1) nodes dividing N grids.
[0047] In some other implementations, L(i) increases as i increases, and W(j) increases as j increases. In other words, for the grid (i, j) having the above distribution state, the larger i is, the sparser the grid (i, j) is distributed in the first dimension, and the larger j is, the sparser the grid (i, j) is distributed in the second dimension. Therefore, in the target photosensitive area, the grid in the middle position in the first dimension and the grid in the middle position in the second dimension do not correspond to the physical optical center area of the lens. Since ASDC is a local correction, it does not affect the correction result of ASDC. In addition, the number of grid divisions is reduced according to the grid distribution requirements, and the number of grids that need to be stored is reduced, thereby reducing the occupied storage space.
[0048] As an example, in Figure 2A In the grids shown, in any row, the grid sizes of the grids from the left to the right gradually increase. In any column, the grid sizes of the grids from the top to the bottom gradually increase. For example, the target image is 1028*1028 pixels, M*N grids are 99*99 grids (i.e., divided by 100*100 nodes), and m*n grids are 77*77 grids (i.e., divided by 78*78 nodes). The grid sizes of the grids from the left to the right can be 3, 5, 7, ..., 15 in sequence. The grid sizes of the grids from the top to the bottom can be 3, 5, 7, ..., 15 or other grid sizes in sequence.
[0049] In some other implementations, when 1≤i≤m-1, L(i)=L1, and when i=m, L(i)=L2. When 1≤j≤n-1, W(j)=W1, and when j=n, W(j)=W2. Since L(i)=L1 when 1≤i≤m-1, and W(j)=W1 when 1≤j≤n-1, the distribution uniformity of each grid is improved, and the correction efficiency using the first correction table is improved. In addition, the value of L1 can be determined based on the grid size corresponding to the second grid and at a preset ratio. Since L2 and L1 can be the same or different, when the grid size of the first dimension of the target photosensitive area is not divisible by L1, m grids can cover all pixels, thereby improving the flexibility of setting the nodes constituting the grid. Similarly, when the grid size of the second dimension of the target photosensitive area is not divisible by W1, n grids can cover all pixels, thereby improving the flexibility of setting the nodes constituting the grid.
[0050] As an example, in Figure 2BIn the preset grid shown, in any row, the grid size of each grid from the left to the right gradually increases. In any column, the grid size of each grid from the upper side to the lower side gradually increases. For example, the target image is 2056*2056 pixels, M*N grids are 99*99 grids (i.e., divided by 100*100 nodes), and m*n grids are 77*77 grids (i.e., divided by 78*78 nodes). The grid sizes of each grid from the left to the right can be 3, 3, 3, ... 3, 9 in sequence. The grid sizes of each grid from the upper side to the lower side can be 5, 5, 5, ... 5, 7 or other grid sizes in sequence.
[0051] In some other implementations, the grid (i0, j0) corresponds to the optical center area of the lens of the image sensor. When i=i0, L(i)=L1, when i≠i0, L(i)=L2. When j=j0, W(j)=W1, when j≠j0, W(j)=W2. Therefore, the grid (i0, j0) corresponds to the optical center area of the lens of the image sensor, and has no effect on ASDC and LSC.
[0052] As an example, in Figure 2C In the preset grid shown, in any row, the grid size of each grid from the left to the right gradually increases. In any column, the grid size of each grid from the upper side to the lower side gradually increases. For example, the target image is 2056*2056 pixels, M*N grids are 99*99 grids (i.e., divided by 100*100 nodes), and m*n grids are 55*55 grids. The grid sizes of each grid from the left to the right can be 3, 3, ..., 9, ...3, 3 in sequence. The grid sizes of each grid from the upper side to the lower side can be 5, 5, 5, ..., 7, ..., 5, 5 or other grid sizes in sequence.
[0053] In some other implementations, the grid (i0, j0) corresponds to the optical center area of the lens of the image sensor. When i=i0, L(i)=L1, when i≠i0, L(i)=L(2i0-i). When j=j0, W(j)=W1, when j≠j0, W(j)=W(2j0-j). Therefore, the grid (i0, j0) corresponds to the optical center area of the lens of the image sensor, which has no effect on ASDC and LSC, and ensures the correction effect.
[0054] As an example, in Figure 2DIn the preset grid shown, in any row, the grid sizes of the grids from left to right gradually increase. In any column, the grid sizes of the grids from top to bottom gradually increase. For example, if the target image is 2056 * 2056 pixels, the M * N grids are 110 * 99 grids (i.e., divided by 111 * 100 nodes), and the m * n grids are 99 * 77 grids (i.e., divided by 100 * 78 nodes). The grid sizes of the grids from left to right can be 3, …, 5, 7, 9, 7, 5, …, 3 in sequence. Among them, the grid corresponding to the physical optical center area of the lens of the image sensor (the area surrounded by the dotted line in the figure) has 9 pixels in the pixel row direction. The grid sizes of the grids from top to bottom can be 3, …, 5, 6, 11, 6, 5, …, 3 or other grid sizes in sequence. Among them, the grid corresponding to the physical optical center area (the area surrounded by the dotted line in the figure) has 11 pixels in the pixel column direction.
[0055] It should be understood that the grid sizes corresponding to the above grids are only exemplary. The grid size of the target image can be arbitrary, and the grid sizes of the M * N grids and the m * n grids can be arbitrary. In the m * n grids, the grid sizes of the grids arranged along the first dimension in the second dimension are equal, and the grid sizes of the grids arranged along the second dimension in the first dimension are equal. In addition, the sum of the grid sizes of the grids arranged along the first dimension is equal to the grid size of the target image in the first dimension, and the sum of the grid sizes of the grids arranged along the second dimension is equal to the grid size of the target image in the second dimension. For example, in this example, each grid in each row has the same grid size 3 or 5 or 6 or 11, etc. in the column direction. Each grid in each column has the same grid size 3 or 5 or 7 or 9, etc. in the row direction. The sum of the grid sizes of each grid in each row is equal to 2056. The sum of the pixel numbers of each grid in each column is equal to 2056.
[0056] In some other implementation manners, the grid (i0, j0) corresponds to the optical center area of the lens of the image sensor. When i = i0, L(i) = L1. When i > i0, L(i) decreases as i increases. When i < i0, L(i) increases as i increases. When j = j0, W(j) = W1. When j > j0, W(j) decreases as j increases. When j < j0, W(j) increases as j increases. The grid (i0, j0) corresponding to the optical center area of the lens of the image sensor has no influence on both ASDC and LSC, further ensuring the correction effect at the optical center area. In addition, the grids are more densely distributed near the edge positions, improving the overall correction result.
[0057] As an example, in Figure 2EIn the preset grid shown, in any row, the grid size of each grid from the left to the right gradually increases. In any column, the grid size of each grid from the upper side to the lower side gradually increases. For example, the target image is 2056*2056 pixels, M*N grids are 99*99 grids (i.e., divided by 100*100 nodes), m*n grids are 77*77 grids (i.e., divided by 78*78 nodes), and the grid sizes of each grid from the left to the right can be 3, ..., 3, 9, 3, ..., 3 in sequence. Among them, the grid corresponding to the physical optical center area of the lens of the image sensor (the area surrounded by the dotted line in the figure) has 9 pixels in the direction of the pixel row. The grid size of each grid from the upper side to the lower side can be 5, ..., 5, 7, 5, ..., 5 or other grid sizes in sequence. Among them, the grid corresponding to the physical optical center area (the area surrounded by the dotted line in the figure) has 7 pixels in the direction of the pixel column.
[0058] In some other examples, the correction table has a first integer storage precision and a first decimal storage precision, the target correction table has a second integer storage precision and a second decimal storage precision,
[0059] wherein the first integer storage precision is less than the second integer storage precision;
[0060] Alternatively, the first decimal storage precision is less than the second decimal storage precision;
[0061] Alternatively, the first integer storage precision is smaller than the second integer storage precision, and the first decimal storage precision is smaller than the second decimal storage precision.
[0062] It should be understood that the correction table can be obtained by dividing the image into a preset grid. The values in the correction table can be double-precision floating point data or single-precision floating point data. According to the requirements, the first integer storage precision and / or the first decimal storage precision of the calibration table can be adjusted or changed on the basis of ensuring the image sensitivity difference and image uniformity, so that the correction accuracy of the correction table is consistent with or matches the correction accuracy (correction evaluation quality or correction evaluation effect) of the correction table.
[0063] For example, the data storage precision can be expressed as u ab (the a bit represents the integer part, indicating the first integer storage precision; the b bit represents the decimal part, indicating the first decimal storage precision). For example, u2.10, u1.8, u1.7, u1.5, u2.8, u3.7, u1.9, u4.6, etc.
[0064] In some other examples, the first node positions of the first preset grid and the second node positions of the second preset grid have the same position distribution. The method also includes: obtaining a pre-stored target difference. According to the correspondence between the multiple pixel positions and the multiple first image correction values, image correction is performed on the target image, including: summing the multiple first image correction values and the target difference values to obtain multiple actual correction values corresponding to the multiple pixel positions respectively; and performing image correction on the target image according to the multiple actual correction values corresponding to the multiple pixel positions respectively.
[0065] Specifically, the target difference value may not be greater than the minimum value among the plurality of second image correction values. For example, the target difference value may be equal to the minimum value among the plurality of second image correction values.
[0066] In other words, the target difference value can be subtracted from the multiple second image correction values to obtain multiple first image correction values. Since each first image correction value is smaller than the corresponding second image correction value, when performing image correction, the second image correction value can be obtained by adding the first image correction value to the target difference value, thereby greatly saving the storage space occupied by the correction table.
[0067] In some other examples, the correction table and the target correction table are both used for lens shading correction, and the plurality of first image correction values and the plurality of second image correction values are lens shading gain values.
[0068] In other examples, the correction table and the target correction table are both used for sensitivity difference correction, and the plurality of first image correction values and the plurality of second image correction values are sensitivity difference gain values. For example, in lens shading correction, the target image may include a color image composed of different monochrome channels. In other words, the pixel arrays corresponding to different monochrome channels constitute the color image. For example, in the RGB color standard, R represents red, G represents green, and B represents blue. The target image includes pixel arrays of the red channel, the first green channel, the second green channel, and the blue channel. Different correction tables can be set for pixel arrays of different monochrome channels. For example, correction tables can be determined for the pixel arrays of the red channel, the first green channel, the second green channel, and the blue channel, and lens shading correction or sensitivity difference correction is performed on each pixel array accordingly.
[0069] It should be understood that any two or more of the above-mentioned multiple ways of saving the storage space occupied by the correction table can be combined to save the storage space occupied by the correction table as much as possible.
[0070] Figure 3 is a schematic block diagram of an image correction method according to another embodiment of the present invention.
[0071] First, the interpolation processing module can perform interpolation processing based on the input correction table to obtain a full pixel correction table. Specifically, the correction table indicates the mapping relationship between multiple pixel positions and multiple image correction values. The multiple image correction values can be interpolated according to the positional relationship between each image pixel position and multiple pixel positions to obtain a full pixel correction table.
[0072] In addition, the correction processing module can perform correction processing on each pixel of the image captured by the image sensor based on the input full pixel correction table to obtain a corrected image. Specifically, each pixel position in the original image is matched with multiple image corrections to perform corresponding LSC correction or ASDC correction. The above correction table can be an LSC correction table or an ASDC correction table.
[0073] Figure 4 is a flowchart of a storage method according to another embodiment of the present invention. Figure 4 The storage methods include:
[0074] S410: Determine a correction table so that the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, wherein the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid that divides the target image and a plurality of first image correction values corresponding to the plurality of first node positions, and the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid that divides the target image and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table.
[0075] S420: Store the correction table.
[0076] Specifically, the correction table can be stored in a storage space of the image sensor itself provided in the electronic device, for example, the correction table can be stored in a one-time programmable (OTP) memory. The correction table can also be stored in a storage space provided outside the image sensor in the electronic device, for example, the correction table can be stored in an electrically erasable programmable read only memory (EEPROM).
[0077] In the scheme of the embodiment of the present invention, since the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table, and the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, the storage space occupied by the correction table is saved while ensuring the image correction accuracy.
[0078] Figure 5A structural block diagram of an image correction device according to another embodiment of the present invention. Figure 5 The image correction device applies an image sensor and includes:
[0079] An acquisition module 510 that acquires a pre-stored correction table. The storage space occupied by the correction table is smaller than the storage space occupied by a target correction table. The correction table indicates the mapping relationship between multiple first node positions of a first preset grid and multiple first image correction values corresponding to the multiple first node positions. The target correction table indicates the mapping relationship between multiple second node positions of a second preset grid and multiple second image correction values corresponding to the multiple second node positions. The correction accuracy of the correction table is consistent with the correction accuracy of the target correction table.
[0080] A determination module 520 that determines multiple pixel positions in a target image collected by the image sensor corresponding to the multiple first node positions, and obtains the correspondence between the multiple pixel positions and the multiple first image correction values.
[0081] A correction module 530 that performs image correction on the target image according to the correspondence between the multiple pixel positions and the multiple first image correction values.
[0082] In the solution of the embodiment of the present invention, since the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table, and the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, the storage space occupied by the correction table is saved on the basis of ensuring the image correction accuracy.
[0083] In some other examples, the first preset grid is an m*n grid, the second preset grid is an M*N grid, m = k1*M, and n = k2*N, where m, n, M, and N are all positive integers. 0 < k1 < 1 and 0 < k2 < 1, and k1 and k2 indicate that the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table.
[0084] In some other examples, the m*n grid is composed of grids (i, j), where i indicates the grid ordinal number in the first dimension and j indicates the grid ordinal number in the second dimension, 1 ≤ i ≤ m, 1 ≤ j ≤ n. Among them, L(i) represents the grid size corresponding to the i-th grid in the first dimension, and W(j) represents the grid size corresponding to the j-th grid in the second dimension.
[0085] In some other examples, L(i) increases as i increases, and W(j) increases as j increases.
[0086] In some other examples, when 1 ≤ i ≤ m - 1, L(i) = L1, and when i = m, L(i) = L2. When 1 ≤ j ≤ n - 1, W(j) = W1, and when j = n, W(j) = W2.
[0087] In other examples, the grid (i0, j0) corresponds to the lens optical center region of the image sensor.
[0088] In other examples, when i = i0, L(i) = L1; when i ≠ i0, L(i) = L2. When j = j0, W(j) = W1; when j ≠ j0, W(j) = W2.
[0089] In other examples, when i = i0, L(i) = L1; when i ≠ i0, L(i) = L(2i0 - i). When j = j0, W(j) = W1; when j ≠ j0, W(j) = W(2j0 - j).
[0090] In other examples, when i = i0, L(i) = L1; when i > i0, L(i) decreases as i increases; when i < i0, L(i) increases as i increases. When j = j0, W(j) = W1; when j > j0, W(j) decreases as j increases; when j < j0, W(j) increases as j increases.
[0091] In other examples, the calibration table has a first integer storage precision and a first decimal storage precision, and the target calibration table has a second integer storage precision and a second decimal storage precision. The first integer storage precision is less than the second integer storage precision. The first decimal storage precision is less than the second decimal storage precision. Or, the first integer storage precision is less than the second integer storage precision, and the first decimal storage precision is less than the second decimal storage precision.
[0092] In other examples, the positions of multiple first nodes of the first preset grid and the positions of multiple second nodes of the second preset grid have the same position distribution. The acquisition module is further configured to: acquire a pre-stored target difference. The calibration module is specifically configured to: respectively perform a summation process on multiple first image calibration values and the target difference to obtain multiple actual calibration values corresponding to multiple pixel positions; perform image calibration on the target image according to the multiple actual calibration values corresponding to the multiple pixel positions.
[0093] In other examples, the target difference is not greater than the minimum value among multiple second image calibration values.
[0094] In other examples, both the calibration table and the target calibration table are lens shadow calibration tables, and multiple first image calibration values and multiple second image calibration values are all lens shadow calibration values. Or, both the calibration table and the target calibration table are sensitivity difference calibration tables, and multiple first image calibration values and multiple second image calibration values are all sensitivity difference calibration values.
[0095] The device of this embodiment is used to implement the corresponding methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0096] Figure 6 is a structural block diagram of a storage device according to another embodiment of the present invention. Figure 6 The storage device includes:
[0097] Determining module 610, determining a correction table so that a storage space occupied by the correction table is smaller than a storage space occupied by a target correction table, wherein the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid dividing a target image and a plurality of first image correction values corresponding to the plurality of first node positions, the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid dividing a target image and a plurality of second image correction values corresponding to the plurality of second node positions, and a correction accuracy of the correction table is consistent with a correction accuracy of the target correction table;
[0098] The storage module 620 stores the correction table.
[0099] In the scheme of the embodiment of the present invention, since the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table, and the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, the storage space occupied by the correction table is saved while ensuring the image correction accuracy.
[0100] The device of this embodiment is used to implement the corresponding methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0101] Figure 7 A schematic block diagram of an electronic device according to another embodiment of the present invention. Figure 7 The electronic device includes: at least one processor (processor) 702, a memory (memory) 704, a bus 706 and a communication interface (CommunicationsInterface) 708.
[0102] The processor 702 , the communication interface 708 , and the memory 704 communicate with each other via the communication bus 706 .
[0103] The communication interface 708 is used to communicate with other devices or components.
[0104] The processor 702 is used to execute the program 710, and specifically can execute the relevant steps in the methods described in the above embodiments.
[0105] Specifically, the program 710 may include program codes, which include computer operation instructions.
[0106] The processor 702 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0107] The memory 704 is used to store programs and may include a high-speed RAM memory, or may also include a non-volatile memory, such as at least one disk memory.
[0108] The processor 702 is used to obtain a pre-stored correction table (for example, obtain the correction table from the memory 704), the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid and a plurality of first image correction values corresponding to the plurality of first node positions, the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table; determine a plurality of pixel positions corresponding to the plurality of first node positions in the target image captured by the image sensor, and obtain a corresponding relationship between the plurality of pixel positions and the plurality of first image correction values; perform image correction on the target image according to the corresponding relationship between the plurality of pixel positions and the plurality of first image correction values;
[0109] Alternatively, determine the correction table so that the storage space occupied by the correction table is smaller than the storage space occupied by the target correction table, wherein the correction table indicates a mapping relationship between a plurality of first node positions of a first preset grid that divides the target image and a plurality of first image correction values corresponding to the plurality of first node positions, and the target correction table indicates a mapping relationship between a plurality of second node positions of a second preset grid that divides the target image and a plurality of second image correction values corresponding to the plurality of second node positions, and the correction accuracy of the correction table is consistent with the correction accuracy of the target correction table; store the correction table (for example, store the correction table in memory 704).
[0110] The device of this embodiment is used to implement the corresponding methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0111] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present invention can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.
[0112] The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the verification code generation method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the verification code generation method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the verification code generation method shown here.
[0113] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present invention.
[0114] The above implementation methods are only used to illustrate the embodiments of the present invention, and are not limitations of the embodiments of the present invention. Ordinary technicians in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present invention. The patent protection scope of the embodiments of the present invention should be defined by the claims.
Claims
1. An image correction method, characterized in that: Applied to an image sensor, including: Obtain a pre-stored calibration table, the storage space occupied by the calibration table being smaller than the storage space occupied by a target calibration table, the calibration table indicating the mapping relationship between multiple first node positions of a first preset grid and multiple first image correction values corresponding to the multiple first node positions, the target calibration table indicating the mapping relationship between multiple second node positions of a second preset grid and multiple second image correction values corresponding to the multiple second node positions, the calibration accuracy of the calibration table being consistent with the calibration accuracy of the target calibration table; Determine multiple pixel positions corresponding to the multiple first node positions in a target image collected by the image sensor, obtaining the correspondence between the multiple pixel positions and the multiple first image correction values; Perform image correction on the target image according to the correspondence between the multiple pixel positions and the multiple first image correction values; Wherein, the first preset grid is an m*n grid, the second preset grid is an M*N grid, m = k1*M, and n = k2*N, m, n, M, and N are all positive integers, 0 < k1 < 1 and 0 < k2 < 1, and k1 and k2 indicate that the calibration accuracy of the calibration table is consistent with the calibration accuracy of the target calibration table.
2. The method according to claim 1, characterized in that The m*n grid is composed of grids (i, j), i indicating the grid ordinal number in the first dimension, j indicating the grid ordinal number in the second dimension, 1 ≤ i ≤ m, 1 ≤ j ≤ n, where L(i) represents the grid size corresponding to the i-th grid in the first dimension, and W(j) represents the grid size corresponding to the j-th grid in the second dimension.
3. The method according to claim 2, characterized in that L(i) increases as i increases, and W(j) increases as j increases.
4. The method according to claim 2, wherein When 1 ≤ i ≤ m - 1, L(i) = L1, and when i = m, L(i) = L2; When 1 ≤ j ≤ n - 1, W(j) = W1, and when j = n, W(j) = W2.
5. The method according to claim 2, characterized in that: The grid (i0, j0) corresponds to the lens optical center area of the image sensor.
6. The method according to claim 5, wherein Wherein, when i = i0, L(i) = L1, and when i ≠ i0, L(i) = L2; Wherein, when j = j0, W(j) = W1, and when j ≠ j0, W(j) = W2.
7. The method according to claim 5, wherein Wherein, when i = i0, L(i) = L1, and when i ≠ i0, L(i) = L(2i0 - i); Wherein, when j = j0, W(j) = W1, and when j ≠ j0, W(j) = W(2j0 - j).
8. The method according to claim 5, wherein When i = i0, L(i) = L1, when i > i0, L(i) decreases as i increases, and when i < i0, L(i) increases as i increases; When j = j0, W(j) = W1, when j > j0, W(j) decreases as j increases, and when j < j0, W(j) increases as j increases.
9. The method according to claim 1, characterized in that: The calibration table has a first integer storage precision and a first decimal storage precision, and the target calibration table has a second integer storage precision and a second decimal storage precision. Wherein, the first integer storage precision is less than the second integer storage precision; Or, the first decimal storage precision is less than the second decimal storage precision; Or, the first integer storage precision is less than the second integer storage precision, and the first decimal storage precision is less than the second decimal storage precision.
10. The method according to claim 1, characterized in that The multiple first node positions of the first preset grid have the same position distribution as the multiple second node positions of the second preset grid. The method further includes: obtaining a pre-stored target difference. The image correction of the target image according to the correspondence between the multiple pixel positions and the multiple first image correction values includes: Respectively performing a summation process on the multiple first image correction values and the target difference to obtain multiple actual correction values corresponding to the multiple pixel positions respectively; Performing image correction on the target image according to the multiple actual correction values corresponding to the multiple pixel positions respectively.
11. The method according to claim 10, characterized in that The target difference is not greater than the minimum value among the multiple second image correction values.
12. The method according to claim 1, characterized in that Both the calibration table and the target calibration table are used for lens shading correction of the target image, and the multiple first image correction values and the multiple second image correction values are both lens shading gain values; Or, both the calibration table and the target calibration table are used for sensitivity difference correction of the target image, and the multiple first image correction values and the multiple second image correction values are both sensitivity difference gain values.
13. A storage method, characterized in that: Including: Determining a calibration table such that the storage space occupied by the calibration table is less than the storage space occupied by the target calibration table, wherein the calibration table indicates the mapping relationship between the multiple first node positions of the first preset grid for dividing the target image and the multiple first image correction values corresponding to the multiple first node positions, the target calibration table indicates the mapping relationship between the multiple second node positions of the second preset grid for dividing the target image and the multiple second image correction values corresponding to the multiple second node positions, and the calibration precision of the calibration table is consistent with the calibration precision of the target calibration table, wherein the first preset grid is an m*n grid, the second preset grid is an M*N grid, m = k1*M, and n = k2*N, m, n, M, and N are all positive integers, 0 < k1 < 1 and 0 < k2 < 1, and k1 and k2 indicate that the calibration precision of the calibration table is consistent with the calibration precision of the target calibration table; Storing the calibration table.
14. An image correction device, characterized in that: Applying an image sensor, including: An acquisition module acquires a pre-stored calibration table, where the storage space occupied by the calibration table is smaller than the storage space occupied by a target calibration table. The calibration table indicates the mapping relationship between multiple first node positions of a first preset grid and multiple first image correction values corresponding to the multiple first node positions. The target calibration table indicates the mapping relationship between multiple second node positions of a second preset grid and multiple second image correction values corresponding to the multiple second node positions. The calibration accuracy of the calibration table is consistent with the calibration accuracy of the target calibration table. Wherein, the first preset grid is an m*n grid, the second preset grid is an M*N grid, m = k1*M, and n = k2*N, where m, n, M, and N are all positive integers, 0 < k1 < 1 and 0 < k2 < 1, and k1 and k2 indicate that the calibration accuracy of the calibration table is consistent with the calibration accuracy of the target calibration table; Determine multiple pixel positions in the target image collected by the image sensor that correspond to the multiple first node positions, and obtain the correspondence between the multiple pixel positions and the multiple first image correction values; A correction module corrects the target image according to the correspondence between the multiple pixel positions and the multiple first image correction values.
15. A storage device, characterized in that: It includes: A determination module determines a calibration table such that the storage space occupied by the calibration table is smaller than the storage space occupied by a target calibration table. Wherein, the calibration table indicates the mapping relationship between multiple first node positions of a first preset grid for dividing the target image and multiple first image correction values corresponding to the multiple first node positions. The target calibration table indicates the mapping relationship between multiple second node positions of a second preset grid for dividing the target image and multiple second image correction values corresponding to the multiple second node positions. And the calibration accuracy of the calibration table is consistent with the calibration accuracy of the target calibration table. Wherein, the first preset grid is an m*n grid, the second preset grid is an M*N grid, m = k1*M, and n = k2*N, where m, n, M, and N are all positive integers, 0 < k1 < 1 and 0 < k2 < 1, and k1 and k2 indicate that the calibration accuracy of the calibration table is consistent with the calibration accuracy of the target calibration table; A storage module stores the calibration table.
16. An electronic device, characterized in that: It includes: At least one processor, a memory, a bus, and a communication interface. Wherein, a program is stored in the memory, and the processor, the communication interface, and the memory complete communication with each other through the communication bus. The communication interface is used to communicate with other devices or components. The processor executes the program to implement: the image correction method according to any one of claims 1-12 or the storage method according to claim 13.
17. A computer storage medium, characterized in that: The computer storage medium includes a stored program, where when the program runs, it controls a device including the storage medium to execute the image correction method according to any one of claims 1-12 or the storage method according to claim 13.
Citation Information
Patent Citations
Image capturing device, image capturing device main body, and shading correction method
CN102870422A
Fisheye image correction method, electronic equipment and storage medium
CN110570367A