Image striping noise repair method and system for flat field calibration

CN123015313APending Publication Date: 2026-10-30SUZHOU HUAXING YUANCHUANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611103019.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]为了解决如何对带状噪声进行准确识别并提高带状噪声区域修复准确性,以提高平场标定系数计算准确度及成像质量的问题,本申请实施例提供了平场标定的图像带状噪声修复方法及系统

Benefits of technology

[0015]本申请提供的平场标定的图像带状噪声修复方法,基于待修复图像中每一行像素点的灰度值确定带状噪声区域,通过行级灰度变化特征准确识别带状噪声位置,避免了像素级噪声的干扰,提升了噪声识别的准确性。在带状噪声区域两侧选取参考区域,通过多项式拟合得到各行像素理论值,充分考虑了光学系统渐晕效应带来的非线性灰度渐变,实现了带状噪声区域精确到行的像素针对性修复,相比单行线性插值更贴合实际灰度分布,修复后图像过渡自然。本申请的带状噪声修复方法计算复杂度低,修复后的平场标定图像可直接用于平场标定系数计算,有效提升了平场标定系数计算的准确度及平场标定后图像的均匀性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123015313A_ABST
    Figure CN123015313A_ABST
Patent Text Reader

Abstract

The application provides a flat field calibration image band noise repair method and system, comprising: obtaining a to-be-repaired image photographed by an integrating sphere light source; determining whether at least one band noise region exists in the to-be-repaired image based on the gray value of each row of pixel points in the to-be-repaired image; if yes, determining two reference regions containing a preset reference row number of pixel points on both sides of the band noise region, obtaining the theoretical value of each row of pixel points in the band noise region through polynomial fitting based on the pixel value of the pixel points in the two reference regions, obtaining the compensation value of each row of pixel points in the band noise region based on the theoretical value and the actual value of each row of pixel points in the band noise region, compensating the flat field correction coefficient of the acquisition device through the compensation value, and outputting the flat field calibration coefficient after band noise repair. The application can effectively improve the accuracy of flat field calibration coefficient calculation and meet the demand of flat field calibration of an imaging colorimeter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image flat-field calibration technology, and in particular relates to a method and system for repairing image band noise using flat-field calibration. Background Technology

[0002] Imaging colorimeters convert optical signals into digital signals that can be recognized by a digitally programmable chip through an optical lens, color filter, ND filter, CCD / complementary metal-oxide-semiconductor image sensor, and analog-to-digital converter circuit. The digitally programmable chip then sends the obtained digital signals to a computer. The host computer software processes the data using optical and image algorithms to obtain the required optical parameters, such as brightness, chromaticity, brightness uniformity, and color difference. The digitally programmable chip can be an Advanced Reduced Instruction Set Machine (ARMS) chip, a Digital Signal Processor (DSP) chip, or a Field-Programmable Gate Array (FPGA) chip, among others.

[0003] Because CCD / Complementary Metal-Oxide-Semiconductor image sensors are exposed line by line, random banding noise occurs during the exposure and imaging process, which degrades image quality, particularly uniformity. In the initial flat-field calibration of the imaging colorimeter, the colorimeter is aligned with an integrating sphere light source with uniform brightness. After exposure and imaging, a flat-field coefficient file is obtained to correct image inhomogeneity. However, the presence of random banding noise reduces the accuracy of the flat-field coefficient calculation, resulting in poorer image uniformity after flat-field calibration in practical applications. Summary of the Invention

[0004] To address the challenges of accurately identifying and repairing banded noise regions, thereby improving the accuracy of flat-field calibration coefficient calculation and image quality, this application provides a method and system for repairing banded noise in flat-field calibrated images.

[0005] This application first provides a method for restoring banded noise in images using flat-field calibration, including: Acquire the image to be repaired obtained by photographing an integrating sphere light source; Based on the grayscale value of each row of pixels in the image to be repaired, determine whether there is at least one banded noise region in the image to be repaired; If present, two reference regions containing a preset number of reference rows of pixels are identified on both sides of the strip noise region. Based on the pixel values ​​of the pixels in the two reference regions, the theoretical values ​​of each row of pixels in the strip noise region are obtained through polynomial fitting. Based on the theoretical values ​​and the actual values ​​of each row of pixels in the strip noise region, the compensation values ​​of each row of pixels in the strip noise region are obtained. The flat field correction coefficient of the acquisition device is compensated by the compensation values, and the flat field calibration coefficient after strip noise repair is output.

[0006] Optionally, determining whether at least one banded noise region exists in the image to be repaired based on the grayscale value of each row of pixels in the image to be repaired includes: The average gray value of each row of pixels is calculated to obtain the row mean. The row mean values ​​are then arranged in order of row number to obtain the row mean value sequence. Determine the difference between the means of adjacent rows in the row mean sequence; If there are consecutive rows where the absolute value of the difference between the mean values ​​of adjacent rows is less than the mean threshold, and the mean difference between the starting and ending rows of the consecutive rows and the adjacent rows is greater than a set threshold, then the consecutive rows are determined to be the band noise region.

[0007] Optionally, determining the two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region includes: Obtain the first valid normal row on one side of the strip noise region and the second valid normal row on the other side; When the number of normal rows of both the first valid normal row and the second valid normal row is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference area, and the normal rows of the preset reference row number on the other side are taken as the second reference area. When one of the first valid normal rows and the second valid normal rows is less than the preset reference row number, and the other side is greater than or equal to the preset reference row number, a supplementary normal row is selected from the other side so that the sum of the normal row numbers of the first valid normal rows and the second valid normal rows is equal to twice the preset reference row number.

[0008] Optionally, determining the two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region includes: Obtain the first valid normal row on one side of the strip noise region and the second valid normal row on the other side; When the number of normal rows of both the first valid normal row and the second valid normal row is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference area, and the normal rows of the preset reference row number on the other side are taken as the second reference area. When at least one of the first valid normal rows and the second valid normal rows is less than the preset reference row number, a virtual reference row is generated on the side where the number of normal rows is less than the preset reference row number, and the virtual reference row and the real normal rows together constitute the reference area on the corresponding side.

[0009] Optionally, generating a virtual reference row on the side where the normal row count is less than the preset reference row count includes: The row of pixels containing the center of the integrating sphere light source in the image to be repaired is taken as the axis of symmetry row; A virtual reference row is set at the position where the number of normal rows of the strip noise is less than the number of preset reference rows. For each virtual reference row to be generated, it is determined whether there is a mirror source row that is symmetrical to it and belongs to the normal row based on the symmetry axis row. If it exists, copy the pixel values ​​of the mirror source row to the virtual reference row.

[0010] Optional, also includes: If no mirror source row exists, the normal row that is symmetrical about the symmetry axis of the strip noise region is taken as the mirror source row. The mirror source region formed by the mirror source row is mirrored, flipped, and then translated to the corresponding virtual reference row. The pixel values ​​of the mirror source row are then copied into the virtual reference row.

[0011] Optional, also includes: The vertical gradient slope is estimated using the row mean of multiple normal rows within the mirror source region; The trend compensation amount is determined based on the vertical gradient slope, and then superimposed on each pixel value of the virtual reference row.

[0012] Optionally, after generating the virtual reference row and before the polynomial fitting, the process further includes: Calculate the horizontal gradient template of pixels within the banded noise region or within the normal row adjacent to the virtual reference row; Calculate the horizontal gradient of the virtual reference row and determine the similarity between the horizontal gradient of the virtual reference row and the horizontal gradient template; When the similarity is lower than a preset similarity threshold, the pixel values ​​of the virtual reference row are adjusted or the weight corresponding to the row mean of the virtual reference row is reduced in the polynomial fitting.

[0013] Optionally, adjusting the pixel values ​​of the virtual reference row includes: Extract the mean-removed residuals from each row within the banded noise region, and average the mean-removed residuals column by column to obtain the average residual texture template; The pixel value of each pixel in the virtual reference row is replaced with the sum of the trend-compensated row mean of the virtual reference row and the average residual texture template.

[0014] Another aspect of this application discloses a flat-field calibration system, including an optical lens, an image sensor, and a digital processing unit, characterized in that the image sensor is used to generate an image to be repaired through the optical lens, and the digital processing unit is configured to perform the method described above.

[0015] The method for repairing banded noise in images using flat-field calibration provided in this application determines the banded noise region based on the grayscale values ​​of each row of pixels in the image to be repaired. It accurately identifies the location of the banded noise by utilizing row-level grayscale change features, avoiding interference from pixel-level noise and improving the accuracy of noise identification. Reference regions are selected on both sides of the banded noise region, and the theoretical values ​​of each row of pixels are obtained through polynomial fitting. This fully considers the nonlinear grayscale gradient caused by the vignetting effect of the optical system, achieving pixel-specific repair of the banded noise region down to the row level. Compared with single-row linear interpolation, this method better matches the actual grayscale distribution, resulting in a more natural transition in the repaired image. The banded noise repair method of this application has low computational complexity, and the repaired flat-field calibration image can be directly used for flat-field calibration coefficient calculation, effectively improving the accuracy of flat-field calibration coefficient calculation and the uniformity of the image after flat-field calibration. Attached Figure Description

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

[0017] Figure 1 A general flowchart of the image band noise restoration method with flat field calibration provided in the embodiments of this application; Figure 2 A sub-flowchart of the strip noise region identification method provided in the embodiments of this application; Figure 3 A flowchart illustrating one implementation method for the reference area provided in this application embodiment; Figure 4 A flowchart illustrating another implementation method for selecting the reference area provided in the embodiments of this application; Figure 5 A flowchart of an implementation method generated for the virtual reference lines provided in the embodiments of this application; Figure 6 A flowchart illustrating another implementation method for generating virtual reference lines provided in the embodiments of this application; Figure 7 A flowchart of the trend compensation steps provided in the embodiments of this application; Figure 8 A flowchart of the virtual reference line verification and adjustment steps provided in this application embodiment; Figure 9 A flowchart illustrating the virtual reference row pixel value adjustment steps provided in this application embodiment. Detailed Implementation

[0018] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not limiting, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without such specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary detail.

[0019] This application discloses, on the one hand, a method for restoring banded noise in images using flat-field calibration, such as... Figure 1 As shown, the method includes: S101: Acquire the image to be repaired obtained by shooting the integrating sphere light source.

[0020] S102: Determine whether there is at least one banded noise region in the image to be repaired based on the gray value of each row of pixels in the image to be repaired.

[0021] S103: Determine two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region. Based on the pixel values ​​of the pixels in the two reference regions, obtain the theoretical values ​​of each row of pixels in the strip noise region through polynomial fitting. Based on the theoretical values ​​and the actual values ​​of each row of pixels in the strip noise region, obtain the compensation values ​​of each row of pixels in the strip noise region. Compensate the flat field correction coefficient of the acquisition device with the compensation values ​​and output the flat field calibration coefficient after strip noise repair.

[0022] In this embodiment, the optical lens of the imaging colorimeter receives uniform light emitted from the integrating sphere light source, which is then projected onto the photosensitive surface of the image sensor after passing through a filtering element. The image sensor uses a line-by-line exposure method to perform exposure readings line by line. The analog electrical signal is converted into a digital signal by an analog-to-digital converter circuit and then transmitted to the processing unit to form a digital image. These digital images may contain banded noise, which is used as the image to be repaired.

[0023] Specifically, each pixel in the image to be repaired corresponds to a grayscale value, the magnitude of which reflects the intensity of the incident light at that location and the response of the image sensor. Due to the line-by-line readout characteristic of line-by-line exposure, the exposure sequence of different lines differs. Under the influence of circuit noise, power supply fluctuations, or environmental interference, the grayscale values ​​of some consecutive lines may shift overall, forming a band-like noise extending horizontally. This type of noise is continuously distributed on a line-by-line basis, with pixels within the same line being generally too high or too low, disrupting the original continuous grayscale distribution of the image. The presence of band-like noise will cause deviations in the flat field coefficient, ultimately leaving band-like artifacts in the corrected image and affecting the uniformity index of the measurement results.

[0024] In this embodiment, due to the uniformity of light output from the integrating sphere light source and the gradual change characteristics of the optical system, under normal working conditions, the grayscale value of the flat-field calibration image exhibits a continuous and smooth trend along the vertical direction, without any jumps. The grayscale value inside the banded noise region is abnormal, but the normal rows on both sides of the region can reflect the true grayscale change trend. Therefore, the normal rows on both sides are selected as reference regions, and the original grayscale distribution of the banded noise region, i.e., the theoretical value of each row of pixels, is restored by polynomial fitting. Then, based on the theoretical value and the actual value of each row of pixels in the banded noise region, the compensation value of each row of pixels in the banded noise region is obtained. For example, the compensation value of each pixel is obtained by subtracting the actual value from the theoretical value. Thus, based on the abnormality of the flat-field calibration coefficient determined by the original image to be repaired, the corresponding compensation value of the flat-field calibration coefficient can be calculated to compensate the flat-field correction coefficient of the image acquisition device, and the flat-field calibration coefficient after banded noise repair is output. The compensation value can be converted into the corresponding compensation value of the flat calibration coefficient based on the ratio of the actual value and the abnormal flat calibration coefficient. Of course, in practical applications, those skilled in the art can also use the compensation value to compensate the flat calibration coefficient according to the actual situation, which is a conventional technical means in this field, and this application does not limit it.

[0025] The formula for calculating polynomial fitting is as follows:

[0026] Where j represents the row number of the pixel row, Denotes the coefficients to be determined. This represents the theoretical row mean obtained by polynomial fitting of the j-th row. The theoretical row mean can be obtained by substituting the row number j of each row within the banded noise region into the polynomial.

[0027] The theoretical value represents the gray level that the row should have when there is no banded noise. By comparing the theoretical value with the actual outlier, the offset that each row needs to be compensated for is obtained:

[0028] Where j represents the row number of the pixel row, This represents the theoretical row mean obtained by polynomial fitting of the j-th row. This represents the row mean actually calculated for the j-th row. This represents the offset that needs to be compensated for in row j. After obtaining the compensation offset for each row, the offset is applied to each pixel corresponding to that row to complete the pixel compensation for the banded noise region. The formula for calculating pixel compensation is:

[0029] Where i represents the column number of the pixel, and j represents the row number of the pixel row. This represents the original grayscale value of the pixel in the i-th column and j-th row. This represents the offset that needs to be compensated for in the j-th row. This represents the grayscale value of the pixel after compensation. Polynomial fitting can adapt to non-linear grayscale gradient scenes, and compared to simple linear interpolation, it more closely matches the actual image grayscale distribution. The repaired image transitions more naturally and does not exhibit new artificial artifacts. The flat-field calibration image after banded noise repair eliminates the abrupt grayscale changes caused by banded noise, and the grayscale distribution is closer to the real uniform light source imaging result. The flat-field coefficients generated based on this image can more accurately correct the non-uniformity of the imaging system's response.

[0030] In alternative implementations, such as Figure 2 As shown, the method for identifying striped noise regions in this application includes: S201: Calculate the average gray value of each row of pixels to obtain the row mean, and arrange the row mean in order according to the row number of the pixel row to obtain the row mean sequence.

[0031] S202: Determine the difference between the means of adjacent rows in the row mean sequence.

[0032] S203: If there are consecutive rows where the absolute value of the difference between the mean values ​​of adjacent rows is less than the mean threshold, and the mean difference between the starting and ending rows of the consecutive rows and the adjacent rows is greater than the set threshold, then the consecutive rows are determined to be the strip noise region.

[0033] Specifically, the row mean is calculated as follows:

[0034] Where i represents the row number of the pixel, ranging from 1 to the total number of rows in the image; j represents the column number of the pixel, ranging from 1 to the total number of columns in the image; and I(i,j) represents the grayscale value of the pixel in the i-th row and j-th column. This represents the average gray value of the i-th row. By calculating the average gray value row by row, two-dimensional image data can be converted into a one-dimensional sequence of row averages, simplifying the subsequent noise region identification process while preserving the gray-level variation characteristics in the vertical direction. When calculating the row average, only the effective region pixels of the image can be used for calculation, excluding dark edge regions without illumination, thus avoiding the influence of dark edge regions on the accuracy of the row average. The effective region can be determined by a pre-calibrated integrating sphere imaging range, or by obtaining the bright area range through gray-level threshold segmentation. Using the row average as the basis for judgment can suppress the interference of single-pixel random noise on the judgment results, highlight the overall gray-level variation characteristics of the row, and make the boundaries of band noise easier to identify.

[0035] In this embodiment, the difference between the means of adjacent rows in the row mean sequence is determined by subtracting the mean of the previous row from the mean of the next row in ascending order of row number. The sign of the difference reflects the direction of grayscale change, and the absolute value of the difference reflects the magnitude of the change. The absolute value of the difference between the means of adjacent rows in normal regions is usually small and within the normal fluctuation range. However, at the boundary of banded noise, the absolute value of the difference between the means of adjacent rows will significantly increase, exceeding the normal fluctuation range. The calculation of the difference between the means of adjacent rows is as follows:

[0036] Where i represents the row number of the pixel, and its value ranges from 1 to the total number of rows in the image minus one. This represents the average gray value of the i-th row. This represents the average gray value of the (i+1)th row. This represents the difference between the mean values ​​of row i and row i+1. By calculating the difference in mean values ​​between adjacent rows, the grayscale changes between rows can be amplified, making it easier to identify row boundaries with abrupt changes. The difference operation is equivalent to performing a first-order difference on the row mean sequence, which can highlight abrupt changes in the sequence, weaken the gradual trend of slow changes, and make the jump characteristics of band noise more obvious.

[0037] Secondly, the threshold can be set based on the overall grayscale level and noise characteristics of the image. For example, it can be adaptively calculated based on the standard deviation of the row mean difference of the entire image, or a fixed value can be set based on prior data of the calibration scene. When the absolute value of the row mean difference corresponding to a certain row exceeds the set threshold, it indicates that there is a grayscale abrupt change between that row and the previous row, which belongs to the boundary position of the banded noise. During the recognition process, the row that is later in the adjacent rows with a difference greater than the set threshold is the starting row of the banded noise region. After the starting row, consecutive rows with differences within the mean threshold belong to the noise region until the difference between adjacent rows exceeds the set threshold again. The row that is earlier in the adjacent rows corresponds to the ending row of the banded noise region. After recording the starting row number and the ending row number, the number of rows contained in the region is the total number of rows in the noise region. Among these, those skilled in the art can set the specific value of the mean threshold according to the actual situation, as long as it can be used to determine that the grayscale of adjacent rows is consistent and no abrupt change has occurred. This application does not limit this.

[0038] In alternative implementations, such as Figure 3 As shown, determining the two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region includes: S301: Obtain the first valid normal line on one side of the strip noise region and the second valid normal line on the other side.

[0039] S302: When the number of normal rows of both the first valid normal row and the second valid normal row is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference area, and the normal rows of the preset reference row number on the other side are taken as the second reference area.

[0040] S303: When one of the first valid normal rows and the second valid normal rows is less than the preset reference row number, and the other side is greater than or equal to the preset reference row number, a supplementary normal row is selected from the other side so that the sum of the normal row numbers of the first valid normal rows and the second valid normal rows is equal to twice the preset reference row number.

[0041] In this embodiment, when determining the reference areas on both sides of the strip noise region, it is first necessary to define the effective normal row range on both sides of the strip noise region. Effective normal rows are pixel rows that are not included in any strip noise region; the grayscale values ​​of these rows are not affected by the strip noise and can be used as a reference for fitting grayscale trends. One side of the strip noise region is the area above the starting row, and the other side is the area below the ending row. The number of effective normal rows contained on both sides is counted to obtain the number of the first and second effective normal rows. The first and second effective normal rows correspond to the normal rows on the upper and lower sides of the strip noise region, respectively. The division between upper and lower can be determined based on the row number; the side with the smaller row number is the upper side, and the side with the larger row number is the lower side.

[0042] When the number of normal rows in both the first and second valid normal rows is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference region, and the normal rows of the preset reference row number on the other side are taken as the second reference region. When selecting reference rows, priority can be given to selecting the normal rows closest to the banded noise region, that is, selecting a specified number of rows sequentially outward from the boundary of the banded noise region. Rows closer to the noise region have a closer grayscale trend to the noise region. Image grayscale changes are usually continuous; the closer the rows are, the more similar their grayscale features. Rows farther apart are affected by factors such as gradation, resulting in greater differences in grayscale features. Therefore, prioritizing the selection of neighboring rows as references ensures the correlation between the reference data and the noise region, improving the accuracy of the fitting.

[0043] In a specific example, if the preset number of reference rows is set to 10, then 10 consecutive normal rows are selected upwards from the upper boundary of the banded noise region as the first reference region, and 10 consecutive normal rows are selected downwards from the lower boundary as the second reference region. Since the rows in both reference regions are genuine normal rows, the data reliability is high, and the fitting results are stable. Setting the number of reference rows on both sides ensures that the fitted curve is evenly constrained by the data on both sides, avoiding excessive weighting of one side's data that could lead to a biased fitting result.

[0044] When at least one of the first and second valid normal rows is less than the preset reference row count, supplementary normal rows are selected from the side of the banded noise region where the number of normal rows is greater than the preset reference row count. The sum of the first and second valid normal rows then becomes twice the preset reference row count. When the banded noise region is near the edge of the image, the number of normal rows on one side may be insufficient to select enough reference rows. In this case, additional supplementary rows can be selected from the side with more normal rows, ensuring that the total number of reference rows on both sides reaches twice the preset reference row count, thus maintaining the same total number of samples used for fitting.

[0045] It should be noted that the selection of supplementary rows also starts from the position closest to the banded noise area and extends outwards until the required number of rows is reached. For example, if the preset reference number of rows is 10, and there are only 5 valid normal rows above the banded noise area and 20 valid normal rows below, then all 5 normal rows above are selected, and 15 normal rows below are selected. The total number of reference rows on both sides is 20, which is twice the preset reference number. The extra 5 rows selected below are supplementary rows, which are also located in the normal area and can provide additional grayscale trend information. It should be noted that the above parameters are only illustrative and this application does not limit them.

[0046] In alternative implementations, such as Figure 4 As shown, determining the two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region includes: S401: Obtain the first valid normal line on one side of the strip noise region and the second valid normal line on the other side.

[0047] S402: When the number of normal rows of both the first valid normal row and the second valid normal row is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference area, and the normal rows of the preset reference row number on the other side are taken as the second reference area.

[0048] S403: When at least one of the first valid normal rows and the second valid normal rows is less than the preset reference row number, a virtual reference row is generated on the side where the number of normal rows is less than the preset reference row number, and the virtual reference row and the real normal rows together constitute the reference area on the corresponding side.

[0049] Specifically, when the number of valid normal rows on at least one side of a banded noise region is less than the preset number of reference rows—for example, when the banded noise region is very close to the image edge and the number of normal rows on the other side is also limited—virtual reference rows can be generated to supplement the number of reference rows. Simulated normal row data is constructed on the side lacking normal rows, ensuring that the number of reference rows on both sides reaches the preset number of reference rows.

[0050] After acquiring the first valid normal row on one side and the second valid normal row on the other side of the strip noise region, it is determined whether the number of normal rows on both sides meets the preset reference row count requirement. When the number of normal rows on both sides is not less than the preset reference row count, the actual normal rows on both sides are directly selected to form the reference region. When the number of normal rows on at least one side is less than the preset reference row count, a virtual reference row is generated on the side where the number of normal rows is less than the preset reference row count. The virtual reference row and the actual normal rows together form the reference region on the corresponding side. After generating the virtual reference row, the total number of reference rows on that side is equal to the preset reference row count, and the number of rows in the reference regions on both sides remains consistent.

[0051] Specifically, when generating virtual reference rows, the missing reference rows are constructed based on the existing real normal rows on that side, combined with the overall symmetry or gradient features of the image. The number of columns in the virtual reference rows is the same as the number of columns in the real image, and each pixel corresponds to a simulated grayscale value. After construction, the real normal rows and the virtual reference rows together form the reference region on that side, making the total number of reference rows on that side equal to the preset number of reference rows. Both reference regions contain row data of the preset number of reference rows, with the side with a sufficient number of rows consisting entirely of real normal rows, and the side with a insufficient number of rows containing some real normal rows and some virtual reference rows.

[0052] In alternative implementations, such as Figure 5 As shown, generating a virtual reference row on the side where the normal row count is less than the preset reference row count includes: S501: The pixel row containing the center of the integrating sphere light source on the image to be repaired is taken as the axis of symmetry row.

[0053] S502: Set up a virtual reference row at the position where the number of normal rows of the strip noise is less than the number of preset reference rows. For each virtual reference row to be generated, determine whether there is a mirror source row that is symmetrical to it and belongs to the normal row based on the axis of symmetry.

[0054] S503: If it exists, copy the pixel values ​​of the mirror source row to the virtual reference row.

[0055] Specifically, a virtual reference row is generated based on the central symmetry of the integrating sphere light source. The emitting surface of the integrating sphere light source is a uniform circular surface light source. When the optical axis of the imaging device is aligned with the center of the integrating sphere, the captured image exhibits an approximately symmetrical grayscale distribution in the vertical direction with the row containing the center of the integrating sphere as the axis of symmetry. Utilizing this symmetry characteristic, a virtual reference row on the other side can be obtained by mirroring the row data of the normal area. The determination of the axis of symmetry row can be achieved through pre-calibration. After the flat-field calibration system is built, since the relative position of the imaging device and the integrating sphere is fixed, the position of the center of the integrating sphere in each acquired image is basically consistent. During the initial calibration, the position of the center of the integrating sphere is calculated and recorded through image processing. In subsequent calibration processes, the recorded row number is directly called as the axis of symmetry row.

[0056] For the side where the number of normal rows in the strip noise pattern is less than the preset reference row number, virtual reference rows are set at the locations where normal rows are missing. For each virtual reference row to be generated, it is determined whether there is a mirror source row that is symmetrical to it and belongs to the normal row, based on the axis of symmetry. First, the number of missing normal rows on that side is counted, and the value is equal to the difference between the preset reference row number and the actual number of normal rows on that side. This difference is the number of virtual reference rows to be generated. Virtual reference rows are set sequentially at the locations where normal rows are missing, according to row number order, with each virtual reference row corresponding to a unique row number.

[0057] For each virtual reference row, calculate the row number of its symmetrical position based on the axis of symmetry row. The calculation of the symmetrical position row number can be derived from the axis of symmetry row number. After obtaining the symmetrical row number, check whether the row is within the range of valid normal rows. If the row is not included in any banded noise region and the row number is within the range of valid rows in the image, it is determined that a mirror source row exists.

[0058] If a reference row exists, the pixel values ​​of the mirrored source row are copied to the virtual reference row. This means assigning the grayscale value of each column of the mirrored source row to the corresponding pixel in the virtual reference row. After copying, the grayscale distribution of the virtual reference row is completely consistent with the mirrored source row. Due to the image's central symmetry, the grayscale distribution of this virtual reference row is approximately the same as the distribution of the real normal row at that location. Generating virtual reference rows based on central symmetry fully utilizes the inherent uniform symmetry of the integrating sphere light source, resulting in virtual reference rows with high consistency with the real grayscale distribution. Reference data can be obtained without complex calculations.

[0059] In alternative implementations, such as Figure 6 As shown, the method further includes: S601: If there is no mirror source row, the normal row that is symmetrical about the band noise region based on the axis of symmetry shall be taken as the mirror source row.

[0060] S602: After mirroring and flipping the mirror source region formed by the mirror source row, translate it to the corresponding virtual reference row, and copy the pixel values ​​of the mirror source row to the virtual reference row accordingly.

[0061] Furthermore, if no mirror source row exists, the normal row that is symmetrical to the banded noise region based on the axis of symmetry will be used as the mirror source row. When there is no valid normal row at the symmetrical position of the virtual reference row, it may be because the row at the symmetrical position is also within the banded noise region, or the row number at the symmetrical position exceeds the range of the image. In this case, it is not possible to directly generate a virtual reference row by symmetrically copying a single row. Instead, a continuous normal row region needs to be selected as the mirror source region, and the required virtual reference row needs to be generated by overall mirroring.

[0062] The mirror source region formed by the mirror source rows is flipped and translated to the corresponding virtual reference rows. The pixel values ​​of the mirror source rows are then copied to the virtual reference rows. First, select the same number of consecutive normal rows as the required number of virtual reference rows on the other side of the banded noise region, and form the mirror source region from these rows. The mirror source region can be selected preferentially from rows close to the axis of symmetry or from rows close to the banded noise region; all selected rows are normal rows unaffected by noise. Rows closer to the axis of symmetry have better symmetry characteristics, resulting in more accurate virtual rows. Rows closer to the noise region have a closer grayscale trend to the noise region, resulting in higher correlation during fitting. In actual implementation, the appropriate position can be selected according to requirements.

[0063] After selecting the mirror source region, the region is mirrored around the axis of symmetry, resulting in a flipped row sequence. After the flip, rows with smaller original row numbers are placed in positions with larger original row numbers, and vice versa. The flipped row sequence is then shifted to the positions of the virtual reference rows, so that each row in the mirror source region corresponds to a virtual reference row. Once the corresponding positions are determined, the grayscale value of each pixel in the mirror source row is copied to the corresponding column of the virtual reference row, completing the generation of the virtual reference row.

[0064] It should be noted that when a band of noise exists at a symmetrical location, the mirror source region must avoid the noise region on the opposite side and select continuous normal rows as the source data. If the normal rows on the opposite side are insufficient to form a mirror source region, the width of the mirror source region can be appropriately reduced, while the number of virtual reference rows generated can be decreased, or the reference region construction method of supplementing real rows can be switched. In actual implementation, the processing method can be flexibly selected according to the distribution of normal rows on both sides to ensure the validity of the reference data.

[0065] In alternative implementations, such as Figure 7 As shown, the method further includes: S701: Estimate the vertical gradient slope using the row mean of multiple normal rows within the mirror source region.

[0066] S702: Determine the trend compensation amount based on the vertical gradient slope, and superimpose the trend compensation amount on each pixel value of the virtual reference row.

[0067] Specifically, due to the vignetting effect of optical lenses or subtle differences in illumination distribution, the grayscale distribution of an image may exhibit a gradual change in the vertical direction. Virtual reference lines generated entirely based on symmetrical replication may have slight systematic deviations. The vignetting effect occurs when the amount of light transmitted to off-axis points of the optical lens is less than that at on-axis points, resulting in lower grayscale levels at the image edges compared to the center, with the grayscale gradually decreasing from the center to the edges, exhibiting an approximately parabolic distribution. This gradual change means that the grayscale levels at symmetrical positions on both sides of the center are not completely equal, resulting in slight differences. To correct the deviation caused by this gradual change, a trend compensation amount can be superimposed on the symmetrical replication to further improve the accuracy of the virtual reference lines.

[0068] The vertical gradient slope is estimated using the row average of multiple normal rows within the mirror source region. The vertical gradient slope reflects the rate of change of image grayscale in the vertical direction, measured in units of grayscale change per row. To estimate the slope, the row average of all rows within the mirror source region can be selected, and the slope of the row average as a function of row number can be obtained through linear fitting. Since the mirror source region is relatively small, the grayscale gradient within the region can be approximated as a linear change; therefore, the slope obtained using linear fitting can reflect the gradient trend of that region.

[0069] A trend compensation amount is superimposed on each pixel value of the virtual reference row. The trend compensation amount is calculated based on the row spacing between the virtual reference row and the mirror source row; the larger the row spacing, the greater the compensation amount. Each virtual reference row corresponds to one trend compensation amount. By superimposing this compensation amount on the grayscale values ​​of all pixels in that row, the overall grayscale deviation caused by the vertical gradient can be corrected. After superimposing the compensation amount, the overall grayscale level of the virtual reference row conforms to the gradient trend, while preserving the original intra-row texture distribution.

[0070] The vertical gradient slope is calculated as follows:

[0071] Where S represents the set of all pixel rows contained in the mirror source region, and i represents the index of the pixel row in the set. This represents the average of all row numbers in the set. This represents the average gray value of the i-th row. denoted by , represents the average of all row mean values ​​within the set, and k represents the estimated vertical gradient slope. The slope obtained through least-squares linear fitting accurately reflects the vertical grayscale variation trend within the mirror source region. Extending this trend to the position of the virtual reference row corrects the gradient deviation caused by symmetrical replication. This fitting method uses multiple rows of data to calculate the slope, reducing the impact of single-row random noise on the slope estimation and improving the stability of the slope.

[0072] The trend compensation amount is calculated as follows:

[0073] Where k represents the vertical gradient slope, and n represents the row number of the virtual reference row. This indicates the row number of the corresponding mirror source row. This indicates the trend compensation amount corresponding to the virtual reference row. All pixels in each virtual reference row are superimposed with the same trend compensation amount, which can correct the overall grayscale deviation caused by vertical gradients while preserving the texture distribution within the row. If the grayscale decreases along the direction of increasing row number, the slope is negative. For virtual reference rows with row numbers smaller than the mirror source row, the compensation amount is positive, which can improve the overall grayscale of the virtual row to make it conform to the gradient trend.

[0074] In alternative implementations, such as Figure 8 As shown, after generating the virtual reference row and before the polynomial fitting, the process also includes: S801: Calculate the horizontal gradient template of pixels within the banded noise region or normal row adjacent to the virtual reference row.

[0075] S802: Calculate the horizontal gradient of the virtual reference row and determine the similarity between the horizontal gradient of the virtual reference row and the horizontal gradient template.

[0076] S803: When the similarity is lower than a preset similarity threshold, adjust the pixel values ​​of the virtual reference row or reduce the weight corresponding to the row mean of the virtual reference row in the polynomial fitting.

[0077] Specifically, due to factors such as imaging alignment deviation and uneven light source, the symmetry characteristics of the image may be deviated, resulting in differences between the generated virtual reference lines and the actual situation. Verification can identify virtual reference lines with significant deviations and make corresponding adjustments.

[0078] Calculate the horizontal gradient template for pixels within the adjacent banded noise region or normal row of the virtual reference row. The selected template row can be a row near the boundary of the banded noise region or a neighboring real normal row. Calculate the horizontal gradient for multiple rows and then average them to obtain the horizontal gradient template. Averaging multiple rows reduces the influence of random noise and yields a more representative texture template. The horizontal gradient is calculated using the gray-level difference between adjacent columns of pixels. Each column corresponds to a gradient value, and the sequence of gradient values ​​for the entire row is the horizontal gradient distribution for that row. The horizontal gradient reflects the texture variation characteristics of the image in the horizontal direction. The horizontal gradient distributions of different rows in the same image are similar. If the horizontal gradient of the virtual reference row differs significantly from that of the real row, it indicates a deviation in the texture characteristics of the virtual reference row.

[0079] Calculate the horizontal gradient of the virtual reference row and determine its similarity to the horizontal gradient template. Compare the horizontal gradient sequence of the virtual reference row with the horizontal gradient template and calculate their similarity. Similarity can be calculated using the correlation coefficient method or the sum of squared differences method; a higher similarity indicates that the texture features of the two are more similar.

[0080] When the similarity is lower than a preset similarity threshold, the pixel values ​​of the virtual reference row are adjusted, or the weight corresponding to the row mean of the virtual reference row is reduced in the polynomial fitting. If the similarity is low, it indicates that the texture features of the virtual reference row deviate significantly from the real situation, and directly using it for fitting will affect the accuracy of the results. In this case, you can choose to adjust the pixel values ​​of the virtual reference row to make its texture features consistent with the real template. Alternatively, you can choose to reduce the weight of this row in the fitting to reduce the impact of biased data on the fitting results. The two methods can be used individually or in combination. For example, you can first adjust the pixel values, and if the similarity still does not meet the requirements after adjustment, then reduce the fitting weight.

[0081] It should be noted that the preset similarity threshold can be set according to the richness of the image's texture; the richer the texture, the higher the similarity threshold can be set. The more uniform the texture, the lower the similarity threshold can be set. The method of reducing weights can be dynamically adjusted according to the similarity magnitude; the lower the similarity, the smaller the weight.

[0082] The horizontal gradient of a single pixel is calculated as follows:

[0083] Where i represents the row number of the pixel, j represents the column number of the pixel, and I(i,j) represents the gray value of the pixel in the i-th row and j-th column. This represents the horizontal gradient value of the pixel in the i-th row and j-th column. The column number must be within a valid range during calculation; for columns at image edges, one-sided difference calculation can be used.

[0084] The similarity is calculated as follows:

[0085] Where j represents the column number of the pixel, and W represents the total number of columns in the image. This represents the horizontal gradient value in the j-th column of the virtual reference row. This represents the average of the horizontal gradients across all columns of the virtual reference row. This represents the gradient value in the j-th column of the horizontal gradient template. This represents the average of the gradient values ​​in all columns of the horizontal gradient template. This indicates the similarity between the two values, ranging from -1 to 1. The closer the value is to 1, the higher the similarity.

[0086] Conventional methods for handling virtually generated reference data typically involve directly fitting the data without verifying its reasonableness. When the virtual data deviates from the actual data, it directly impacts the final repair result. This application verifies the texture reasonableness of virtual reference rows using horizontal gradient similarity and adjusts pixel values ​​or fitting weights based on the verification results. This automatically identifies and corrects virtual data with significant deviations. Horizontal gradient verification leverages the characteristic that banded noise does not affect the horizontal texture within a row, ensuring reliable verification, low computational cost, and improved reliability of the reference data without excessively increasing complexity.

[0087] In alternative implementations, such as Figure 9 As shown, adjusting the pixel values ​​of the virtual reference row includes: S901: Extract the mean-removed residuals from each row within the banded noise region, and average the mean-removed residuals column by column to obtain the average residual texture template.

[0088] S902: Replace the pixel value of each pixel in the virtual reference row with the sum of the trend-compensated row mean of the virtual reference row and the average residual texture template.

[0089] Specifically, since banded noise mainly manifests as grayscale shifts across the entire row, it is additive noise and has little impact on the relative texture distribution within a row. Therefore, residual textures can be extracted from rows within the banded noise region as a real in-row texture template to reconstruct the texture details of the virtual reference row, ensuring that the texture features of the virtual reference row are consistent with the real row. Mean-free residuals are extracted from each row within the banded noise region, and the mean-free residuals are averaged column-by-column to obtain the average residual texture template. For each row within the banded noise region, the row mean is calculated, and then the grayscale value of each pixel in that row is subtracted from the corresponding row mean to obtain the mean-free residual sequence for that row. The mean-free residual sequence reflects the deviation of each pixel within the row relative to the row mean. Since banded noise is an additive shift across the entire row, subtracting the row mean eliminates the noise shift, and the residual sequence preserves the original texture features of the row. The mean-free residuals of all rows within the banded noise region are averaged column-by-column to obtain the average residual texture template. The length of the average residual texture template is the same as the number of columns in the image. Each column position corresponds to an average residual value, representing the typical deviation of that column position relative to the row mean. By averaging the residuals across multiple rows, the influence of random noise in a single row can be reduced, resulting in a more stable texture template.

[0090] The pixel value of each pixel in the virtual reference row is replaced with the sum of the trend-compensated row mean and the average residual texture template value of the virtual reference row. In other words, the overall row mean of the virtual reference row is first determined, which is the grayscale level after trend compensation. Then, the row mean of each column position is added to the residual value of the corresponding column to obtain the final grayscale value of each pixel.

[0091] The calculation of the mean-removed residual for a single row is as follows:

[0092] Where i represents the row number of the pixel within the banded noise region, j represents the column number of the pixel, and I(i,j) represents the gray value of the pixel in the i-th row and j-th column. Let R(i,j) represent the average gray value of the i-th row, and let R(i,j) represent the mean-free residual value of the i-th row and j-th column. The mean-free residual eliminates the influence of the overall gray level of the row, retaining only the texture fluctuation information within the row. The row offset caused by banded noise is canceled out during the subtraction of the row mean, so the residual sequence can reflect the original texture distribution within the row.

[0093] The average residual texture template is calculated as follows:

[0094] Where j represents the column index of the pixel, B represents the set of all pixel rows contained in the banded noise region, N represents the total number of rows contained in the banded noise region, and R(i,j) represents the mean-residual value of the i-th row and j-th column. This represents the average residual value in column j. The average residual values ​​of all columns form the average residual texture template. The template obtained by averaging multiple rows of residuals can reduce the impact of random noise.

[0095] It's important to note that residual texture templates can be used not only to adjust virtual reference rows but also for pixel repair within noisy areas. After obtaining the theoretical row mean for each row in the noisy region, combining it with the average residual texture template yields the theoretical value for each pixel. This corrects the overall grayscale shift of the row while preserving texture details within the row, preventing overly smooth lines after repair. Compared to directly replacing the row mean, adding residual textures results in a more natural repair with smoother transitions to surrounding normal rows.

[0096] It should be noted that the parameters mentioned above in this application are merely illustrative and are not intended to limit the scope of this application.

[0097] Another aspect of this application discloses a flat-field calibration system, including an optical lens, an image sensor, and a digital processing unit. The image sensor is used to generate an image to be repaired through the optical lens, and the digital processing unit is configured to perform the method described in this embodiment.

[0098] The principle of the system in this application is similar to the method described above. For specific embodiments of the system in this application, please refer to the specific implementation of the method. This application will not elaborate on these embodiments.

[0099] Those skilled in the art will understand that the above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for restoring banded noise in an image using flat-field calibration, characterized in that, include: Acquire the image to be repaired obtained by photographing an integrating sphere light source; Based on the grayscale value of each row of pixels in the image to be repaired, determine whether there is at least one banded noise region in the image to be repaired; If present, two reference regions containing a preset number of reference rows of pixels are identified on both sides of the strip noise region. Based on the pixel values ​​of the pixels in the two reference regions, the theoretical values ​​of each row of pixels in the strip noise region are obtained through polynomial fitting. Based on the theoretical values ​​and the actual values ​​of each row of pixels in the strip noise region, the compensation values ​​of each row of pixels in the strip noise region are obtained. The flat field correction coefficient of the acquisition device is compensated by the compensation values, and the flat field calibration coefficient after strip noise repair is output.

2. The method according to claim 1, characterized in that, The step of determining whether at least one banded noise region exists in the image to be repaired based on the grayscale value of each row of pixels in the image to be repaired includes: The average gray value of each row of pixels is calculated to obtain the row mean. The row mean values ​​are then arranged in order of row number to obtain the row mean value sequence. Determine the difference between the means of adjacent rows in the row mean sequence; If there are consecutive rows where the absolute value of the difference between the mean values ​​of adjacent rows is less than the mean threshold, and the mean difference between the starting and ending rows of the consecutive rows and the adjacent rows is greater than a set threshold, then the consecutive rows are determined to be the band noise region.

3. The method according to claim 1, characterized in that, The determination of the two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region includes: Obtain the first valid normal row on one side of the strip noise region and the second valid normal row on the other side; When the number of normal rows of both the first valid normal row and the second valid normal row is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference area, and the normal rows of the preset reference row number on the other side are taken as the second reference area. When one of the first valid normal rows and the second valid normal rows is less than the preset reference row number, and the other side is greater than or equal to the preset reference row number, a supplementary normal row is selected from the other side so that the sum of the normal row numbers of the first valid normal rows and the second valid normal rows is equal to twice the preset reference row number.

4. The method according to claim 1, characterized in that, The determination of the two reference regions containing a preset number of reference rows of pixels on both sides of the strip noise region includes: Obtain the first valid normal row on one side of the strip noise region and the second valid normal row on the other side; When the number of normal rows of both the first valid normal row and the second valid normal row is not less than the preset reference row number, the normal rows of the preset reference row number on one side are taken as the first reference area, and the normal rows of the preset reference row number on the other side are taken as the second reference area. When at least one of the first valid normal rows and the second valid normal rows is less than the preset reference row number, a virtual reference row is generated on the side where the number of normal rows is less than the preset reference row number, and the virtual reference row and the real normal rows together constitute the reference area on the corresponding side.

5. The method according to claim 4, characterized in that, The step of generating a virtual reference row on the side where the normal row count is less than the preset reference row count includes: The row of pixels containing the center of the integrating sphere light source in the image to be repaired is taken as the axis of symmetry row; A virtual reference row is set at the position where the number of normal rows of the strip noise is less than the number of preset reference rows. For each virtual reference row to be generated, it is determined whether there is a mirror source row that is symmetrical to it and belongs to the normal row based on the symmetry axis row. If it exists, copy the pixel values ​​of the mirror source row to the virtual reference row.

6. The method according to claim 5, characterized in that, The method further includes: If no mirror source row exists, the normal row that is symmetrical about the symmetry axis of the strip noise region is taken as the mirror source row. The mirror source region formed by the mirror source row is mirrored, flipped, and then translated to the corresponding virtual reference row. The pixel values ​​of the mirror source row are then copied into the virtual reference row.

7. The method according to claim 6, characterized in that, The method further includes: The vertical gradient slope is estimated using the row mean of multiple normal rows within the mirror source region; The trend compensation amount is determined based on the vertical gradient slope, and then superimposed on each pixel value of the virtual reference row.

8. The method according to claim 6 or 7, characterized in that, After generating the virtual reference row, and before the polynomial fitting, the following is also included: Calculate the horizontal gradient template of pixels within the banded noise region or within the normal row adjacent to the virtual reference row; Calculate the horizontal gradient of the virtual reference row and determine the similarity between the horizontal gradient of the virtual reference row and the horizontal gradient template; When the similarity is lower than a preset similarity threshold, the pixel values ​​of the virtual reference row are adjusted or the weight corresponding to the row mean of the virtual reference row is reduced in the polynomial fitting.

9. The method according to claim 8, characterized in that, The adjustment of the pixel values ​​of the virtual reference row includes: Extract the mean-removed residuals from each row within the banded noise region, and average the mean-removed residuals column by column to obtain the average residual texture template; The pixel value of each pixel in the virtual reference row is replaced with the sum of the trend-compensated row mean of the virtual reference row and the average residual texture template.

10. A flat-field calibration system, comprising an optical lens, an image sensor, and a digital processing unit, characterized in that, The image sensor is used to generate an image to be repaired through the optical lens, and the digital processing unit is configured to perform the method according to any one of claims 1 to 9.