A method, device, medium and product for correcting image redness

By using interference filters with preset bandwidth and differential processing technology, combined with HSV color space segmentation and image restoration methods, the problem of red light retention in high-transmittance dual IR filter schemes was solved, achieving efficient image redness correction and improving the accuracy and visual experience of face recognition.

CN122453679APending Publication Date: 2026-07-24SHANGHAI GUANGFANG XUNSHI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI GUANGFANG XUNSHI INTELLIGENT TECH CO LTD
Filing Date
2026-05-06
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In existing technologies, high-transmittance dual-IR film solutions cannot effectively suppress infrared light components in ambient light that are the same as or similar to the target wavelength in face recognition applications, resulting in severe red light residue, which affects image color correction and recognition accuracy.

Method used

The optical signal is received by an interference filter with a preset bandwidth, captured by a photoelectric sensor and differentially processed, converted to the HSV color space for segmentation and compensation correction, and combined with inverse distance weighted averaging and temporal median filtering to accurately separate the target signal and environmental noise for image restoration.

Benefits of technology

It effectively eliminates red light residue, restores the integrity and visual continuity of the image, improves the color purity and recognition accuracy of the image, and ensures the clarity and detail fidelity of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122453679A_ABST
    Figure CN122453679A_ABST
Patent Text Reader

Abstract

The application provides an image redness correction method, device, medium and product, and relates to the technical field of electric digital data processing.The method comprises the following steps: receiving a first waveband light signal and a second waveband light signal reflected by an identification object through a preset bandwidth interference filter; capturing the spatial light intensity distribution of the first waveband light signal and the second waveband light signal through a photoelectric sensor, obtaining a first original light intensity distribution matrix and a second original light intensity distribution matrix, and performing differential processing to obtain a light intensity spatial distribution graph. Then, the light intensity spatial distribution graph is converted to an HSV color space to generate a first HSV image, the first HSV image is divided into a plurality of first target regions and first interference regions according to a target HSV range. Finally, each first interference region is compensated and corrected to generate a first corrected image. The scheme solves the technical problem that the red light residue is serious in image recognition in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic digital data processing technology, specifically to an image reddish correction method, device, medium, and product. Background Technology

[0002] In the field of intelligent security, especially in facial recognition applications, imaging modules generally need to balance daytime color imaging and nighttime infrared (IR) monitoring capabilities. Current technical solutions face a core contradiction: while traditional mechanical IR-CUT switching mechanisms can ensure imaging quality under different lighting conditions, their physical structure results in bulky modules and poor reliability, contradicting the trend of device miniaturization; on the other hand, the fixed filter solution used to achieve miniaturization can cause severe reddish color distortion in daytime images due to improper processing of infrared light, directly affecting the accuracy of facial recognition and the visual experience.

[0003] To address the size and reliability issues associated with mechanical structures, a widely adopted "high-transmittance dual-IR filter scheme" (or dual-pass filter scheme) has been proposed in existing technologies. This scheme uses one or more fixed filters with special coating designs to maintain high transmittance across the entire visible light spectrum and a specific near-infrared operating band. This eliminates the need for any mechanical switching components; a single image sensor can receive visible light signals during the day and operate in conjunction with infrared lights at night, significantly reducing the physical size of the module and eliminating the risk of mechanical failure.

[0004] However, while the high-transmittance dual-IR filter solution cleverly solves the problem of device miniaturization, although it improves adaptability to the target infrared band, its fixed filtering characteristics mean it cannot effectively suppress infrared light components in ambient light that are the same as or similar to the target band. This results in severe red light retention. Ultimately, this leads to unstable color correction, seriously affecting the accuracy of facial recognition and user experience, constituting a bottleneck that this technology approach is difficult to overcome. Summary of the Invention

[0005] To address the technical problem of severe red light retention in existing image recognition technologies, this application provides an image red-light correction method, device, medium, and product.

[0006] In a first aspect, this application provides a method for correcting reddish tint in images, including: The first band light signal and the second band light signal reflected by the object to be identified are received through an interference filter with a preset bandwidth. The first band light signal represents the light signal reflected by the object to be identified when a modulated light source of a preset frequency is turned on to emit a light signal of the preset band to the object to be identified. The first band light signal includes the light signal of the preset band and the ambient light signal. The second band light signal represents the light signal reflected by the object to be identified when the modulated light source is turned off. The spatial light intensity distribution of the first band optical signal and the second band optical signal is captured by a photoelectric sensor to obtain the first original light intensity distribution matrix of the first band optical signal and the second original light intensity distribution matrix of the second band optical signal. The first original light intensity distribution matrix and the second original light intensity distribution matrix are then subjected to differential processing to obtain a light intensity spatial distribution map. The light intensity spatial distribution map is converted to the HSV color space to generate a first HSV image; Based on the target HSV range, the first HSV image is divided into several first target regions and several first interference regions, wherein the target HSV range represents the HSV range corresponding to the preset band. Each of the first interference regions is compensated and corrected to generate a first corrected image.

[0007] This solution creatively applies the lock-in amplification (or synchronous detection) principle from signal processing to image acquisition. By employing a known light source with active temporal modulation and performing synchronous differential demodulation (i.e., image differential processing) at the receiving end, it achieves precise separation of the target reflection signal from complex ambient light noise at the physical acquisition level. To further eliminate any non-ideal residuals and noise that may exist after differential processing, this invention then converts the pure light intensity image to the HSV color space, which is insensitive to changes in illumination. Leveraging the stable and concentrated color characteristics of the target light source in the HSV space, the target HSV range is precisely defined. Based on this range, the method can accurately segment the image, clearly distinguishing the target region that conforms to the characteristics from the interference regions that do not (i.e., residual color distortion points). Finally, by performing compensation correction on these precisely locked interference regions, it ensures that while eliminating all abnormal color points, the integrity and visual continuity of the image are restored.

[0008] Optionally, the step of segmenting the first HSV image into several first target regions and several first interference regions according to the target HSV range specifically includes: A mask is created based on the target HSV range. The mask is a binary image in which the value of the first target region is 1 and the value of the first interference region is 0. The first interference region and the first target region in the light intensity spatial distribution map are marked according to the mask.

[0009] This solution, through its specific segmentation method of "creating a mask based on the target HSV range," provides an efficient and precise technical path for eliminating residual color interference that may exist after differential processing, thereby further consolidating the solution to the "red light residue" problem. Even after significantly eliminating red light interference through differential processing, tiny, isolated color anomalies caused by non-ideal factors may still exist in the image. This invention leverages the stable and predictable characteristics of the target light source in the HSV color space, transforming the complex pixel classification problem into a one-time, deterministic matrix operation by creating a binary mask. This not only improves the computational efficiency of identifying and locating these residual interference regions, but more importantly, it ensures that pixels that do not conform to the target color characteristics (i.e., residual red light interference points) are all marked without omission, while avoiding incorrect marking of normal pixel areas. This segmentation ensures the targeting and thoroughness of the correction process, further improving the color purity of the final image.

[0010] Optionally, the step of compensating and correcting each of the first interference regions to generate a first corrected image specifically includes: The target interference region is any one of the first interference regions. The following steps are performed on the target interference region to obtain the first corrected image: Obtain the pixel values ​​of the first target region adjacent to the target interference region; The pixel values ​​of the target interference region are replaced with the average pixel values ​​of the first target region adjacent to the target interference region to obtain the compensated target interference region. Histogram equalization is performed on the compensated target interference region to obtain the first corrected image.

[0011] This solution effectively addresses the technical challenge of seamless image restoration after removing "red light residue" pixels. After identifying the interference area representing red light residue, this invention proposes replacing it with the average pixel value of its adjacent, color-accurate first target area. This method is based on the fundamental principle of local continuity in image signals, ensuring that the fill value maintains consistency in brightness and hue with the surrounding area, thus avoiding visually impactful black holes or the introduction of new color banding caused by directly deleting interference points. Subsequently, histogram equalization is performed on the compensated area, further resolving the problem of flat texture and lack of detail that may result from simple mean filling. By expanding the grayscale dynamic range of the filled area, a natural texture is visually restored. Therefore, this method not only thoroughly removes residual red light interference signals but also ensures the integrity, smoothness, and visual realism of the final output image through content-adaptive restoration, resulting in a more perfect correction effect.

[0012] Optionally, the step of replacing the pixel values ​​of the target interference region with the average pixel values ​​of the first target region adjacent to the target interference region to obtain the compensated target interference region specifically includes: The pixel to be compensated is any pixel in the target interference region. For the pixel to be compensated, the following steps are performed to obtain the compensated target interference region: Identify all reference pixels belonging to the first target region that are adjacent to the target interference region; Calculate the distance from each of the reference pixels to the pixel to be compensated; The pixel values ​​of each reference pixel are weighted according to the reciprocal of the distance, and a weighted average value is calculated. The weighted average value is used to replace the pixel value of the pixel to be compensated to obtain the compensated target interference region.

[0013] This solution refines the pixel replacement method into an inverse distance-weighted average, thereby restoring the "red light residue" area with higher fidelity and maximizing the restoration of the original image details. Simple mean replacement treats all adjacent pixels equally, which may result in slight blurring or blockiness at the edges of the repaired area. This invention introduces inverse distance weighting, following the physical law that closer pixels have stronger correlations in spatial correlation, giving more weight to effective pixels closer to the point to be compensated when calculating new pixel values. This interpolation method can more accurately estimate the original true values ​​of pixels covered by red light interference, resulting in a smoother transition between the repaired area and the surrounding normal area. Ultimately, it completely eliminates the red light residue problem while minimizing damage to the image's micro-texture during the repair process.

[0014] Optionally, the light intensity spatial distribution map includes spatial distribution maps corresponding to each of the consecutive image frames, and the method further includes: The image sequence is subjected to temporal median filtering, and the image sequence after temporal median filtering is fused to generate an enhanced light intensity spatial distribution map; The enhanced light intensity spatial distribution map is converted to the HSV color space to generate a second HSV image; Based on the target HSV range, the second HSV image is segmented into several second target regions and several second interference regions; The second interference region is compensated and corrected to generate a second corrected image.

[0015] This solution introduces temporal processing of image sequences to address noise with transient random characteristics that may not be completely filtered out by a single differential sampling, thereby further improving the suppression of "red light residue" artifacts. Although a single-frame light intensity spatial distribution map eliminates constant ambient light interference, it may still contain random high-frequency noise points introduced by factors such as sensor thermal noise or photon shot noise. These noise points may appear visually as isolated, flickering abnormal color points, interfering with subsequent accurate segmentation. This invention utilizes temporal median filtering on a continuous multi-frame image sequence, taking advantage of the discontinuity of random noise in the time dimension, to effectively remove these instantaneous noise pulses as outliers. Subsequently, the filtered image sequences are fused, and the residual random fluctuations are further smoothed out through averaging, thereby generating an enhanced light intensity spatial distribution map with high signal-to-noise ratio and stable signal.

[0016] Optionally, the step of performing temporal median filtering on the image sequence and fusing the temporally median-filtered image sequence to generate an enhanced light intensity spatial distribution map specifically includes: The light intensity spatial distribution map of any frame in the image sequence is selected as a reference frame image; For any frame image to be aligned in the image sequence, perform the following operations: In the reference frame image and the current frame image to be aligned, key feature points are detected and feature descriptors are generated using the scale-invariant feature transform algorithm, respectively. Based on the feature descriptor, feature point matching is performed between the reference frame image and the current frame image to be aligned, and mismatched feature point matching pairs are eliminated to obtain the correct feature point matching relationship; Based on the correct feature point matching relationship, calculate the affine transformation matrix that transforms the current frame image to be aligned to the coordinate system of the reference frame image; The transformation matrix is ​​applied to the current frame image to be aligned to generate an aligned image that is aligned with the reference frame image. The image sequence includes the aligned image and the reference frame image. The image sequence is subjected to temporal median filtering, and the image sequences after temporal median filtering are fused to generate an enhanced light intensity spatial distribution map.

[0017] This solution addresses the technical challenge of temporal filtering failure or the introduction of severe artifacts due to displacement of the subject or device in practical applications. In real-world scenarios, slight jitter or target movement is unavoidable. Directly filtering or fusing unaligned sequences results in severe motion blur and ghosting, failing to eliminate noise and even damaging image structure. This invention employs the Scale Invariant Feature Transform (SIFT) algorithm for feature point detection and matching, and calculates an affine transformation matrix to align each frame, providing a precise motion compensation mechanism. This method accurately transforms all frames to a unified reference coordinate system, ensuring that pixels at the same spatial location correspond to the same point in the scene during temporal filtering. This allows temporal median filtering and fusing techniques to effectively reduce noise in dynamic scenes without introducing destructive motion artifacts, guaranteeing the clarity and accuracy of the enhanced light intensity spatial distribution map.

[0018] Optionally, after the step of compensating and correcting each of the first interference regions to generate a first corrected image, the method further includes: The first corrected image is subjected to guided filtering to obtain the third corrected image; The third corrected image is subjected to nonlocal mean denoising to obtain the fourth corrected image; Adaptive gamma correction is performed on the fourth corrected image to obtain the final corrected image.

[0019] This solution comprehensively enhances the image quality and optimizes details of a corrected image that has largely eliminated "red light residue." First, guided filtering, leveraging its excellent edge-preserving properties, smooths the compensated area, blending it more naturally with its surroundings while effectively protecting the original edge and contour information of the image, preventing image quality degradation. Next, non-local mean denoising is employed to suppress subtle random noise in the image more deeply, while preserving texture details to the maximum extent. Finally, adaptive gamma correction intelligently adjusts the overall contrast and brightness of the image, revealing details in dark areas without overexposure in bright areas. This series of combined post-processing operations elevates an image that only addresses the core color cast problem into a clear, sharp, detailed, and tonally balanced final product.

[0020] In a second aspect, embodiments of this application provide an image reddish correction device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, which includes computer instructions, and the one or more processors call the computer instructions to cause the image reddish correction device to perform the method described in the first aspect and any possible implementation thereof.

[0021] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on an image redness correction device, cause the image redness correction device to perform the method described in the first aspect and any possible implementation thereof.

[0022] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on an image red-contrast correction device, cause the image red-contrast correction device to perform the method described in the first aspect and any possible implementation thereof. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating an image reddish correction method in an embodiment of this application; Figure 2 This is a schematic diagram of an interference filter structure with a preset bandwidth in an embodiment of this application; Figure 3 This is another schematic flowchart of the image reddish correction method in the embodiments of this application; Figure 4 This is a schematic diagram of the physical device structure of an image reddish correction device in the embodiments of this application. Detailed Implementation

[0024] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0025] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0026] In the description of the embodiments of this application, the term "multiple" means two or more. Furthermore, the terms "first," "second," "third," and "fourth" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined as "first," "second," "third," or "fourth" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0027] This application provides a method for correcting reddish tint in images, referencing... Figure 1 , Figure 1 This is a flowchart of an image reddish correction method provided in an embodiment of this application. The method includes: Step S101: Receive the first band optical signal and the second band optical signal reflected by the object to be identified through an interference filter with a preset bandwidth; The "preset bandwidth interference filter" refers to a precision optical element that, through the interference effect of an optical thin film, allows only light waves with a specific width (i.e., bandwidth) near a specific center wavelength to pass through, while efficiently reflecting or absorbing light of other wavelengths. This is used to filter out light signals of the target wavelength band from a complex lighting environment. The "identified object" refers to the target object or scene whose image information this method aims to acquire, such as a face in a face recognition application. The "first-band light signal" refers to the mixed light signal that reaches the sensor after being reflected by the identified object and passing through the interference filter when the modulation light source is turned on. Physically, this signal is the superposition of the reflected light from the target modulation light source and the ambient light light signal within the filter's passband. The "second-band light signal" refers to the light signal that reaches the sensor after being reflected by the identified object and passing through the interference filter when the modulation light source is turned off. Physically, this signal only contains the ambient light light signal within the filter's passband. "A modulated light source with a preset frequency" refers to a light source whose luminous intensity is not constant, but rather changes periodically in or out at a known, stable frequency, such as an 850-nanometer infrared LED array that flashes at 100 Hz. "A light signal with a preset wavelength" refers to the light signal emitted by the modulated light source whose spectrum is concentrated within the passband of the interference filter. "Ambient light signal" refers to all other light source signals present in the scene besides the modulated light source, such as sunlight and indoor lighting; the portion of this light within the filter passband is the main source of reddish interference in the image.

[0028] Specifically, this step is executed in the initial stage of image acquisition, and its core application scenario is to acquire high-fidelity images under conditions of strong ambient light interference (especially infrared light overlapping with the target light source band). This step is executed in two consecutive and rapid exposure processes. First, the system controls the activation of a modulated light source with a preset frequency (e.g., an 850nm infrared LED) and triggers the photoelectric sensor for the first exposure. In this extremely short time, the "first band light signal" received by the sensor is the sum of the 850nm modulated infrared light reflected from the target face and the infrared light from sunlight that has also passed through the 850nm interference filter. Immediately afterwards, the system controls the modulation light source to turn off and immediately triggers the sensor for the second exposure. At this time, the "second band light signal" received by the sensor is only the portion of the 850nm infrared light reflected from the target face, originating from sunlight. By actively controlling the on / off state of the light source and performing two rapid samplings, this step creates crucial data acquisition conditions for the subsequent precise separation of the pure target reflected light signal and the interfering ambient light signal through differential calculations.

[0029] refer to Figure 2 , Figure 2 A schematic diagram of an interference filter structure with a preset bandwidth is provided for this solution; Table 1 shows the composition categories of interference filters with preset bandwidth. Table 1 Table 2 shows the coating sequence of the interference filter with preset bandwidth and the thickness of each layer. Table 2 Step S102: Capture the spatial light intensity distribution of the first band optical signal and the second band optical signal using a photoelectric sensor to obtain the first original light intensity distribution matrix of the first band optical signal and the second original light intensity distribution matrix of the second band optical signal, and perform differential processing on the first original light intensity distribution matrix and the second original light intensity distribution matrix to obtain a light intensity spatial distribution map. In this context, "photoelectric sensor" refers to a semiconductor device that converts light signals into electrical signals. In digital imaging systems, it typically refers to a CMOS or CCD image sensor, which transforms the light intensity distribution map focused on its photosensitive array into digitized image data. "Spatial light intensity distribution" represents the intensity distribution of light at different spatial locations on the imaging plane, specifically manifested as the brightness or grayscale value of each pixel in a digital image. The "first original light intensity distribution matrix" and "second original light intensity distribution matrix" are two digital arrays generated by the photoelectric sensor after capturing light signals in the first and second wavelength bands, respectively. Each element in the matrix corresponds to the light intensity recorded by a photosensitive unit on the sensor. These two matrices represent the original digital images obtained from two exposures. "Differential processing" refers to a mathematical operation that subtracts corresponding elements from two or more datasets (here, the image matrix) to eliminate commonalities and highlight differences. The "spatial light intensity distribution map" is the final matrix obtained after performing differential processing on the first and second original light intensity distribution matrices. The image represented by this matrix theoretically contains only signal intensity information generated by the modulated light source.

[0030] Specifically, this step follows immediately after step S101. Its purpose is to accurately extract the pure target reflected light signal from the two sets of mixed signals acquired in S101 at the data processing level. This step is executed after obtaining the first and second original light intensity distribution matrices. The photoelectric sensor converts the two optical samples in S101 into two digital matrices of the same size (e.g., 1920x1080 pixels). Since the value M1(i,j) of the first original light intensity distribution matrix (denoted as M1) obtained in the first exposure can be represented as "target light intensity (i,j) + ambient light intensity (i,j)" at each pixel point (i,j), and the value M2(i,j) of the second original light intensity distribution matrix (denoted as M2) obtained in the second exposure can be represented as "ambient light intensity (i,j)" at the corresponding pixel point, the differential processing is to calculate a new matrix M_diff = M1 - M2. When performing this pixel-level subtraction operation, M_diff(i,j) = M1(i,j) - M2(i,j) = (target light intensity (i,j) + ambient light intensity (i,j)) - ambient light intensity (i,j) = target light intensity (i,j). Through this operation, ambient light interference, which is a common-mode signal, is effectively canceled out. The final light intensity spatial distribution map (i.e., M_diff) is an ideal, pure grayscale image that only reflects the reflection of the object to the modulated light source and is free from ambient light color distortion interference.

[0031] Step S103: Convert the light intensity spatial distribution map to the HSV color space to generate a first HSV image; The "HSV color space" refers to a color model that describes colors using three components: hue, saturation, and value. It is more consistent with human color perception than the commonly used RGB model, and the hue component is more robust to changes in light intensity. The "first HSV image" refers to the image obtained by converting the light intensity spatial distribution map obtained in step S102 into an image represented by the three HSV components using a standard color space conversion algorithm. Although the original light intensity spatial distribution map is a single-channel grayscale image, converting it to a standard color space (e.g., assigning a base hue before conversion) can generate an image with HSV components, facilitating subsequent color-based analysis.

[0032] Specifically, this step is performed after obtaining a clean light intensity spatial distribution map. Its application scenario is to preprocess the image to facilitate subsequent accurate segmentation based on color features. Although the light intensity spatial distribution map is theoretically free from ambient light interference, due to sensor noise, incomplete differential processing, and other non-ideal factors, there may still be some isolated pixels with abnormal intensity. These pixels may appear as slight color distortion. Converting the image to the HSV color space is precisely to leverage the advantages of the HSV model in color discrimination to identify these abnormal points. The conversion process is a deterministic mathematical calculation that maps the grayscale value (or preset RGB value) of each pixel to a vector containing three values: H, S, and V. For example, all pixels in the light intensity spatial distribution map can be assigned a baseline hue (such as 0 degrees representing red), with its saturation set to maximum, and its brightness (V) directly normalized from the original light intensity value. In this way, all effective signal points generated by the target light source will be concentrated within a very narrow HSV range, while any noise or residual interference will have its HSV value significantly deviate from this range, thus providing a convenient feature dimension for the next step of accurate segmentation.

[0033] Step S104: According to the target HSV range, the first HSV image is divided into several first target regions and several first interference regions, wherein the target HSV range represents the HSV range corresponding to the preset band. Here, "target HSV range" refers to a specific and predictable range of HSV values ​​that the light signal of the preset wavelength band will exhibit in the HSV color space after being captured and processed by the entire imaging system (including the interference filter, photoelectric sensor, and its color filter array). For example, if the preset wavelength band is 850nm infrared light, it may appear as a specific red on a specific sensor, and its corresponding target HSV range is H∈, S∈[0.7,1.0], V∈[0.5,1.0]. "Segmentation" refers to the image processing process of classifying pixels according to one or more attributes (here, HSV value) and organizing adjacent pixels of the same category into a connected region. "First target region" refers to the set of regions in the first HSV image whose HSV values ​​fall within the "target HSV range." These regions represent the valid signals from the modulated light source that have been correctly captured. The “first interference region” refers to the set of regions in the first HSV image that consist of all pixels whose HSV values ​​fall outside the “target HSV range”. These regions are considered invalid signals or color distortion points caused by noise, differential residuals or other non-ideal factors.

[0034] Specifically, this step is performed after the first HSV image is generated. Its core objective is to determine the classification of each pixel in the image according to a preset color standard, thereby accurately "circling" all abnormal pixels that need to be corrected. Optionally, during execution, the system will traverse every pixel in the first HSV image. For any pixel P, the system will read its HSV value (H, S, V). Subsequently, this value will be compared with a preset "target HSV range". For example, if the target HSV range is defined as H∈[0.7, 1.0], S∈[0.6, 1.0], and V∈[0.6, 1.0], and the HSV value of pixel P is (5, 0.8, 0.9), then the pixel meets the condition and is classified as part of the first target region. If another pixel Q has an HSV value of (50, 0.8, 0.9), since its H value 50 is outside the range, this pixel is classified as part of the first interference region. By performing this judgment on all pixels, the entire image is divided into several target regions and several interference regions, forming a logical segmentation map that precisely indicates the objects and locations that need to be operated on in subsequent correction steps.

[0035] Step S105: Compensate and correct each of the first interference regions to generate a first corrected image; "Compensation correction" refers to an image restoration technique that aims to eliminate imperfections in an image and restore its integrity and continuity by utilizing pixel information from marked "target regions." "First corrected image" refers to the final output image of the identified object obtained after performing compensation correction operations on all first interference regions in the first HSV image (or its corresponding light intensity spatial distribution map). Theoretically, this image is free from ambient light reddish interference, random noise, or imperfections introduced by differential residuals.

[0036] Specifically, this step is executed after the accurate segmentation of the interference region and is the final step in the entire correction process. Its application scenario is content restoration of an image whose defect locations have been marked. For each "first interference region" identified in step S104, the system needs to recalculate a reasonable pixel value for its internal pixels. There are several ways to achieve compensation correction. For example, one feasible method is to find the spatially nearest pixels belonging to the "first target region" for any pixel within an interference region, and then calculate the average or median of the pixel values ​​of these effective pixels, using this calculated average or median as the new pixel value for the interference pixel. Alternatively, more complex image restoration algorithms can be used, such as methods based on image texture synthesis or partial differential equations, to analyze the image structure around the interference region and fill in the region. Regardless of the method used, the core idea is based on the prior knowledge that "image content is continuous locally," using surrounding normal pixels to repair abnormal pixels. When all the first interference regions in the image have been repaired in this way, a visually complete, smooth, and color-pure first corrected image is obtained.

[0037] The following is a more detailed description of the process of the method provided in this implementation.

[0038] Optionally, steps S201-S202 are more specific steps than step S104.

[0039] Step S201: Create a mask based on the target HSV range. The mask is a binary image, in which the value of the first target region is 1 and the value of the first interference region is 0. Here, a "mask" refers to an auxiliary matrix of the same size as the image to be processed. Its function is similar to a digital template or sieve, used to select, isolate, or mark specific regions of the image at the pixel level. A "binary image" refers to a special type of digital image where each pixel in its matrix can only take one of two preset values, typically 0 and 1, representing two mutually exclusive states, such as "false" and "true" or "background" and "foreground." In this step, a "first target region value of 1" means that the pixel position in the mask corresponding to the first target region is assigned the value 1, marking that the pixel at that position is a valid signal point that has passed the "target HSV range" test. A "first interference region value of 0" means that the pixel position in the mask corresponding to the first interference region is assigned the value 0, marking that the pixel at that position is an interference signal point that has failed the test and needs to be corrected.

[0040] Specifically, this step is executed after logically completing the segmentation of the first HSV image (S104). Its purpose is to materialize the abstract classification result of the previous step into a concrete, efficient tool that can be directly used for subsequent image operations—a binary mask. During execution, the system first creates an all-zero matrix with the same size as the first HSV image (e.g., 1920x1080 pixels) as the initial state of the mask. Then, the system iterates through each pixel of the first HSV image and operates according to the segmentation result of step S104: for any pixel classified as the "first target region," the system changes the value from 0 to 1 at the same coordinate position in the mask matrix. For all pixels classified as the "first interference region," the system does not perform any operation, and their values ​​at the corresponding positions in the mask matrix remain at the initial 0. After iterating through all pixels, this newly generated matrix is ​​the "mask" defined in this step. It accurately records the "identity" of each pixel in an image—whether it is a valid signal or a interference signal—in an extremely concise and computer-friendly way (binary logic of 0s and 1s), providing a direct, matrix-operable index for the next step of targeted labeling and fixed-point repair.

[0041] Step S202: Mark the first interference region and the first target region in the light intensity spatial distribution map according to the mask; Specifically, this step is performed after the mask is created (S201) and before the final compensation correction (S105). Its core function is to accurately "map" the interference location information obtained from the HSV color space analysis back to the original, unconverted light intensity data. During execution, the system aligns the binary mask generated in step S201 with the light intensity spatial distribution map generated in step S102. Since the two are exactly the same size, each pixel (i, j) in the mask has a one-to-one correspondence with a pixel (i, j) in the light intensity spatial distribution map. Based on the mask value, the system logically classifies each pixel in the light intensity spatial distribution map in its internal data structure: if the mask value at position (i, j) is 1, then the pixel in the light intensity spatial distribution map at that position is marked as part of the "first target region," and its light intensity value is considered reliable and valid. If the mask value at position (i, j) is 0, the pixel in the light intensity spatial distribution map at that position is marked as part of the "first interference region," its light intensity value is considered unreliable, and it is listed as the target for subsequent compensation and correction. Through this step, the system clarifies the specific scope of the repair on the original data, ensuring that the correction operation directly affects the most fundamental light intensity data, rather than the HSV image which is merely an analysis tool, thus guaranteeing the accuracy and physical meaning of the correction.

[0042] Optionally, the target interference region is any of the first interference regions, and steps S301-S303 are more specific steps than step S105.

[0043] Step S301: Obtain the pixel values ​​of the first target region adjacent to the target interference region; Here, "target interference region" refers to any single, connected interference region currently being processed from all marked first interference regions during the compensation and correction operation. "Pixel values ​​of the first target region adjacent to the target interference region" refers to a specific set of pixel values ​​whose members are all pixels that constitute one or more "first target regions" spatially adjacent to the "target interference region".

[0044] Specifically, this step involves data acquisition for a compensation and correction process targeting any single interference area. During execution, the system first identifies the currently processed interference area as the "target interference area." Then, the system analyzes the adjacency relationships of this area, identifying all areas that are in contact with its boundary and have been marked as "first target areas." Once these adjacent "first target areas" are identified, this step reads and collects the pixel values ​​of every pixel contained within these adjacent target areas. If an interference area is adjacent to only one large "first target area" T1, then this step will collect all pixel values ​​within area T1. If an interference area is adjacent to two "first target areas" T1 and T2 simultaneously, then this step will collect all pixel values ​​within areas T1 and T2 and merge them into a large set of pixel values.

[0045] Step S302: Replace the pixel values ​​of the target interference region with the average pixel values ​​of the first target region adjacent to the target interference region to obtain the compensated target interference region; Specifically, this step is the core repair operation that follows S301. Its purpose is to fill the entire interference area with an average value that represents the overall characteristics of one or more adjacent target areas. During execution, the system calls the large set of pixel values ​​from the adjacent target areas collected in step S301. For example, if the adjacent "first target area" is a region containing 10,000 pixels, the system calculates the arithmetic mean of all 10,000 pixel values. Assume the calculated mean is 180. Next, the system iterates through every pixel within the current "target interference area" and uniformly modifies its original, invalid grayscale values ​​to the newly calculated mean of 180. After this operation, the interference area becomes a smooth color block with completely consistent internal pixel values, its color representing the overall average color of one or more adjacent "first target areas".

[0046] Step S303: Perform histogram equalization on the compensated target interference region to obtain the first corrected image; Histogram equalization is an image processing technique that enhances local contrast by redistributing pixel gray levels to stretch the dynamic range of pixel intensity.

[0047] Specifically, this step is a local image enhancement operation performed after a target interference region is mean-filled (S302). Its purpose is to improve the visual abruptness that may be caused by the S302 operation. Since S302 produces a completely uniform "compensated target interference region," this region lacks any texture detail. To make its visual effect more natural, the system defines a local window containing this region and some of its neighboring pixels. Then, the system calculates the pixel grayscale histogram within this local window and applies an equalization algorithm based on this histogram. This algorithm generates a grayscale mapping function to adjust the pixel values ​​within the "compensated target interference region." Through this operation, the originally single mean is remapped to a small range of different grayscale values, thereby producing subtle changes in brightness within the region, attempting to simulate natural texture and contrast, allowing it to better blend into the surrounding image content. After this step is completed in one interference region, the repair work for that region is finished. After the S301 to S303 process is repeated in all interference regions of the entire image, the resulting image is the final "first corrected image."

[0048] Optionally, the pixel to be compensated is any pixel in the target interference region. For the pixel to be compensated, perform the following steps S30301-S30304 to obtain the compensated target interference region: Step S30301: Identify all reference pixels belonging to the first target region that are adjacent to the target interference region; Specifically, this step is the initialization and data preparation phase of the entire repair process. First, the algorithm determines a fixed set of reference pixels. This set consists of all pixels belonging to the "first target region" and directly contacting the boundary of the current "target interference region." This set of reference pixels is shared and invariant for all "pixels to be compensated" within the "target interference region." Then, the algorithm selects the first pixel from the "target interference region" as the current "pixel to be compensated" and begins the repair calculation for it.

[0049] Step S30302: Calculate the distance from each of the reference pixels to the pixel to be compensated; Here, "distance" usually refers to the Euclidean distance between pixel coordinates, that is, the straight-line distance between two points. If the coordinates of the "pixel to be compensated" are (x, y), and the coordinates of a "reference pixel" are (xᵢ, yᵢ), then the formula for calculating the distance dᵢ between them is: .

[0050] Specifically, this step quantizes the spatial relationships for subsequent weighted calculations. After determining the current "pixel to be compensated," the system iterates through each "reference pixel" identified in step S30301. For each "reference pixel," the system calculates its geometric distance to the current "pixel to be compensated." This process yields a list of distances, where each distance value corresponds to a "reference pixel." For example, if there are N reference pixels, then for a pixel to be compensated, N distance values ​​{d1, d2, ..., d...} will be calculated. n}

[0051] Step S30303: Weight the pixel value of each reference pixel according to the reciprocal of the distance, and calculate the weighted average value; In this calculation, the weight wᵢ of a reference pixel is inversely proportional to its distance dᵢ, i.e., wᵢ = 1 / dᵢ. The "weighted average" is calculated by multiplying the pixel value Pᵢ of each reference pixel with its corresponding weight wᵢ, summing all the multiplications, and finally dividing by the sum of all weights.

[0052] Specifically, this step performs the core interpolation calculation. Based on the distance list {d1, d2, ..., d...} obtained in the previous step... n The system first calculates the weight list {w1, w2, ..., w} corresponding to each reference pixel. n The system then calculates the weighted average (V_new) using the following formula: V_new=(w1P1+w2P2+...+w n P n ) / (w1+w2+...+w n ) Or, written as a summation formula: V_new=[Σ((1 / dᵢ)*Pᵢ)] / [Σ(1 / dᵢ)]; This calculation process ensures that reference pixels very close to the "pixel to be compensated" have a decisive impact on the final calculation result because their distance dᵢ is small and their reciprocal 1 / dᵢ (weight) is large. Conversely, reference pixels at a distance contribute negligible weight.

[0053] Step S30304: Use the weighted average value to replace the pixel value of the pixel to be compensated to obtain the compensated target interference region; Specifically, this step is the execution and completion phase of the repair process. Once the weighted average value of a "pixel to be compensated" is calculated, the system uses this value to update the original value of that pixel in the image data. Then, the algorithm moves to the next pixel in the "target interference region," uses it as the new "pixel to be compensated," and repeats steps S30302 to S30304 (the reference point set defined in step S30301 remains unchanged). This loop continues until all pixels within the "target interference region" have been calculated and replaced one by one.

[0054] Optionally, the light intensity spatial distribution map includes spatial distribution maps corresponding to each of the consecutive multi-frame image sequences, and the method may also include steps S106-S109; Step S106: Perform temporal median filtering on the image sequence, and fuse the image sequence after temporal median filtering to generate an enhanced light intensity spatial distribution map; Here, "image sequence" refers to a series of consecutive image frames captured in chronological order, similar to a video clip. "Temporal median filtering" is a filtering technique that spans multiple frames of images. It extracts the pixel value of the same pixel at different times (different frames) and updates the pixel value using the median of these values. "Fusing to generate an enhanced spatial distribution map of light intensity" refers to merging multiple frames of images that have undergone temporal filtering into a single, higher-quality image through some method (such as averaging).

[0055] Specifically, this step is the core operation that uses temporal information to suppress random noise and transient interference. During execution, the system processes a sequence of images containing multiple frames.

[0056] Temporal median filtering: For any pixel coordinate (x, y) in an image, the system collects its pixel values ​​across all (or within a time window) frames, forming a list of values ​​[P(x, y, t1), P(x, y, t2), P(x, y, t3), ...]. The system then sorts this list and takes the median value as the new value for that pixel in the temporally median-filtered image. This operation is highly effective at eliminating "impulse noise" (such as sensor dead pixel flicker, cosmic rays, etc.) that occurs randomly only in a few frames.

[0057] Fusion Generation: After performing temporal median filtering on each frame in the sequence (or generating a new filtered sequence), the system fuses these temporally median-filtered image frames. The most common method is to add the pixel values ​​of corresponding pixels in these frames and then average them. Since random noise cancels each other out after averaging multiple frames, while the true signal (stable light intensity distribution) is enhanced, this process can significantly improve the signal-to-noise ratio of the image.

[0058] Ultimately, the product of this step is a single image of the enhanced spatial distribution of light intensity. This image is more representative of the stable optical properties of the object under test than any frame in the original sequence.

[0059] Step S107: Convert the enhanced light intensity spatial distribution map to the HSV color space to generate a second HSV image; Step S108: Based on the target HSV range, the second HSV image is segmented into several second target regions and several second interference regions; Step S109: Compensate and correct the second interference region to generate a second corrected image.

[0060] Steps S107-S109 are methodologically very similar to the previous steps S103-S105, forming a complete "identification and repair" process. The main difference lies in the input objects they handle.

[0061] It should be noted that step S107 corresponds functionally to step S103. It converts the "enhanced light intensity spatial distribution map" generated in S106 to the HSV color space to generate a "second HSV image". S103, on the other hand, processes the original single-frame "light intensity spatial distribution map".

[0062] Step S108 functionally corresponds to step S104. It uses the same "target HSV range" to segment the "second HSV image" to identify the "second target region" and the "second interference region". S104, on the other hand, segments the "first HSV image".

[0063] Step S109 corresponds functionally to step S105. It compensates and corrects the identified "second interference region" (using methods such as mean fill or inverse distance weighted interpolation discussed earlier), ultimately generating a "second corrected image." Step S105, on the other hand, repairs the "first interference region."

[0064] Steps S106 to S109 describe not an isolated process, but rather an optional, higher-quality starting point for the main flow. The entire method can be understood as having two parallel initial processing paths, see reference... Figure 3 : Path 1 (Single Frame Processing): Execute S101 to S105 to directly process the single frame image and quickly obtain the "first corrected image".

[0065] Path 2 (Multi-frame processing): Execute S106 to S109 to generate a more reliable "second correction image" using time-domain information.

[0066] After obtaining the "first corrected image" or the "second corrected image," the algorithm can continue to execute subsequent steps, such as step S201. This means that the corrected image generated by either path can be used as input for further analysis and processing (e.g., identifying and repairing other types of defects). The choice of which path to use depends on the specific application requirements: if fast processing is required, path one is chosen; if there is a lot of random noise in the scene and the quality requirements for the final result are extremely high, path two is chosen.

[0067] Optionally, steps S10601-S10606 are more specific steps than step S106. Step S10601: Select any frame of the light intensity spatial distribution map in the image sequence as a reference frame image; The "reference frame image" is a frame image in the image sequence that is designated as the geometric reference, and all other images in the sequence will be aligned with the coordinate system of that frame.

[0068] Specifically, this step establishes a unified coordinate reference for the subsequent image registration process. The system selects one image from the input multi-frame light intensity spatial distribution map sequence and designates it as the reference frame. This selection can be based on preset rules, such as selecting the first frame or a middle frame of the sequence, or selecting the frame with the best quality through image quality assessment algorithms (such as sharpness or contrast analysis). Once this reference frame is determined, its own coordinate system becomes the target coordinate system for spatial alignment of the entire sequence.

[0069] Step S10602: In the reference frame image and the current frame image to be aligned, key feature points are detected and feature descriptors are generated using the scale-invariant feature transform algorithm, respectively. Here, "current frame image to be aligned" refers to any frame image in the image sequence that is being processed and needs to be geometrically aligned with the reference frame, excluding the reference frame. "Scale-Invariant Feature Transform (SIFT) algorithm" is a computer vision algorithm for extracting local features from images. The features extracted by this algorithm are invariant to scale changes and rotations of the image. "Key feature points" are pixels located in the image by this algorithm that possess stable and distinguishable properties. "Feature descriptors" are high-dimensional numerical vectors generated for each key feature point, used to quantify the image information in the neighborhood of that point, and are robust to changes in illumination.

[0070] Specifically, this step aims to extract a set of standardized feature data for both the reference frame image and the current frame image to be aligned, which can be used for subsequent matching. This process is applied independently to the two images. For each image, the scale-invariant feature transform algorithm first identifies the location and scale of key feature points by detecting local extrema of the difference of Gaussian function in different scale spaces. This method ensures that the detected points can still be stably found after the image is scaled. Subsequently, for each identified key feature point, the algorithm calculates its principal direction and uses it as a reference to statistically analyze the gradient information of its neighboring pixels, constructing a 128-dimensional feature vector, i.e., a feature descriptor. This vector is normalized to reduce the impact of illumination changes on the descriptor. The final output of this step is two sets of data: one is the list of key feature points and their corresponding feature descriptors generated for the reference frame image, and the other is the list of key feature points and their corresponding feature descriptors generated for the current frame image to be aligned.

[0071] Step S10603: Based on the feature descriptor, perform feature point matching between the reference frame image and the current frame image to be aligned, and remove mismatched feature point matching pairs to obtain the correct feature point matching relationship; "Feature point matching" refers to finding the most numerically similar pairing between the feature descriptor subset of the reference frame and the feature descriptor subset of the current frame to be aligned. "Correct feature point matching relationship" refers to the set of feature point pairs that are judged to have high confidence and represent the same physical location in the image after screening.

[0072] Specifically, this step aims to establish an accurate sparse correspondence between two images. First, the system performs initial matching by calculating the Euclidean distance between feature descriptors. That is, for each feature descriptor in the reference frame, the system finds the closest match in the descriptor set of the current frame to be aligned, forming a candidate matching pair. Then, to ensure the uniqueness and accuracy of the matching, the system uses a ratio test to eliminate erroneous feature point matching pairs. This method calculates the ratio of the nearest neighbor distance to the second nearest neighbor distance in each candidate match. Only when this ratio is below a preset threshold is the match considered explicit and valid and retained. Through this filtering process, a set of high-confidence "correct feature point matching relationships" is obtained.

[0073] Step S10604: Based on the correct feature point matching relationship, calculate the affine transformation matrix that transforms the current frame image to be aligned to the coordinate system of the reference frame image. The "affine transformation matrix" is a 3x3 mathematical matrix that can uniformly describe the combination of linear transformations (rotation, scaling, shearing) and translations in two-dimensional space.

[0074] Specifically, the purpose of this step is to compute the overall image transformation model from discrete point pair relationships. The system uses the correct feature point matching relationships obtained in step S10603 as input data. To robustly estimate the transformation matrix from this data, which may still contain a few mismatches, the system typically employs the Random Sample Consensus (RANSAC) algorithm. The RANSAC algorithm iteratively performs the following operations: randomly selects a minimum subset of point pairs sufficient to compute the transformation model (affine transformation requires 3 point pairs), computes a candidate affine transformation matrix, then uses this matrix to test all matching point pairs, and counts the number of point pairs (inliers) that conform to the model. After multiple iterations, the transformation matrix with the most inlier support is selected as the final result. This method can effectively and accurately solve for the affine transformation matrix from data containing noise and outliers.

[0075] Step S10605: Apply the transformation matrix to the current frame image to be aligned to generate an aligned image that is aligned with the reference frame image. The image sequence includes the aligned image and the reference frame image. Here, "applying the transformation matrix to the current frame image to be aligned" means performing a geometric resampling operation on the pixel grid of the image. The "aligned image" is the output of this resampling operation, whose image content is the same as the current frame image to be aligned, but whose pixel coordinate system has been aligned with the coordinate system of the reference frame image.

[0076] Specifically, this step involves generating the aligned image based on the calculated transformation model. The system performs an image warping operation on the current frame image to be aligned. This operation is performed through a reverse mapping: for each integer pixel coordinate in the output aligned image, the system uses the inverse of the affine transformation matrix calculated in step S10604 to calculate its source coordinates in the original frame image to be aligned. Since the calculated source coordinates are usually non-integer, the system uses an interpolation algorithm (such as bilinear interpolation or bicubic interpolation) to calculate the pixel value of the non-integer coordinate point based on the pixel values ​​of the surrounding integer coordinate pixels. This process traverses all pixel positions in the aligned image, thereby generating a complete new image spatially aligned with the reference frame image. This process from S10602 to S10605 is repeated for all frames in the sequence except the reference frame, ultimately generating a fully registered image sequence consisting of the original reference frame and all newly generated aligned images.

[0077] Step S10606: Perform temporal median filtering on the image sequence, and fuse the image sequence after temporal median filtering to generate an enhanced light intensity spatial distribution map; Refer to step S106, which will not be repeated here.

[0078] Optionally, steps S110-S112 can be performed after step S105, and steps S110-S112 can also be performed on the second corrected image.

[0079] Step S110: Perform guided filtering on the first corrected image to obtain the third corrected image; The "first corrected image" refers to the image generated in step S105, which has already compensated and corrected the initially identified interference areas. "Guided filtering" is a smoothing filtering technique with edge-preserving properties. It uses a guide image to determine the filtering weights, thereby smoothing the region while protecting edge details from blurring. The "third corrected image" is the output image obtained after guided filtering.

[0080] Specifically, this step aims to smooth out minor artifacts or discontinuities that may be introduced by compensation correction in step S105, without damaging the original important edge structures in the image. In this application, the "first corrected image" itself is typically used as the guide image. The core idea of ​​guided filtering is to assume that the pixel values ​​of the output image and the pixel values ​​of the guide image have a linear relationship within a local window. For each pixel within the window, the algorithm calculates the optimal linear coefficients through least squares regression, so that the output value approximates the input value ("first corrected image") while its trend of change remains consistent with the structure of the guide image (also "first corrected image"). Since this linear model performs differently in flat and edge regions of the image, the final effect is to accurately preserve edge sharpness when smoothing large homogeneous areas.

[0081] Step S111: Perform nonlocal mean denoising on the third corrected image to obtain the fourth corrected image; The "third corrected image" is the output of the previous step S110. "Non-local Means Denoising" is an advanced image denoising algorithm that reduces noise for a pixel by calculating a weighted average of all pixels in the image. The weights depend on the similarity between the pixel's neighbors (image patches), rather than spatial distance. The "fourth corrected image" is the output image obtained after non-local means denoising.

[0082] Specifically, the goal of this step is to further suppress any random noise that may be present in the image, particularly Gaussian noise. Unlike traditional local filters that operate within a small neighborhood around a pixel, the basic principle of the nonlocal averaging algorithm is to utilize the information redundancy in the image. For each pixel to be processed, the algorithm searches for other image patches with similar structures to those surrounding that pixel within the entire image (or a large search window). It then takes a weighted average of the center pixel values ​​of all these similar image patches as the new value for the current pixel. The more similar two image patches are, the higher their corresponding weights. Because noise is random, while real image structures (texture, edges) repeat in the image, averaging a large number of similar image patches with different noise patterns can effectively cancel out noise while perfectly preserving the fine details and textures of the image.

[0083] Step S112: Perform adaptive gamma correction on the fourth corrected image to obtain the final corrected image; The "fourth corrected image" is the output of the previous step S111. "Adaptive gamma correction" is an image enhancement technique that adjusts the contrast and brightness of an image through a non-linear brightness mapping. The gamma (γ) value is dynamically calculated based on the image's statistical characteristics (such as average brightness), rather than being a fixed constant. The "final corrected image" is the final output image after the entire processing flow is completed.

[0084] Specifically, this step aims to optimize the overall visual performance of the image, giving it better contrast and clarity. Standard gamma correction uses a power-law function Output = Input^γ to transform pixel values. Adaptive gamma correction, however, first analyzes the global or local brightness characteristics of the "fourth corrected image." For example, a common adaptive method is to calculate the average pixel value of the entire image. If the image is generally dark (low average value), the algorithm automatically selects a gamma value less than 1 to non-linearly brighten dark areas, thereby enhancing the visibility of details in dark areas. Conversely, if the image is generally bright, the algorithm may select a gamma value greater than 1 for adjustment. In this way, the algorithm can automatically make the most appropriate brightness and contrast adjustments based on the specific characteristics of each image, making the final output "final corrected image" visually clearer and easier to identify.

[0085] The image red-light correction device in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link / reference needed]. Figure 4 This is a schematic diagram of the physical device structure of an image reddish correction device in the embodiments of this application.

[0086] It should be noted that, Figure 4 The structure of the image red-bias correction device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0087] like Figure 4 As shown, the image red-light correction device includes a CPU 401, which can perform various appropriate actions and processes according to a program stored in the read-only memory ROM 402 or a program loaded from the storage section 408 into the random access memory RAM 403, such as performing the methods described in the above embodiments. The RAM 403 also stores various programs and data required for system operation. The CPU 401, ROM 402, and RAM 403 are interconnected via a bus 404. An I / O interface 405 is also connected to the bus 404.

[0088] The following components are connected to I / O interface 405: input section 406 including audio input devices, push-button switches, etc.; output section 407 including a liquid crystal display (LCD) and audio output devices, indicator lights, etc.; storage section 408 including a hard disk, etc.; and communication section 409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. Communication section 409 performs communication processing via a network such as the Internet. Drive 410 is also connected to I / O interface 405 as needed. Removable media 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 410 as needed so that computer programs read from them can be installed into storage section 408 as needed.

[0089] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by CPU 401, it performs the various functions defined in the present invention.

[0090] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0091] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.

[0092] Specifically, the image reddish correction device in this embodiment includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the image reddish correction method provided in the above embodiment.

[0093] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the image red-light correction device described in the above embodiments; or it may exist independently and not assembled into the image red-light correction device. The storage medium carries one or more computer programs that, when executed by a processor of the image red-light correction device, cause the image red-light correction device to implement the image red-light correction method provided in the above embodiments.

[0094] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for correcting reddish tint in images, characterized in that, Includes the following steps: The first band light signal and the second band light signal reflected by the object to be identified are received through an interference filter with a preset bandwidth. The first band light signal represents the light signal reflected by the object to be identified when the modulation light source of the preset frequency is turned on and emits the light signal of the preset band to the object to be identified. The first band light signal includes the light signal of the preset band and the ambient light signal. The second band light signal represents the light signal reflected by the object to be identified when the modulation light source is turned off. The spatial light intensity distribution of the first band optical signal and the second band optical signal is captured by a photoelectric sensor to obtain the first original light intensity distribution matrix of the first band optical signal and the second original light intensity distribution matrix of the second band optical signal. The first original light intensity distribution matrix and the second original light intensity distribution matrix are then subjected to differential processing to obtain a light intensity spatial distribution map. The light intensity spatial distribution map is converted to the HSV color space to generate a first HSV image; Based on the target HSV range, the first HSV image is divided into several first target regions and several first interference regions, wherein the target HSV range represents the HSV range corresponding to the preset band. Each of the first interference regions is compensated and corrected to generate a first corrected image.

2. The method according to claim 1, characterized in that, The step of segmenting the first HSV image into several first target regions and several first interference regions based on the target HSV range specifically includes: A mask is created based on the target HSV range. The mask is a binary image in which the value of the first target region is 1 and the value of the first interference region is 0. The first interference region and the first target region in the light intensity spatial distribution map are marked according to the mask.

3. The method according to claim 1, characterized in that, The step of compensating and correcting each of the first interference regions to generate a first corrected image specifically includes: The target interference region is any one of the first interference regions. The following steps are performed on the target interference region to obtain the first corrected image: Obtain the pixel values ​​of the first target region adjacent to the target interference region; The pixel values ​​of the target interference region are replaced with the average pixel values ​​of the first target region adjacent to the target interference region to obtain the compensated target interference region. Histogram equalization is performed on the compensated target interference region to obtain the first corrected image.

4. The method according to claim 3, characterized in that, The step of replacing the pixel values ​​of the target interference region with the average pixel values ​​of the first target region adjacent to the target interference region to obtain the compensated target interference region specifically includes: The pixel to be compensated is any pixel in the target interference region. For the pixel to be compensated, the following steps are performed to obtain the compensated target interference region: Identify all reference pixels belonging to the first target region that are adjacent to the target interference region; Calculate the distance from each of the reference pixels to the pixel to be compensated; The pixel values ​​of each reference pixel are weighted according to the reciprocal of the distance, and a weighted average value is calculated. The weighted average value is used to replace the pixel value of the pixel to be compensated to obtain the compensated target interference region.

5. The method according to claim 1, characterized in that, The light intensity spatial distribution map includes spatial distribution maps corresponding to each of a series of consecutive image frames, and the method further includes: The image sequence is subjected to temporal median filtering, and the image sequence after temporal median filtering is fused to generate an enhanced light intensity spatial distribution map; The enhanced light intensity spatial distribution map is converted to the HSV color space to generate a second HSV image; Based on the target HSV range, the second HSV image is segmented into several second target regions and several second interference regions; The second interference region is compensated and corrected to generate a second corrected image.

6. The method according to claim 5, characterized in that, The step of performing temporal median filtering on the image sequence and fusing the temporally median-filtered image sequence to generate an enhanced light intensity spatial distribution map specifically includes: The light intensity spatial distribution map of any frame in the image sequence is selected as a reference frame image; For any frame image to be aligned in the image sequence, perform the following operations: In the reference frame image and the current frame image to be aligned, key feature points are detected and feature descriptors are generated using the scale-invariant feature transform algorithm, respectively. Based on the feature descriptor, feature point matching is performed between the reference frame image and the current frame image to be aligned, and mismatched feature point matching pairs are eliminated to obtain the correct feature point matching relationship; Based on the correct feature point matching relationship, calculate the affine transformation matrix that transforms the current frame image to be aligned to the coordinate system of the reference frame image; The transformation matrix is ​​applied to the current frame image to be aligned to generate an aligned image that is aligned with the reference frame image. The image sequence includes the aligned image and the reference frame image. The image sequence is subjected to temporal median filtering, and the image sequences after temporal median filtering are fused to generate an enhanced light intensity spatial distribution map.

7. The method according to claim 1, characterized in that, After the step of compensating and correcting each of the first interference regions to generate a first corrected image, the method further includes: The first corrected image is subjected to guided filtering to obtain the third corrected image; The third corrected image is subjected to nonlocal mean denoising to obtain the fourth corrected image; Adaptive gamma correction is performed on the fourth corrected image to obtain the final corrected image.

8. An image reddish correction device, characterized in that, The image red-light correction device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the image red-light correction device to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on the image redness correction device, the image redness correction device performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the image redness correction device, the image redness correction device performs the method as described in any one of claims 1-7.