Flat field correction method and device for black and white area array industrial camera

By using a multi-frame method for dark and bright field calibration, combined with adaptive Gaussian filtering for noise reduction, the shortcomings of the flat field correction scheme for black and white area array industrial cameras are solved, and the imaging uniformity and stability in high-precision detection scenarios are improved.

CN122496629APending Publication Date: 2026-07-31BEIJING SMARTER EYE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING SMARTER EYE TECH CO LTD
Filing Date
2026-05-07
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

The existing flat field correction schemes for black and white area array industrial cameras suffer from insufficient inter-frame noise weighting, random noise amplification, lack of illumination consistency verification, lack of parameter adaptive optimization, and coarse methods for obtaining dark/bright field references, resulting in unsatisfactory imaging uniformity and stability in high-precision detection scenarios.

Method used

A multi-frame method is used for dark and bright field calibration. By obtaining the adaptive weights for dark and bright fields and combining them with spatial adaptive Gaussian filtering for noise reduction, the pixel-by-pixel correction gain is determined, and flat field correction is performed in stages.

Benefits of technology

It significantly improves imaging uniformity and correction robustness, making it suitable for high-precision detection scenarios and eliminating imaging grayscale distortion caused by lens vignetting, non-uniform pixel response, dark current, and uneven illumination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122496629A_ABST
    Figure CN122496629A_ABST
Patent Text Reader

Abstract

This invention discloses a flat-field calibration method and apparatus for a black-and-white area array industrial camera. The method includes: in a dark-field calibration stage, continuously acquiring multiple frames of dark-field images; for each frame of dark-field image, obtaining the corresponding dark-field adaptive weight and determining a dark-field reference map; in a bright-field calibration stage, continuously acquiring multiple frames of bright-field images; for each frame of bright-field image, obtaining the illumination uniformity variation coefficient of that frame; retaining valid frames whose illumination uniformity variation coefficient is less than a predetermined threshold; subtracting dark-field components from the valid frames; for each frame in the valid frames, determining the bright-field adaptive weight and determining a bright-field reference map; performing spatial adaptive Gaussian filtering on the bright-field reference map to obtain a denoised bright-field reference map; determining a pixel-by-pixel correction gain based on the bright-field reference map and the dark-field reference map; and multiplying the acquired original image after subtracting the dark-field reference gain with the pixel-by-pixel correction gain to obtain a corrected image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing, and more specifically, to a method and apparatus for flat field correction of a black-and-white area array industrial camera. Background Technology

[0002] Black-and-white area array CCD / CMOS industrial cameras are widely used in industrial online inspection due to their high dynamic range, low noise, and high stability. However, the following non-ideal factors commonly exist in actual imaging, all of which can lead to flat-field distortion (uneven grayscale distribution): 1. Lens optical vignetting: The light transmittance at the center of the field of view is higher than that at the edge, resulting in a decrease in light intensity with the center being brighter and the edges being darker. This is an inherent defect in the optical system. 2. Detector pixel response nonuniformity (PRNU): The photoelectric conversion gain of each photosensitive unit has inherent dispersion, resulting in inconsistent output grayscale under the same incident light flux. This is a fixed deviation caused by the sensor manufacturing process. 3. Dark current and fixed pattern noise (FPN): When there is no light, the sensor has a background output (dark current), and this output has spatial distribution characteristics. After the noise is read out by the superimposed circuit, it forms fixed pattern noise. 4. Non-uniform lighting and ambient stray light: The uneven distribution of luminous intensity of industrial surface light sources and the reflection of ambient stray light further amplify global and local grayscale deviations, exacerbating flat field distortion.

[0003] Therefore, flat-field correction is necessary to address the aforementioned flat-field distortion problem. Most related technologies employ a simple two-frame method for flat-field correction, but this method has significant drawbacks. For example, it lacks inter-frame noise weighting, suppression of random noise amplification, illumination consistency verification, and parameter adaptive optimization. Furthermore, the method for obtaining the dark / bright field reference is coarse, and its uniformity and stability are insufficient in high-precision detection scenarios. Summary of the Invention

[0004] The main objective of this invention is to disclose a planar correction method and apparatus for a black-and-white area array industrial camera, so as to at least solve the problems that the planar correction schemes in the related technologies have obvious defects, resulting in the inability to meet the requirements of uniformity and stability in high-precision detection scenarios.

[0005] According to one aspect of the present invention, a method for flat field correction of a black-and-white area array industrial camera is provided.

[0006] The flat field correction method for a black-and-white area array industrial camera according to the present invention includes: in the dark field calibration stage, continuously acquiring multiple frames of dark field images; for each frame of dark field image, obtaining the corresponding dark field adaptive weight; and determining a dark field reference map based on the aforementioned dark field adaptive weight and the aforementioned multiple frames of dark field images. During the brightness field calibration phase, multiple frames of brightness field images are continuously acquired. For each frame, the illumination uniformity variation coefficient is obtained. Valid frames with illumination uniformity variation coefficients less than a predetermined threshold are retained. Dark field components are subtracted from these valid frames. For each of the valid frames, a brightness field adaptive weight is determined. Based on the brightness field adaptive weight and the valid frames with subtracted dark field components, a brightness field reference map is determined. ; Regarding the above brightness field reference map Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. According to the brightness field reference map Dark Field Baseline The pixel-by-pixel correction gain is determined, and the original image is multiplied by the pixel-by-pixel correction gain after subtracting the dark field reference to obtain the corrected image.

[0007] During the dark field calibration phase, multiple frames of dark field images are continuously acquired. For each frame of dark field image, the corresponding dark field adaptive weights are obtained, including: completely closing the lens aperture or performing full light blocking on the lens, and continuously acquiring multiple frames of dark field images; for each frame of dark field image, the global grayscale mean of the dark field of that frame is obtained, and the dark field grayscale variance of that frame is determined based on the global grayscale mean of the dark field; the corresponding dark field adaptive weights are obtained based on the dark field grayscale variance of that frame.

[0008] The mean global grayscale value of the dark field in the k-th frame is obtained using the following method. : ; The variance of the dark field grayscale of the k-th frame is determined as follows: : ; The adaptive weights for the dark field corresponding to the k-th frame are obtained using the following method. : ; in, , The image pixel position coordinates are Image width ,high .

[0009] Based on the aforementioned adaptive weights and the aforementioned multi-frame dark field images, a dark field reference map is determined. include: The dark field reference map is determined using the following method. :

[0010] in, Indicates continuous data collection Frame dark field image, The dark field adaptive weights are the corresponding weights for the current i-th frame.

[0011] During the brightness field calibration phase, multiple frames of brightness field images are continuously acquired. For each frame, the coefficient of variation of illumination uniformity is obtained, including: restoring the camera's working aperture, covering the camera's field of view with standard white balance paper or diffuse standard gray card, adjusting the position and intensity of the surface light source, and continuously acquiring multiple frames of brightness field images while ensuring uniform illumination. For each frame, the brightness field mean value is obtained, and the brightness field grayscale variance of the frame is determined based on the brightness field mean value. The coefficient of variation of illumination uniformity for the frame is calculated based on the brightness field grayscale variance and the brightness field mean value.

[0012] The average brightness value of the k-th frame is obtained using the following method. : ; The variance of the bright field grayscale of the k-th frame is determined as follows: : ; The coefficient of variation of illumination uniformity for this frame was calculated using the following method. : ; in, The image pixel position coordinates are Image width ,high .

[0013] Dark field components are subtracted from the above valid frames. For each of the above valid frames, a brightness field adaptive weight is determined. A brightness field reference map is determined based on the above brightness field adaptive weight and the above valid frames with subtracted dark field components. include: The bright field image of the k-th frame is processed in the following way. Perform dark field component subtraction: ; The brightness field adaptive weights of the k-th frame are determined as follows: : ; The brightness field reference map is determined using the following method. : ; in, The number of valid frames mentioned above. Let V be the grayscale variance of the bright field in the k-th frame. For the bright field image of the k-th frame The bright field image of the k-th frame after subtracting the dark field component. The reflectance is that of a standard gray board.

[0014] For the above brightness field reference map Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. include: The gradient magnitude is calculated as follows: : ; ; ; in, For Sobel convolution kernels, , The bright field reference image is in , Gray-scale gradient in direction; Adjust the adaptive filter variance in the following ways : ; in, This is the default minimum filter variance. The default maximum filter variance. Gradient threshold; The above brightness field reference image is analyzed in the following way. Perform spatial adaptive Gaussian filtering for noise reduction: ; in, It is a two-dimensional Gaussian filter kernel with adaptive variance.

[0015] According to the brightness reference map Dark Field Baseline The pixel-by-pixel correction gain is determined by subtracting the dark field reference from the acquired original image and multiplying it by the aforementioned pixel-by-pixel correction gain to obtain the corrected image, which includes: The pixel-by-pixel correction gain is calculated as follows: : ,in, The target is a uniform grayscale value; The corrected image is obtained in the following manner. : ,in, The original image that was captured; The above-obtained corrected image is processed in the following manner. Perform grayscale cropping: .

[0016] According to another aspect of the present invention, a flat field correction device for a black-and-white area array industrial camera is provided.

[0017] The flat field correction device for a black-and-white area array industrial camera according to the present invention includes: a dark field calibration module, used to continuously acquire multiple frames of dark field images during the dark field calibration stage; for each frame of dark field image, to obtain the corresponding dark field adaptive weight; and to determine a dark field reference map based on the dark field adaptive weight and the multiple frames of dark field images. The brightness field calibration module is used to continuously acquire multiple frames of brightness field images during the brightness field calibration phase. For each frame, it obtains the illumination uniformity variation coefficient, retains valid frames whose illumination uniformity variation coefficient is less than a predetermined threshold, performs dark field component subtraction on these valid frames, determines the brightness field adaptive weight for each of the valid frames, and determines the brightness field reference map based on the brightness field adaptive weight and the valid frames with subtracted dark field components. The adaptive noise reduction module is used to process the aforementioned bright field reference image. Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. The flat field correction module is used to adjust the brightness field reference map. Dark Field Baseline The pixel-by-pixel correction gain is determined, and the original image is multiplied by the pixel-by-pixel correction gain after subtracting the dark field reference to obtain the corrected image.

[0018] The planar correction method and apparatus for black and white area array industrial cameras provided by this invention divides the planar correction process into several parts: dark field calibration, bright field calibration, adaptive noise reduction, and planar correction. Through multi-stage step-by-step correction, combined with innovative mathematical models and algorithms, it solves the problems that the planar correction schemes in related technologies have obvious defects, resulting in the inability to meet the requirements of uniformity and stability in high-precision detection scenarios. The technical solution provided by this application can significantly improve imaging uniformity and correction robustness while being compatible with conventional industrial operations. Attached Figure Description

[0019] To more clearly illustrate the embodiments of the present invention or the technical solutions in 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 merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.

[0020] Figure 1This is a flowchart of a planar correction method for a black-and-white area array industrial camera according to an embodiment of the present invention; Figure 2 This is a structural block diagram of a flat field correction device for a black-and-white area array industrial camera according to an embodiment of the present invention. Detailed Implementation

[0021] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. 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.

[0022] The specific implementation of the present invention will now be described in detail with reference to the accompanying drawings.

[0023] According to an embodiment of the present invention, a flat field correction method for a black-and-white area array industrial camera is provided.

[0024] Figure 1 This is a flowchart of a planar correction method for a black-and-white area array industrial camera according to an embodiment of the present invention, as follows: Figure 1 As shown, the planar correction method for this black-and-white area array industrial camera includes: Step S101: In the dark field calibration stage, multiple frames of dark field images are continuously acquired. For each frame of dark field image, the corresponding dark field adaptive weight is obtained. Based on the above dark field adaptive weight and the above multiple frames of dark field images, the dark field reference image is determined. ; Step S102: In the brightness field calibration stage, multiple frames of brightness field images are continuously acquired. For each frame of brightness field image, the illumination uniformity variation coefficient of that frame is obtained. Valid frames with illumination uniformity variation coefficients less than a predetermined threshold are retained. Dark field components are subtracted from the valid frames. For each of the valid frames, the brightness field adaptive weight of that frame is determined. Based on the brightness field adaptive weight and the valid frames with subtracted dark field components, a brightness field reference map is determined. ; Step S103: For the above brightness field reference map Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. ; Step S104: Based on the brightness field reference map Dark Field Baseline The pixel-by-pixel correction gain is determined, and the original image is multiplied by the pixel-by-pixel correction gain after subtracting the dark field reference to obtain the corrected image.

[0025] In related technologies, most flat field correction schemes adopt a simple two-frame method. However, this method has obvious defects. For example, it does not perform inter-frame noise weighting, does not suppress random noise amplification, does not perform illumination consistency verification, does not perform parameter adaptive optimization, and the dark field / bright field reference acquisition method is rough. In high-precision detection scenarios, the uniformity and stability do not meet the requirements. Figure 1 The flat field correction method for the black-and-white area array industrial camera shown divides the flat field correction process into several parts: dark field calibration, bright field calibration, adaptive noise reduction, and flat field correction. Through multi-stage step-by-step correction, combined with innovative mathematical models and algorithms, it solves the problems that the flat field correction schemes in related technologies have obvious defects, resulting in the inability to meet the requirements of uniformity and stability in high-precision detection scenarios. The technical solution provided in this application can significantly improve imaging uniformity and correction robustness while being compatible with routine industrial operations.

[0026] In step S101, during the dark field calibration stage, multiple frames of dark field images are continuously acquired. For each frame of dark field image, obtaining the corresponding dark field adaptive weights can further include: Step 1.1: Completely close the lens aperture or completely block the light from the lens, and continuously acquire multiple frames of dark field images; Step 1.2: For each frame of dark field image, obtain the global grayscale mean of the dark field of that frame, and determine the grayscale variance of the dark field of that frame based on the global grayscale mean of the dark field. Step 1.3: Obtain the corresponding dark field adaptive weights for the frame based on the dark field grayscale variance of the frame.

[0027] In step 1.2 above, the global grayscale mean of the dark field in the k-th frame can be obtained in the following way. : ; In step 1.2 above, the variance of the dark field grayscale of the k-th frame can be determined in the following way. : ; In step 1.3 above, the adaptive weights for the dark field corresponding to the k-th frame can be obtained in the following way. : ; in, , The image pixel position coordinates are Image width ,high .

[0028] In step S101 above, a dark field reference map is determined based on the adaptive weights and the multi-frame dark field images. It may further include: The dark field reference map is determined using the following method. :

[0029] in, Indicates continuous data collection Frame dark field image, The dark field adaptive weights are the corresponding weights for the current i-th frame.

[0030] During the optimized implementation process, in the dark field calibration stage, the lens aperture can be completely closed or the lens can be completely blocked (physically blocking all incident light). Under the same exposure time, gain, and ambient temperature conditions as the actual measurement, continuous data acquisition is performed. A frame of dark-field image, denoted as: ; (1) Calculate the first Global grayscale mean in the dark field of a frame: ; (2) Calculate the first Frame dark field grayscale variance (denominator is) (total variance of the entire frame)

[0031] The smaller the variance in the above formula, the smaller the deviation of the grayscale of each pixel in the frame from the mean, the weaker the noise and the higher the frame quality; the larger the variance, the more severe the instantaneous interference (such as power supply ripple, electromagnetic interference) the frame is, the stronger the noise and the lower the frame quality.

[0032] (3) Calculate the first Adaptive weighting for dark scenes in frames:

[0033] The weights are inversely proportional to the frame variance; the larger the weight, the stronger its contribution to the final baseline. Frames with high noise (high variance) have smaller weights and weaker contributions. The denominator is the sum of the weights of all frames, used for normalization to ensure that the sum of all weights is 1. If the variance of a frame exceeds a set threshold... If an abnormal frame is found, it will be directly removed to avoid polluting the baseline.

[0034] (4) Obtain the final dark field reference image:

[0035] For each pixel position , cross The frames are weighted and summed to obtain the true and stable background output estimate of the pixel under no-light conditions. Random noise from a single sample is suppressed, while the inherent spatial distribution of sensor dark current and fixed-pattern noise is preserved.

[0036] In step S102 above, during the brightness field calibration stage, multiple frames of brightness field images are continuously acquired. For each frame of brightness field image, obtaining the coefficient of variation of illumination uniformity for that frame can further include: Step 2.1: Restore the camera's working aperture, fill the camera's field of view with standard white balance paper or diffuse standard gray card, adjust the position and intensity of the surface light source, and continuously acquire multiple frames of bright field images while ensuring uniform illumination. Step 2.2: For each frame of bright field image, obtain the mean value of the bright field of that frame, and determine the grayscale variance of the bright field of that frame based on the mean value of the bright field. Step 2.3: Calculate the coefficient of variation of illumination uniformity of the frame based on the grayscale variance of the bright field and the mean value of the bright field of the frame.

[0037] In step 2.2 above, the average brightness value of the k-th frame is obtained in the following way. : ; In step 2.2 above, the brightness field grayscale variance of the k-th frame is determined in the following way. : ; In step 2.3 above, the coefficient of variation of the lighting uniformity of the frame is calculated in the following way. : ; in, The image pixel position coordinates are Image width ,high .

[0038] In step S102 above, dark field components are subtracted from the effective frames. For each of the effective frames, a brightness field adaptive weight is determined. A brightness field reference map is determined based on the brightness field adaptive weight and the effective frames with subtracted dark field components. include: The bright field image of the k-th frame is processed in the following way. Perform dark field component subtraction: ; The brightness field adaptive weights of the k-th frame are determined as follows: : ; The brightness field reference map is determined using the following method. : ; in, The number of valid frames mentioned above. Let V be the grayscale variance of the bright field in the k-th frame. For the bright field image of the k-th frame The bright field image of the k-th frame after subtracting the dark field component. The reflectance is that of a standard gray board.

[0039] During the optimized implementation process, the camera's working aperture can be restored (to match the actual aperture during testing), and standard white balance paper can be laid out throughout the camera's field of view. Alternatively, use a diffuse standard gray board to adjust the position and intensity of the surface light source to ensure uniform illumination (light intensity fluctuation ≤3%), and then collect the data. A frame of bright field image, denoted as:

[0040] Acquiring multiple frames of bright fields is to avoid interference from instantaneous fluctuations in illumination and random readout noise from the sensor, and to obtain the ideal output reference of the pixel under standard illumination, which is used to correct pixel response non-uniformity in subsequent applications.

[0041] (1) Calculate the first Frame brightness field average ; (2) Calculate the first Single-frame brightness field grayscale variance

[0042] Consistent with the logic of dark field variance, the variance here... It is used to quantitatively describe the uniformity of illumination and noise fluctuations in a single frame's bright field. The smaller the variance, the more uniform the illumination, the weaker the noise, and the higher the frame quality; the larger the variance, the more local deviations in illumination or noise interference, the lower the frame quality, and it cannot be used as an ideal bright field benchmark.

[0043] (3) Determine the first Frame illumination uniformity variation coefficient

[0044] The coefficient of variation for illumination uniformity is a normalized indicator of illumination uniformity, eliminating the influence of illumination intensity itself. A threshold is set. ,cycle Only valid frames that meet the requirements and are less than the threshold are retained (denoted as the number of valid frames). ), to remove abnormal frames with uneven lighting, and to avoid brightness field distortion caused by lighting deviation.

[0045] (4) Perform dark component subtraction on valid frames.

[0046] The above bright field image The grayscale output includes the "standard reflected light imaging component" and the "dark field background component". Therefore, the dark field reference is removed in order to remove the influence of dark current and fixed mode noise, and only retain the imaging component corresponding to the standard gray card reflected light, thus eliminating the correction deviation caused by the background noise.

[0047] (5) Calculate the first Frame brightness field adaptive weighting:

[0048] With dark field weight The computational logic remains consistent, with the core being the "optimal weighting" of bright-field frames. The weights are inversely proportional to the variance of the bright-field frames; frames with uniform illumination and low noise (small variance) receive higher weights. The larger the value, the stronger its contribution to the final bright field benchmark; bright field frames with uneven illumination and high noise (large variance) have lower weights. The smaller the value, the weaker the contribution. The denominator is the sum of the weights of all valid bright-field frames, used for normalization to ensure that the sum of all weights is 1.

[0049] (6) Perform weighted fusion and reflectivity normalization to calculate the brightness field reference:

[0050] Employs dedicated weights for bright fields Perform optimal weighting to suppress instantaneous fluctuations in noise and illumination; divide by the standard gray card reflectance. This is to normalize the bright field output to the ideal diffuse reflection (reflectivity = 1) condition.

[0051] In step S103, the above-mentioned brightness field reference map is... Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. It may further include: The gradient magnitude is calculated as follows: : ; ; ; in, For Sobel convolution kernels, , The bright field reference image is in , Gray-scale gradient in direction; Adjust the adaptive filter variance in the following ways : ; in, This is the default minimum filter variance. The default maximum filter variance. Gradient threshold; The above brightness field reference image is analyzed in the following way. Perform spatial adaptive Gaussian filtering for noise reduction: ; in, It is a two-dimensional Gaussian filter kernel with adaptive variance.

[0052] In the preferred implementation process, there is still a small amount of random noise in the bright field reference and the dark field reference. During the flat field correction process, the noise will be amplified by the correction coefficient, resulting in artifacts in the corrected image and affecting the detection accuracy. At the same time, it is necessary to preserve the edge details of the image. Therefore, spatial adaptive Gaussian filtering is used to balance noise reduction and edge preservation.

[0053] (1) Calculate the Sobel gradient:

[0054]

[0055]

[0056] in, For standard 3×3 Sobel convolution kernels ( :[-1,0,1;-2,0,2;-1,0,1], :[-1,-2,-1;0,0,0;1,2,1]). , The bright field reference image is in , The gray-level gradient in a given direction indicates the pixel's location. A larger gradient indicates the pixel is at an image edge (or in a region of abrupt change in gray level); a smaller gradient indicates the pixel is in a flat region. The gradient magnitude is used to determine the pixel's position. It can distinguish between image edges and flat areas, providing a basis for adaptive filtering; it uses standard convolution operations to accurately extract gradient features, avoiding feature loss in areas with abrupt changes in grayscale, and adapting to the needs of edge detection.

[0057] (2) Adjusting the variance of the adaptive filter

[0058] The variance of the filter determines the denoising strength of the Gaussian filter; the larger the variance, the stronger the denoising; the smaller the variance, the weaker the denoising, and the better the detail preservation. Minimum filter variance. Typically, a value of 0.5 to 1.0 is used for the maximum filter variance. Typically, a value of 2.0 to 3.0 is used. This is the gradient threshold (30% of the maximum gradient in the image). It is used to distinguish between edges and flat areas, balancing noise reduction and edge preservation.

[0059] (3) Gaussian filtering for noise reduction:

[0060] in, A two-dimensional Gaussian filter kernel with adaptive variance is used. The larger the adaptive variance value, the larger the filter kernel size. Convolution filtering is applied to the bright field reference to obtain the denoised bright field reference. This method suppresses random noise while preserving image edge details, providing a high-quality bright field reference for subsequent flat field correction.

[0061] In step S104, based on the brightness field reference map Dark Field Baseline Determining the pixel-by-pixel correction gain, and then multiplying the acquired original image by the aforementioned pixel-by-pixel correction gain to obtain the corrected image, can further include: The pixel-by-pixel correction gain is calculated as follows: : ,in, The target is a uniform grayscale value; The corrected image is obtained in the following manner. : ,in, The original image that was captured; The above-obtained corrected image is processed in the following manner. Perform grayscale cropping: .

[0062] In the preferred implementation process, the flat field correction mainly includes the following steps: (1) Calculate the flat field correction gain coefficient:

[0063] For pixel-by-pixel correction gain, The target uniform gray value is the ideal gray level that the corrected image needs to achieve.

[0064] (2) Flat field correction and grayscale cropping:

[0065]

[0066] In the first step of the correction formula, it is necessary to first subtract the dark field reference of the original image (to remove dark current and fixed pattern noise), and then multiply by the pixel-by-pixel correction gain. The first step is to obtain a corrected image. The second step, grayscale cropping, is to constrain the corrected grayscale values ​​within the standard range (0~255) of a black and white image, to avoid image distortion caused by grayscale overflow, and to ensure the normal display and subsequent detection of the corrected image.

[0067] According to an embodiment of the present invention, a flat field correction device for a black and white area array industrial camera is provided.

[0068] Figure 2 This is a structural block diagram of a flat-field correction device for a black-and-white area array industrial camera according to an embodiment of the present invention. Figure 2 As shown, the flat field correction device for the black and white area array industrial camera includes: a dark field calibration module 20, used to continuously acquire multiple frames of dark field images during the dark field calibration stage; for each frame of dark field image, to obtain the corresponding dark field adaptive weight; and to determine the dark field reference image based on the aforementioned dark field adaptive weight and the aforementioned multiple frames of dark field images. The brightness field calibration module 22 is used to continuously acquire multiple frames of brightness field images during the brightness field calibration stage. For each frame of brightness field image, the illumination uniformity variation coefficient of that frame is obtained. Valid frames with illumination uniformity variation coefficients less than a predetermined threshold are retained. Dark field components are subtracted from the valid frames. For each of the valid frames, a brightness field adaptive weight is determined. A brightness field reference map is determined based on the brightness field adaptive weight and the valid frames with subtracted dark field components. ; Noise reduction module 24, used for the above bright field reference map Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. ; Flat field correction module 26, used to adjust the brightness field reference map Dark Field Baseline The pixel-by-pixel correction gain is determined, and the original image is multiplied by the pixel-by-pixel correction gain after subtracting the dark field reference to obtain the corrected image.

[0069] Figure 2The flat field correction device for the black-and-white area array industrial camera shown includes several parts: a dark field calibration module, a bright field calibration module, an adaptive noise reduction module, and a flat field correction module. Through multi-stage step-by-step correction of each module, combined with innovative mathematical models and algorithms, it solves the problems that the flat field correction schemes in related technologies have obvious defects, resulting in the inability to meet the requirements of uniformity and stability in high-precision detection scenarios. The technical solution provided in this application can significantly improve imaging uniformity and correction robustness while being compatible with conventional industrial operations.

[0070] It should be noted that the flat-field correction device for the aforementioned black-and-white area array industrial camera can be found in the corresponding documentation. Figure 1 The relevant descriptions and effects in the illustrated embodiments are for understanding purposes only and will not be repeated here.

[0071] In summary, the above embodiments provided by this invention offer a flat-field correction scheme for a black-and-white area array industrial camera. This scheme comprises several parts: dark-field calibration, bright-field calibration, adaptive noise reduction, and flat-field correction. Through multi-stage step-by-step correction, combined with innovative mathematical models and algorithms, the technical solution provided in this application can significantly improve imaging uniformity and correction robustness. It is suitable for high-precision machine vision inspection, dimensional measurement, surface defect identification, and other scenarios, eliminating imaging grayscale distortion caused by lens vignetting, non-uniform pixel response, dark current, and uneven illumination. It is compatible with conventional industrial operations such as "closing the aperture for dark-field correction and using white balance paper for bright-field correction," demonstrating strong engineering feasibility.

[0072] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method of flat field correction for a monochrome area array industrial camera, characterized by, include: In the dark field calibration phase, a plurality of dark field images are continuously acquired, for each dark field image, a corresponding dark field adaptive weight of the dark field image is obtained, and a dark field reference image is determined based on the dark field adaptive weight and the plurality of dark field images ; In the bright field calibration phase, a plurality of frames of bright field images are continuously acquired, for each frame of bright field image, a frame illumination uniformity variation coefficient is obtained, valid frames with the illumination uniformity variation coefficient less than a predetermined threshold are retained, dark field component deduction is performed on the valid frames, for each frame of the valid frames, a bright field adaptive weight of the frame is determined, and a bright field reference image is determined based on the bright field adaptive weight and the valid frames after the dark field component deduction ​ For the aforementioned brightness field reference map Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. ; According to the brightness reference map Dark Field Baseline The pixel-by-pixel correction gain is determined, and the original image is multiplied by the pixel-by-pixel correction gain after subtracting the dark field reference to obtain the corrected image.

2. The method according to claim 1, characterized in that, During the dark field calibration phase, multiple frames of dark field images are continuously acquired. For each frame of dark field image, the corresponding dark field adaptive weights are obtained, including: Completely close the lens aperture or completely block the lens from light to continuously capture multiple frames of dark-field images; For each dark-field image, obtain the global grayscale mean of the dark field of that frame, and determine the dark-field grayscale variance of that frame based on the global grayscale mean of the dark field. Obtain the corresponding dark field adaptive weights for the frame based on the dark field grayscale variance of the frame.

3. The method according to claim 2, characterized in that, The mean global grayscale value of the dark field in the k-th frame is obtained using the following method. : ; The variance of the dark field grayscale of the k-th frame is determined as follows: : ; The adaptive weights for the dark field corresponding to the k-th frame are obtained using the following method. : ; in, , The image pixel position coordinates are Image width ,high .

4. The method according to claim 1, characterized in that, Based on the adaptive weights and the multi-frame dark field images, a dark field reference map is determined. include: The dark field reference map is determined using the following method. : ; in, Indicates continuous data collection Frame dark field image, The dark field adaptive weights are the corresponding weights for the current i-th frame.

5. The method according to claim 1, characterized in that, During the brightness field calibration phase, multiple frames of brightness field images are continuously acquired. For each frame of brightness field image, the coefficient of variation of illumination uniformity for that frame is obtained, including: Restore the camera's working aperture, fill the camera's field of view with standard white balance paper or diffuse standard gray card, adjust the position and intensity of the surface light source, and continuously acquire multiple frames of bright field images while ensuring uniform illumination. For each frame of bright field image, the mean value of the bright field of that frame is obtained, and the grayscale variance of the bright field of that frame is determined based on the mean value of the bright field. The coefficient of variation of illumination uniformity of the frame is calculated based on the grayscale variance of the bright field and the mean of the bright field of the frame.

6. The method according to claim 5, characterized in that, The average brightness value of the k-th frame is obtained using the following method. : ; The variance of the bright field grayscale of the k-th frame is determined as follows: : ; The coefficient of variation of illumination uniformity for this frame was calculated using the following method. : ; in, The image pixel position coordinates are Image width ,high .

7. The method according to claim 1, characterized in that, Dark field components are subtracted from the valid frames. For each frame in the valid frames, a brightness field adaptive weight is determined. A brightness field reference map is determined based on the brightness field adaptive weight and the valid frames with subtracted dark field components. include: The bright field image of the k-th frame is processed in the following way. Perform dark field component subtraction: ; The brightness field adaptive weights of the k-th frame are determined as follows: : ; The brightness field reference map is determined using the following method. : ; in, The number of frames in the valid frames. Let V be the grayscale variance of the bright field in the k-th frame. For the bright field image of the k-th frame Image after removing the dark field component The reflectance is that of a standard gray board.

8. The method according to claim 1, characterized in that, For the aforementioned brightness field reference map Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. include: The gradient magnitude is calculated as follows: : ; ; ; in, For Sobel convolution kernels, , The bright field reference image is in , Gray-scale gradient in direction; Adjust the adaptive filter variance in the following ways : ; in, This is the default minimum filter variance. The default maximum filter variance. Gradient threshold; The brightness field reference image is analyzed in the following manner. Perform spatial adaptive Gaussian filtering for noise reduction: ; in, It is a two-dimensional Gaussian filter kernel with adaptive variance.

9. The method according to claim 1, characterized in that, According to the brightness reference map Dark Field Baseline Determine the pixel-wise correction gain, and multiply the acquired original image by the pixel-wise correction gain after subtracting the dark field reference to obtain the corrected image, including: The pixel-by-pixel correction gain is calculated as follows: : ,in, The target is a uniform grayscale value; The corrected image is obtained in the following manner. : ,in, The original image that was captured; The obtained corrected image is processed in the following manner. Perform grayscale cropping: 。 10. A planar correction device for a black-and-white area array industrial camera, characterized in that, include: The dark field calibration module is used to continuously acquire multiple frames of dark field images during the dark field calibration phase. For each frame of dark field image, it obtains the corresponding dark field adaptive weights and determines the dark field reference image based on the dark field adaptive weights and the multiple frames of dark field images. ; The brightness field calibration module is used to continuously acquire multiple frames of brightness field images during the brightness field calibration phase. For each frame, it obtains the illumination uniformity variation coefficient, retains valid frames whose illumination uniformity variation coefficient is less than a predetermined threshold, performs dark field component subtraction on the valid frames, determines the brightness field adaptive weight for each frame in the valid frames, and determines the brightness field reference map based on the brightness field adaptive weight and the valid frames after dark field component subtraction. ; An adaptive noise reduction module is used to process the brightness field reference image. Spatial adaptive Gaussian filtering is performed for denoising to obtain the denoised brightness field reference image. ; The flat field correction module is used to adjust the brightness field reference map. Dark Field Baseline The pixel-by-pixel correction gain is determined, and the original image is multiplied by the pixel-by-pixel correction gain after subtracting the dark field reference to obtain the corrected image.