Lens vignetting correction method and device, computer equipment and storage medium

By constructing a correction lookup table and region initialization, the computational complexity of lens vignetting correction is reduced, and the processing speed and correction accuracy are improved. This solves the problems of high computational complexity and poor real-time performance in existing technologies, and realizes efficient and accurate vignetting correction on embedded platforms.

CN121767243APending Publication Date: 2026-03-31AFIRSTSOFT CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing lens vignetting correction technology suffers from high computational complexity and poor real-time performance, making it impossible to implement efficiently on resource-limited embedded platforms. Furthermore, its correction accuracy is insufficient, and its adaptability is poor, failing to accommodate optical systems with different structures.

Method used

By constructing a correction lookup table, using lens vignetting intensity parameters, reference data indexes, and reference coefficients, correction coefficients are calculated in advance, reducing real-time computational complexity. Vignetting correction is performed using a lookup table, and region initialization is achieved by combining optical center coordinates and normalized radius reference values, thus realizing efficient and accurate vignetting correction.

Benefits of technology

It significantly reduces computational complexity, improves processing speed and correction accuracy, has strong adaptability, and can process in real time on low-power embedded platforms, solving the problems of high computational complexity and poor real-time performance, and achieving efficient and accurate vignetting correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121767243A_ABST
    Figure CN121767243A_ABST
Patent Text Reader

Abstract

The invention discloses a lens vignetting correction method and device, computer equipment and a storage medium, and the method comprises the steps: setting a reference data index according to a vignetting intensity parameter of a lens, and extracting a reference coefficient from pre-calibrated lens vignetting data; constructing a correction lookup table in combination with the vignetting intensity parameter, the reference data index and the reference coefficient; obtaining a target image collected by a lens, and calculating an optical center coordinate and a normalized radius reference value of the target image; obtaining a to-be-processed area of the target image, and performing area initialization on the to-be-processed area in combination with the optical center coordinate and the normalized radius reference value; and based on the initialized to-be-processed region, correcting the target image in combination with the correction lookup table. According to the vignetting correction method and device, the real-time complex mathematical operation is converted into the pre-calculated table query operation, efficient and accurate vignetting correction is achieved, and the problems that in the prior art, calculation complexity is high, and real-time performance is poor are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical imaging technology, and in particular to a lens vignetting correction method, apparatus, computer device, and storage medium. Background Technology

[0002] In optical imaging systems, lens vignetting is a common imaging defect. It manifests as a gradual decrease in brightness from the center to the edges of the image, eventually resulting in noticeable dark corners around the edges. This phenomenon severely affects image quality, reduces the visual effect of the image and the accuracy of the data, and has therefore become one of the key problems that urgently need to be solved in the field of optical imaging.

[0003] In-depth analysis reveals that lens vignetting primarily stems from three core factors: First, natural vignetting, which is dominated by the angle of light incidence and follows the fourth-order cosine decay law, meaning that changes in the angle of light incidence directly lead to a fourth-order decrease in brightness; second, optical vignetting, caused by the physical obstruction of obliquely incident light by the lens barrel and aperture, resulting in a reduction in the effective light transmission at the edges; and third, pixel vignetting, where the sensitivity of image sensor pixels to obliquely incident light is naturally reduced, leading to insufficient brightness output from edge pixels.

[0004] To alleviate the aforementioned vignette problem, the industry has developed various correction schemes, which can be categorized into the following three types: The first category is online real-time calculation schemes based on mathematical models. This approach is widely used in software and camera firmware. The core idea is to model vignetting characteristics using optical models and then calculate correction coefficients in real time. The most common of these is a polynomial model based on the pixel radial distance *r*, typically expressed as f(r) = 1 + k1·r. 2 +k2·r 4 +k3·r 6 (k1, k2, and k3 are fitting coefficients). However, this type of scheme has significant drawbacks: since each pixel needs to perform floating-point operations such as division, square root, exponentiation, and multiple multiplications, the computational load is extremely large. Especially in 4K and 8K video real-time processing scenarios or low-power environments (such as ISPs, embedded GPUs, and mobile device DSPs), it is difficult to meet real-time requirements and easily leads to increased device power consumption and latency accumulation.

[0005] The second type is a real-time vignetting correction scheme based on GPU / Shader, which is widely used in devices with GPUs such as PCs and mobile phones. The core of this scheme is to calculate the correction factor for each pixel in real time in the Shader program to achieve compensation. However, this scheme still relies on floating-point operations, and operations such as square roots, exponentiation, and division are still present. This not only leads to high power consumption in mobile devices, but multi-channel multiplication operations also reduce the image frame rate. More importantly, it cannot be adapted to embedded platforms without GPUs, such as ISPs and DSPs, which significantly limits its application scenarios.

[0006] The third type is a correction scheme based on lens profile files provided by lens manufacturers, such as Adobe LCP (LensCorrection Profile) and DxO models, commonly found in professional lens correction systems. This scheme compensates for vignetting using proprietary data obtained during lens calibration, but it also has significant drawbacks: the profile files are large, requiring additional file parsing processes; the correction data often uses polynomial or higher-order models, resulting in high computational complexity and making it difficult to deploy on resource-constrained embedded platforms; furthermore, it cannot dynamically adjust the correction strategy based on real-time parameters of the image processing pipeline, lacking flexibility.

[0007] In summary, existing vignetting correction technologies have not yet formed a complete solution and generally suffer from three major problems: First, high computational complexity, as real-time calculation of the radial distance and correction coefficient of each pixel requires a large amount of floating-point computing resources; second, insufficient correction accuracy, as simple polynomial fitting is difficult to accurately model complex vignetting characteristics and cannot achieve accurate compensation in all scenarios; and third, poor adaptability, as the correction parameters calibrated for specific lenses are highly specialized and difficult to transfer to other optical systems with different structures, resulting in low technology reusability and high deployment costs. Summary of the Invention

[0008] This invention provides a lens vignetting correction method, apparatus, computer device, and storage medium, aiming to achieve efficient and accurate vignetting correction and solve the problems of high computational complexity and poor real-time performance in the prior art.

[0009] In a first aspect, embodiments of the present invention provide a lens vignetting correction method, comprising: Set the reference data index according to the lens vignetting intensity parameter, and extract the reference coefficient from the pre-calibrated lens vignetting data; A correction lookup table is constructed by combining the vignetting intensity parameters, the baseline data index, and the baseline coefficients; Acquire the target image captured by the lens, and calculate the optical center coordinates and normalized radius reference value of the target image; The region to be processed in the target image is obtained, and the region to be processed is initialized by combining the optical center coordinates and the normalized radius reference value. Based on the initialized region to be processed, the target image is corrected using the correction lookup table.

[0010] Secondly, embodiments of the present invention provide a lens vignetting correction device, comprising: The reference setting unit is used to set the reference data index according to the lens vignetting intensity parameter and extract the reference coefficient from the pre-calibrated lens vignetting data. The table construction unit is used to construct a correction lookup table by combining the vignetting intensity parameters, the baseline data index, and the baseline coefficients. An image calculation unit is used to acquire the target image captured by the lens and calculate the optical center coordinates and normalized radius reference value of the target image; A region initialization unit is used to obtain the region to be processed in the target image and initialize the region to be processed by combining the optical center coordinates and the normalized radius reference value. An image correction unit is used to perform correction processing on the target image based on the initialized region to be processed, in conjunction with the correction lookup table.

[0011] Thirdly, embodiments of the present invention provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the lens vignetting correction method as described in the first aspect.

[0012] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the lens vignetting correction method as described in the first aspect.

[0013] This invention provides a lens vignetting correction method, apparatus, computer device, and storage medium. The method includes: setting a reference data index based on the lens vignetting intensity parameter and extracting reference coefficients from pre-calibrated lens vignetting data; constructing a correction lookup table by combining the vignetting intensity parameter, reference data index, and reference coefficients; acquiring a target image captured by the lens and calculating the optical center coordinates and normalized radius reference values ​​for the target image; acquiring the region to be processed in the target image and initializing the region to be processed by combining the optical center coordinates and normalized radius reference values; and performing correction processing on the target image based on the initialized region to be processed and the correction lookup table. This invention, by pre-constructing a correction lookup table, transforms complex vignetting correction calculations into table lookup operations, avoiding a large number of floating-point operations in real time during actual image correction, thereby significantly reducing computational complexity. After acquiring the target image, the region to be processed in the image is initialized by calculating the optical center coordinates and normalized radius reference values, enabling subsequent correction processing to be more accurately targeted at specific regions. During the correction process, the pre-built correction lookup table is used to quickly complete the correction operation by simply looking up the corresponding correction coefficient based on the normalized coordinates of the pixel. This greatly improves the processing speed and enables efficient and accurate vignetting correction, solving the problems of high computational complexity and poor real-time performance in existing technologies. Attached Figure Description

[0014] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 A schematic flowchart of a lens vignetting correction method provided in an embodiment of the present invention; Figure 2 This is a schematic block diagram of a lens vignetting correction device provided in an embodiment of the present invention. Detailed Implementation

[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0018] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0019] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0020] Please see below. Figure 1 The present invention provides a lens vignetting correction method, specifically including steps S101 to S105.

[0021] Step S101: Set the reference data index according to the lens vignetting intensity parameter, and extract the reference coefficient from the pre-calibrated lens vignetting data; Step S102: Construct a correction lookup table by combining the vignetting intensity parameters, the reference data index, and the reference coefficients; Step S103: Acquire the target image captured by the lens, and calculate the optical center coordinates and normalized radius reference value of the target image; Step S104: Obtain the region to be processed in the target image, and initialize the region to be processed by combining the optical center coordinates and the normalized radius reference value; Step S105: Based on the initialized region to be processed, the target image is corrected using the correction lookup table.

[0022] In this embodiment, firstly, a reference data index is determined based on the lens vignetting intensity parameter, and reference coefficients are extracted from the pre-calibrated lens vignetting data; then, a correction lookup table is constructed using the vignetting intensity parameter, the reference data index, and the reference coefficients; next, the target image captured by the lens is acquired, and the optical center coordinates and normalized radius reference value of the target image are calculated; then, the area to be processed in the target image is determined, and the area to be processed is initialized using the obtained optical center coordinates and normalized radius reference value; finally, based on the initialized area to be processed, the target image is corrected using the previously constructed correction lookup table.

[0023] This embodiment transforms complex vignetting correction calculations into table lookup operations by pre-constructing a correction lookup table, avoiding the need for numerous real-time floating-point operations during actual image correction and thus significantly reducing computational complexity. After acquiring the target image, the image's processing area is initialized by calculating the optical center coordinates and normalized radius reference value, enabling subsequent correction processing to be more precise for specific regions. During correction, the pre-constructed correction lookup table allows for quick completion of the correction operation simply by looking up the corresponding correction coefficient based on the normalized coordinates of the pixels. This transforms complex real-time mathematical operations into pre-calculated table lookup operations, and achieves efficient and accurate vignetting correction through incremental coordinate updates and numerical stability design, solving the problems of high computational complexity and poor real-time performance in existing technologies.

[0024] In one embodiment, step S102 includes: The benchmark data index is normalized to obtain the normalized distance; Calculate the power of the normalized distance, and set the correction coefficient based on the calculation result of the power and the benchmark coefficient; The correction direction to be corrected is determined based on the vignetting intensity parameters; The correction lookup table is constructed by combining the normalized distance, correction coefficient, and correction direction.

[0025] This embodiment first normalizes the baseline data index, mapping it to a uniform numerical range. After obtaining the normalized distance, it is raised to a power. Then, based on the power calculation result and the baseline coefficients, correction coefficients are set. These correction coefficients are key parameters for achieving vignetting correction, determining the degree of compensation required for each pixel.

[0026] Since vignetting can have different intensities and distributions in different directions, determining the correction direction allows for more targeted correction of different areas of the image, improving the accuracy of the correction. For example, some lenses may have more pronounced vignetting in the horizontal direction, while others may have more severe vignetting in the vertical direction; by specifying the correction direction, these situations can be handled better.

[0027] Finally, a correction lookup table is constructed by combining the normalized distance, correction coefficients, and correction direction. In this way, when performing correction processing on the target image in the future, it is only necessary to look up the corresponding correction coefficient in the lookup table according to the normalized coordinates of the pixels to quickly complete the correction operation, avoiding a large number of complex floating-point operations in real time, which greatly improves the processing speed and efficiency.

[0028] In a specific embodiment, for each index position of the correction lookup table from 0 to 4096, the following calculations are performed sequentially: (1) Normalize the index values ​​to the range of 0 to 1 to obtain the normalized distance. This is because when constructing the vignetting correction lookup table, it is necessary to convert the discrete integer indices (0, 1, 2, ..., 4096) into continuous normalized distances (0.0, 0.000244, 0.000488, ..., 1.0) so that the power function mathematical model can be applied. The normalization formula is as follows: ; Where, d i This represents the normalized distance. 4096 is a power of 2 choice (2 to the power of 16) because it is computer-friendly for binary operations and facilitates bitwise optimization: idx = (int)(r 2 (×4096) is equivalent to shifting the result left by 12 bits, which is more efficient in hardware implementation (the address lines in FPGA / ASIC are exactly 12 bits).

[0029] (2) Calculate the correction coefficient using a power function model. This coefficient is equal to the normalized distance raised to the power of the base coefficient plus 1. The formula for the power function exponent is as follows: ; The formula for the benchmark coefficient index is as follows: ; The formula for calculating the correction factor is as follows: ; Among them, S temp (d i ) represents the correction factor, α represents the power function exponent, β represents the benchmark factor, and M mid V represents the midpoint parameter. corr This represents the vignetting intensity parameter.

[0030] (3) Determine the correction direction based on the sign of the vignetting intensity parameter (dynamically input by the user). If it is positive, directly use the calculated correction coefficient to achieve positive correction and enhance edge brightness; if it is negative, take the reciprocal of the correction coefficient to achieve reverse correction and reduce edge brightness. Output a floating-point array table [0...4096] of length 4097, and then store the mapping relationship between the normalized squared distance and the brightness correction coefficient. Specifically, the algorithm for constructing the correction lookup table is as follows: ; Where T[i] represents the correction lookup table.

[0031] In one embodiment, step S103 includes: Obtain the image source width and image source height of the target image; The optical center coordinates and normalized radius reference values ​​are calculated based on the image source width and image source height, respectively.

[0032] This embodiment calculates the optical center coordinates and normalized radius reference value by obtaining the image source width and image source height of the target image. Specifically, the horizontal coordinate of the optical center is equal to half the image source width minus 0.5, and the vertical coordinate is equal to half the image source height minus 0.5. The normalized radius reference value is equal to the square root of the sum of the squares of half the image source width and half the source height. The optical center coordinates are calculated as follows, subtracting 0.5 according to the standard computer graphics coordinate system convention: ; ; Among them, c x and c y W represents the x-coordinate and y-coordinate of the optical center coordinates, respectively. src and H src These represent the image source width and image source height, respectively.

[0033] The normalized radius formula is as follows, representing the distance from the image center to the diagonal vertex, which serves as the reference length for normalization: ; Among them, R norm This represents the baseline value for the normalized radius.

[0034] Furthermore, to improve computational efficiency, the reciprocal of the normalized radius can be pre-calculated for later use. The coordinate normalization formula is as follows: ; ; in, The x-axis represents the normalized coordinates. The ordinate represents the normalized ordinate.

[0035] In one embodiment, step S104 includes: Obtain the offset parameter, and calculate the width and height of the image to be processed based on the offset parameter to obtain the region to be processed; Calculate the storage step size of the target image and obtain the reference offset position of the region to be processed relative to the target image; Based on the reference offset position, obtain the array access positions of all pixels in the target image; Based on the starting pixel of the target image, the normalized coordinates of each pixel relative to the optical center coordinates are calculated using the normalized radius reference value to obtain the initialized region to be processed.

[0036] This embodiment first calculates the width and height of the image to be processed based on offset parameters, thereby determining the size of the region to be processed. Next, the storage step size of the target image is calculated, reflecting the number of bytes between two adjacent rows of pixels in the storage medium. Then, the reference offset position of the region to be processed relative to the target image is obtained, which is crucial for determining the specific location of the region to be processed within the target image. Based on this reference offset position, the array access positions of all pixels in the target image can be accurately obtained, providing a foundation for subsequent pixel operations. Then, starting from the starting pixel of the target image, the normalized coordinates of each pixel relative to the optical center coordinates are calculated using the normalized radius reference value. The normalized coordinates map the pixel positions to a uniform numerical range, ensuring consistency in processing images of different sizes. Through this processing, the initialized region to be processed is obtained, preparing it for subsequent correction processing.

[0037] Specifically, obtaining the offset parameter and calculating the image width and height to be processed based on the offset parameter to obtain the region to be processed includes: Based on the target image, the input image offset is obtained, and the effective area of ​​the target image in the memory buffer is divided using the input image offset to obtain the first offset information; The offset of the region of interest is obtained by function call parameters, and the target image is segmented using the offset of the region of interest to obtain the second offset information; The global coordinate offset is obtained by function call parameters, and the target image is aligned using the global coordinate offset to obtain the third offset information; By combining the first offset information, the second offset information, and the third offset information, the image width and image height to be processed are calculated for the target image.

[0038] The offset parameters described in this embodiment include three categories, each with different sources and uses. The first category is the input image offset, including the horizontal offset `offsetW` and the vertical offset `offsetH`. This offset is carried by the image data structure and originates from the image acquisition device or the preprocessing stage. This offset indicates the starting position of the valid image data in the memory buffer. Causes include: memory alignment optimization requirements, mismatch between the image sensor acquisition area and the output buffer size, image cropping or reserved boundary space, and distributed storage of multiple frames of images in a unified buffer.

[0039] The second category is the region of interest offset, including roi.offsetW and roi.offsetH. This offset is passed in as a function call parameter and indicates the starting position of the region of interest to be vignetted relative to the effective image area. By specifying the region of interest, image block processing can be achieved, dividing a large image into several image blocks of the same size, and performing correction calculations block by block, thereby reducing the amount of data processed per cycle, improving processing speed, and reducing peak memory usage.

[0040] The third type is the global coordinate offset, which is passed as a function parameter to align the overall coordinate system and ensure the consistency of the coordinate system between different processing modules or different image blocks.

[0041] Based on the offset information mentioned above, the actual image width and height to be processed are calculated. Specifically, the processing width equals the input image width (imageWidth) minus the input image horizontal offset (offsetW), and the processing height equals the input image height (imageHeight) minus the input image vertical offset (offsetH). Subtracting the offset aims to eliminate invalid data areas in the memory buffer, processing only the valid image areas and avoiding invalid calculations on padding data or unused areas.

[0042] Furthermore, when calculating the storage stride of image data in memory, since the image data is stored in an RGBA four-channel interleaved arrangement, with each pixel occupying four consecutive data elements corresponding to the red, green, blue, and alpha channels respectively, the storage stride calculation formula is: stride equals the data buffer width dataWidth multiplied by 4. This stride represents the number of array elements spanned from the first pixel of the current row to the first pixel of the next row, used to implement row jumps during two-dimensional image traversal.

[0043] The baseoffset position of the processing region in the image data is calculated. This position indicates the starting index of the valid processing data in the one-dimensional array. The formula for calculating the baseoffset position is: baseOffset equals the input image vertical offset offsetH multiplied by the data buffer width dataWidth, plus the input image horizontal offset offsetW, and then multiplied by 4. The derivation of this formula is as follows: First, the vertical offset offsetH represents the number of rows to skip. Each row contains dataWidth pixels, so the total number of pixels to skip is offsetH multiplied by dataWidth. Second, after reaching the target row, a horizontal offset offsetW pixels is required within that row. The sum of these two values ​​gives the number of pixels between the beginning of the buffer and the beginning of the valid data. Finally, since each pixel occupies 4 array elements, the number of pixels needs to be multiplied by 4 to convert it into an array index.

[0044] The physical meaning of this reference offset position is as follows: In the one-dimensional array representation of image data, the red channel value of the first pixel in the effective processing area is located at the baseOffset position of the array, the green channel is located at baseOffset + 1, the blue channel is located at baseOffset + 2, and the alpha channel is located at baseOffset + 3. In subsequent pixel-by-pixel processing, the array access position of all pixels is calculated based on this reference offset position.

[0045] The calculation involves normalizing the coordinates of the starting pixel relative to the optical center, including both horizontal and vertical normalized initial values. A key optimization lies in calculating the unit increment, i.e., the change in normalized distance for each pixel movement. This value is equal to the reciprocal of the normalized radius and can be reused subsequently to avoid repeated division operations. The incremental update formula is as follows: ; ; ; ; in, Represents the x-coordinate of the starting pixel. This represents the x-coordinate of the (j+1)th pixel. This represents the ordinate of the (j+1)th pixel.

[0046] This embodiment simplifies the complex division operation, which originally required pixel-by-pixel processing, into a more efficient addition operation through algorithm design, thereby significantly reducing the computational complexity from the original linear level O(n) to the constant level O(1). This improvement not only greatly enhances computational efficiency but also makes the algorithm more real-time and scalable when processing large-scale image data.

[0047] In one embodiment, step S105 includes: Obtain the vertical and horizontal normalized coordinates of the initialized region to be processed; The vertical normalized coordinates are initialized to the vertical starting value, and each row of pixels in the target image is traversed based on the vertical starting value to calculate the squared radial distance of each pixel relative to the optical center. The target index is obtained by querying the correction lookup table based on the squared radial distance. The corresponding correction coefficient is determined based on the target index, and the target image is corrected using the correction coefficient.

[0048] In this embodiment, when correcting the target image, the vertical normalized coordinates in the area to be processed are first initialized to the vertical starting value, which is the starting point for traversing each row of pixels in the target image. Starting from this starting point, each row of pixels in the target image is traversed. During the traversal, for each pixel, the squared radial distance relative to the optical center is calculated. This squared radial distance is the key basis for subsequent lookup in the correction lookup table.

[0049] After obtaining the squared radial distance of each pixel relative to the optical center, the correction lookup table is queried based on this squared radial distance. Since the correction lookup table stores the mapping relationship between the normalized squared distance and the brightness correction coefficient, the corresponding target index can be accurately found by using the squared radial distance.

[0050] Once the target index is found, the corresponding correction coefficient can be determined based on it. This correction coefficient, calculated using normalized distance, baseline coefficients, etc., during the construction of the correction lookup table, determines the degree of compensation required for that pixel. Finally, this correction coefficient is used to correct the corresponding pixels in the target image, thereby achieving vignetting correction for the entire target image.

[0051] In a specific embodiment, the step of determining the corresponding correction coefficient based on the target index and using the correction coefficient to perform correction processing on the target image includes: Based on the RGB color channels of the target image, the signed input pixel value is read for each color channel, and the signed input pixel value is converted into an unsigned pixel value. A signed pixel value is set by combining the unsigned pixel value and the correction coefficient, and the signed pixel value is cropped to a preset effective range; The target image is corrected using signed pixel values ​​within the effective range.

[0052] In this embodiment, when correcting the target image, the signed input pixel values ​​of each of the RGB color channels are first read and converted into unsigned pixel values. Then, the corresponding signed pixel values ​​are set based on the correction coefficients, and the correction is performed according to these signed pixel values. Here, considering that the signed pixel values ​​may exceed a preset valid range, they need to be cropped to this range, for example, 0 to 255. By cropping the signed pixel values ​​to this range, invalid pixel values ​​can be avoided, ensuring the quality of the corrected image.

[0053] In practical applications, during the process of traversing each row of pixels in the target image based on the vertical starting value to calculate the squared radial distance of each pixel relative to the optical center, the offset position of the current row in the image data is first calculated using the calculated storage stride. Then, the squared value of the vertical normalized distance of the current row is pre-calculated for reuse by all pixels in that row. Next, the horizontal normalized coordinates are initialized to the horizontal starting value, and the next step is called to process all pixels in the current row. After processing the current row, the vertical normalized coordinates are increased by one unit increment to move to the next row. This process is repeated iteratively, with each iteration calculating a unit increment. The formula for calculating the offset position is: .

[0054] Furthermore, the squared radial distance equals the square of the horizontal normalized coordinate plus the square of the vertical normalized distance. The index for the correction lookup table is calculated based on the squared radial distance; specifically, the squared radial distance can be multiplied by 4096 and rounded down. To prevent out-of-bounds errors, if the squared radial distance is greater than or equal to 1, the maximum index of 4096 is used, ensuring the index is within the valid range of 0 to 4096. The calculated index can then be used to look up the corresponding correction coefficient in the vignetting correction lookup table. The formula for calculating the correction lookup table index is as follows: ; The formula for calculating the correction factor is: ; Wherein, S(r 2 ) represents the correction coefficient, idx represents the index, and r represents the index. 2 It represents the square of the radial distance.

[0055] When performing correction processing on the three RGB color channels separately, for each channel, the signed input pixel value is first read, then 32768 is added to convert it to an unsigned representation, mapping it to the range of 0 to 65535. The unsigned pixel value is multiplied by the obtained correction coefficient, then 32768 is subtracted to convert it back to a signed representation. To ensure the value is within the valid range, the correction result is cropped to between -32768 and +32767, and finally the cropped value is written to the output image. After processing the current pixel, the horizontal normalized coordinate is increased by one unit increment to move to the next pixel.

[0056] The formula for converting signed input pixel values ​​to unsigned pixel values ​​is: ; Formula for setting signed pixel values ​​using correction coefficients: ; The formula for cropping signed pixel values ​​is: ; ; Furthermore, the corrected image is stored in the output structure.

[0057] Compared to traditional correction methods, the vignetting correction method proposed in this embodiment exhibits significant technical advantages. It possesses core characteristics such as extremely high computational efficiency (performance improvement of 5-10 times), excellent real-time processing capabilities, controllable correction accuracy, strong adaptability, low memory footprint, flexible parameter adjustment, and bidirectional correction capabilities. Compared to traditional polynomial correction methods, this embodiment employs a lookup table-based correction strategy, reducing computational load by approximately 60%-70%. While significantly reducing the computational load, it also achieves higher correction accuracy with flexible configurability. It effectively adapts to low-power embedded platforms such as ISPs and DSPs, balancing real-time processing requirements with correction effect stability, and solving multiple pain points of traditional methods in terms of computational efficiency, adaptability, and accuracy control. The formula for the traditional method is: Each pixel requires 3 multiplications + 3 additions. The formula in this embodiment is: Each pixel requires 1 multiplication and 1 table lookup.

[0058] Figure 2 This is a schematic block diagram of a lens vignetting correction device 200 provided in an embodiment of the present invention. The device 200 includes: The reference setting unit 201 is used to set the reference data index according to the lens vignetting intensity parameter and extract the reference coefficient from the pre-calibrated lens vignetting data. Table construction unit 202 is used to construct a correction lookup table by combining the vignetting intensity parameters, the reference data index and the reference coefficient; The image calculation unit 203 is used to acquire the target image captured by the lens and calculate the optical center coordinates and normalized radius reference value of the target image; The region initialization unit 204 is used to obtain the region to be processed of the target image and perform region initialization of the region to be processed in combination with the optical center coordinates and the normalized radius reference value. Image correction unit 205 is used to perform correction processing on the target image based on the initialized region to be processed and in conjunction with the correction lookup table.

[0059] In one embodiment, the table construction unit 202 includes: An index normalization unit is used to normalize the baseline data index to obtain a normalized distance; The coefficient setting unit is used to calculate the power of the normalized distance and set the correction coefficient based on the calculation result of the power and the benchmark coefficient. A direction determination unit is used to determine the correction direction to be corrected based on the vignetting intensity parameter; The construction unit is used to construct the correction lookup table by combining the normalized distance, correction coefficient, and correction direction.

[0060] In one embodiment, the image calculation unit 203 includes: The source data acquisition unit is used to acquire the image source width and image source height of the target image; The parameter calculation unit is used to calculate the optical center coordinates and the normalized radius reference value based on the image source width and image source height, respectively.

[0061] In one embodiment, the region initialization unit 204 includes: An offset calculation unit is used to obtain offset parameters and calculate the width and height of the image to be processed based on the offset parameters to obtain the region to be processed. A reference acquisition unit is used to calculate the storage step size of the target image and acquire the reference offset position of the region to be processed relative to the target image; The position acquisition unit is used to acquire the array access positions of all pixels of the target image based on the reference offset position; The coordinate calculation unit is used to calculate the normalized coordinates of each pixel relative to the optical center coordinates based on the starting pixel of the target image and the normalized radius reference value, so as to obtain the initialized area to be processed.

[0062] In one embodiment, the offset calculation unit includes: An effective segmentation unit is used to obtain the input image offset based on the target image, and to use the input image offset to segment the effective region of the target image in the memory buffer to obtain the first offset information; The image segmentation unit is used to obtain the offset of the region of interest through function call parameters, and to perform image segmentation processing on the target image using the offset of the region of interest to obtain the second offset information; The coordinate alignment unit is used to obtain the global coordinate offset through function call parameters, and use the global coordinate offset to perform coordinate alignment on the target image to obtain the third offset information; The information combining unit is used to combine the first offset information, the second offset information and the third offset information to calculate the image width and image height to be processed for the target image.

[0063] In one embodiment, the image correction unit 205 includes: The coordinate acquisition unit is used to acquire the vertical normalized coordinates and horizontal normalized coordinates in the initialized area to be processed. A pixel traversal unit is used to initialize the vertical normalized coordinates to a vertical starting value, and traverse each row of pixels in the target image based on the vertical starting value, thereby calculating the squared radial distance of each pixel relative to the optical center. An index query unit is used to query the correction lookup table based on the squared radial distance to obtain the target index; The coefficient correction unit is used to determine the corresponding correction coefficient according to the target index, and to perform correction processing on the target image using the correction coefficient.

[0064] In one embodiment, the coefficient correction unit includes: The sign conversion unit is used to read the signed input pixel value for each color channel based on the RGB color channels of the target image, and convert the signed input pixel value into an unsigned pixel value. A pixel cropping unit is used to combine the unsigned pixel value and the correction coefficient to set a signed pixel value, and to crop the signed pixel value to a preset effective range. An effective correction unit is used to perform correction processing on the target image using signed pixel values ​​within an effective range.

[0065] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.

[0066] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed, can perform the steps provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0067] This invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the steps provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.

[0068] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0069] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for correcting lens vignetting, characterized in that, include: Set the reference data index according to the lens vignetting intensity parameter, and extract the reference coefficient from the pre-calibrated lens vignetting data; A correction lookup table is constructed by combining the vignetting intensity parameters, the baseline data index, and the baseline coefficients; Acquire the target image captured by the lens, and calculate the optical center coordinates and normalized radius reference value of the target image; The region to be processed in the target image is obtained, and the region to be processed is initialized by combining the optical center coordinates and the normalized radius reference value. Based on the initialized region to be processed, the target image is corrected using the correction lookup table.

2. The lens vignetting correction method according to claim 1, characterized in that, The step of constructing a correction lookup table by combining the vignetting intensity parameters, the baseline data index, and the baseline coefficients includes: The benchmark data index is normalized to obtain the normalized distance; Calculate the power of the normalized distance, and set the correction coefficient based on the calculation result of the power and the benchmark coefficient; The correction direction to be corrected is determined based on the vignetting intensity parameters; The correction lookup table is constructed by combining the normalized distance, correction coefficient, and correction direction.

3. The lens vignetting correction method according to claim 1, characterized in that, The process of acquiring the target image captured by the lens and calculating the optical center coordinates and normalized radius reference value of the target image includes: Obtain the image source width and image source height of the target image; The optical center coordinates and normalized radius reference values ​​are calculated based on the image source width and image source height, respectively.

4. The lens vignetting correction method according to claim 1, characterized in that, The step of acquiring the region to be processed in the target image and initializing the region to be processed by combining the optical center coordinates and the normalized radius reference value includes: Obtain the offset parameter, and calculate the width and height of the image to be processed based on the offset parameter to obtain the region to be processed; Calculate the storage step size of the target image and obtain the reference offset position of the region to be processed relative to the target image; Based on the reference offset position, obtain the array access positions of all pixels in the target image; Based on the starting pixel of the target image, the normalized coordinates of each pixel relative to the optical center coordinates are calculated using the normalized radius reference value to obtain the initialized region to be processed.

5. The lens vignetting correction method according to claim 4, characterized in that, The process of obtaining the offset parameter and calculating the image width and height to be processed based on the offset parameter to obtain the region to be processed includes: Based on the target image, the input image offset is obtained, and the effective area of ​​the target image in the memory buffer is divided using the input image offset to obtain the first offset information; The offset of the region of interest is obtained by function call parameters, and the target image is segmented using the offset of the region of interest to obtain the second offset information; The global coordinate offset is obtained by function call parameters, and the target image is aligned using the global coordinate offset to obtain the third offset information; By combining the first offset information, the second offset information, and the third offset information, the image width and image height to be processed are calculated for the target image.

6. The lens vignetting correction method according to claim 1, characterized in that, The process of correcting the target image based on the initialized region to be processed, combined with the correction lookup table, includes: Obtain the vertical and horizontal normalized coordinates of the initialized region to be processed; The vertical normalized coordinates are initialized to the vertical starting value, and each row of pixels in the target image is traversed based on the vertical starting value to calculate the squared radial distance of each pixel relative to the optical center. The target index is obtained by querying the correction lookup table based on the squared radial distance. The corresponding correction coefficient is determined based on the target index, and the target image is corrected using the correction coefficient.

7. The lens vignetting correction method according to claim 6, characterized in that, The step of determining the corresponding correction coefficient based on the target index and using the correction coefficient to perform correction processing on the target image includes: Based on the RGB color channels of the target image, the signed input pixel value is read for each color channel, and the signed input pixel value is converted into an unsigned pixel value. A signed pixel value is set by combining the unsigned pixel value and the correction coefficient, and the signed pixel value is cropped to a preset effective range; The target image is corrected using signed pixel values ​​within the effective range.

8. A lens vignetting correction device, characterized in that, include: The reference setting unit is used to set the reference data index according to the lens vignetting intensity parameter and extract the reference coefficient from the pre-calibrated lens vignetting data. The table construction unit is used to construct a correction lookup table by combining the vignetting intensity parameters, the baseline data index, and the baseline coefficients. An image calculation unit is used to acquire the target image captured by the lens and calculate the optical center coordinates and normalized radius reference value of the target image; A region initialization unit is used to obtain the region to be processed in the target image and initialize the region to be processed by combining the optical center coordinates and the normalized radius reference value. An image correction unit is used to perform correction processing on the target image based on the initialized region to be processed, in conjunction with the correction lookup table.

9. A computer device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the lens vignetting correction method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the lens vignetting correction method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Micro light emitting diode light emitting characteristic detection device and image correction method

    CN122192713A