A bad pixel detection method and system combining spatial analysis and temporal analysis
By combining spatial and temporal domain analysis methods, bad spots in image sequences can be identified and tracked, solving the problems of false detection and missed detection in complex environments in existing technologies, and achieving higher detection accuracy and robustness.
Patent Information
- Application Number
- CN202510993082.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-18
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-07-18
AI Technical Summary
Existing defect detection methods are prone to false detections and false negatives in complex environments, especially for small defects, which are difficult to extract, particularly when the sensor is affected by noise, brightness changes drastically, or there is short-term flicker noise.
By combining spatial and temporal analysis, grayscale conversion, noise filtering, edge extraction, and morphological operations are performed on each frame of the image. Candidate bad pixel regions are identified by combining connected component labeling, and optimal matching and tracking are performed in the time series to determine the area stability and temporal continuity of bad pixels.
It improves the accuracy and robustness of defect detection, significantly reduces the false detection rate and false negative rate, is suitable for complex backgrounds and dynamic imaging scenarios, and enhances the stability and reliability of detection results.
Smart Images

Figure CN120495308B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a bad pixel detection method and system combining spatial domain analysis and temporal domain analysis. Background Art
[0002] Most current bad pixel detection methods rely on analyzing the spatial features of a single image frame, known as spatial domain analysis. For example, these methods utilize grayscale value differences or edge features to detect abnormal areas within the image. These methods are effective for static, low-noise images, but are prone to false detections in complex environments (where the sensor is affected by noise, brightness fluctuates dramatically, or short-term flicker noise is present). Furthermore, small bad pixels are difficult to detect using spatial domain analysis alone because they are often submerged in noise, leading to missed detections. Summary of the Invention
[0003] The present invention aims to overcome the shortcomings of existing technologies by providing a bad pixel detection method and system that combines spatial and temporal analysis. Observation has shown that bad pixels possess a key characteristic: they typically appear as regions of stable morphology and high contrast in time series. Therefore, incorporating temporal information into dynamic bad pixel analysis helps improve detection accuracy and stability. The present invention systematically combines spatial and temporal analysis to detect, track, and filter bad pixels in image sequences.
[0004] The object of the present invention is achieved through the following technical solutions: In a first aspect, the present invention provides: a bad pixel detection method combining spatial domain analysis and time domain analysis, comprising the following steps:
[0005] In the spatial domain analysis phase, each image frame is first converted to grayscale. Next, a median filter is used to filter noise and edge information is extracted using the Sobel operator. The image is then binarized using threshold segmentation, and a morphological closing operation is used to fill potential holes and enhance the bad pixel areas. A connected component labeling algorithm is then used to identify all candidate bad pixel areas, and the bounding rectangle, area, location, and contrast attributes of each candidate bad pixel area are extracted.
[0006] In the time domain analysis stage, the candidate bad pixel areas detected in continuous frames are matched and tracked using the optimal matching method. The spatial position and area characteristics of the candidate bad pixel areas are combined to establish the correspondence between the candidate bad pixel areas across frames. The continuity of the same candidate bad pixel area on the time axis is judged, and whether the requirements of the area stability assumption and the time domain continuity assumption are met. Only candidate bad pixel areas that meet both assumptions and whose area and contrast exceed the set threshold are finally judged as stable bad pixels and output.
[0007] Preferably, extracting edge information using the Sobel operator includes the following steps:
[0008] The Sobel operator convolves the image with two 3×3 convolution kernels and calculates the horizontal gradient using the horizontal gradient operator and the vertical gradient operator. and vertical gradient , calculate the total gradient amplitude G for each pixel: .
[0009] Preferably, binarizing the image by threshold segmentation comprises the following steps:
[0010] Pixels with a value greater than or equal to the threshold are considered edge pixels and assigned a value of 255; pixels with a value less than the threshold are considered non-edge pixels and assigned a value of 0.
[0011] Preferably, the determination of the area stability hypothesis comprises the following steps:
[0012] For a candidate bad point b, the detection area in the tth frame is recorded as A t , the detection area of the t-1 frame is recorded as A t-1 , defining the area change rate for:
[0013] ;
[0014] when When , the candidate bad point b is judged to meet the requirements of the area stability assumption, where is the set area change threshold.
[0015] Preferably, the determination of the time domain continuity hypothesis includes the following steps:
[0016] Define that within the continuous time window T frames, the number of frames in which a candidate bad point b is detected is N detected , set the minimum detection rate threshold ;
[0017] when When , the candidate bad point b is judged to meet the requirements of the time domain stability assumption.
[0018] Preferably, the optimal matching method is the Hungarian algorithm.
[0019] A second aspect of the present invention provides: a bad pixel detection system combining spatial domain analysis and time domain analysis, for implementing any of the above-mentioned bad pixel detection methods combining spatial domain analysis and time domain analysis, comprising:
[0020] The spatial domain analysis module is used to convert each image frame into grayscale, then use median filtering to filter noise and extract edge information using the Sobel operator. It then uses threshold segmentation to binarize the image and uses morphological closing operations to fill potential holes and enhance bad pixel areas. It then uses a connected domain labeling algorithm to identify all candidate bad pixel areas and extract the bounding rectangle, area, location, and contrast attributes of each candidate bad pixel area.
[0021] The time domain analysis module is used to match and track the candidate bad pixel areas detected in continuous frames using the optimal matching method, combine the spatial position and area characteristics of the candidate bad pixel areas, establish the correspondence between the candidate bad pixel areas across frames, judge the continuity of the same candidate bad pixel area on the time axis, and judge whether the requirements of the area stability assumption and the time domain continuity assumption are met. Only candidate bad pixel areas that meet both assumptions and whose area and contrast exceed the set threshold are finally judged as stable bad pixels and output.
[0022] The third aspect of the present invention provides: a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned bad pixel detection methods combining spatial domain analysis and time domain analysis is implemented.
[0023] The beneficial effects of the present invention are:
[0024] 1) By analyzing the stability of bad pixels in a time series, this method can effectively identify abnormal bad pixels that persist across multiple frames. It is particularly stable and accurate in detecting small, low-contrast bad pixels. This method offers greater robustness and adaptability in dynamic scenes, which is the core of the improved performance of this method.
[0025] 2) Improved detection accuracy and robustness: This method integrates image processing operations such as grayscale conversion, median filtering, Sobel edge extraction, threshold segmentation, and morphological closing within each image frame, making bad pixel regions more prominent in the spatial domain and facilitating subsequent identification. Furthermore, connected component analysis and contrast calculation are introduced to comprehensively evaluate the geometric and brightness properties of each candidate region, effectively distinguishing true bad pixels from background texture and noise artifacts.
[0026] 3) Significantly Reduced False Detection and Missed Detection Rates: Unlike traditional methods that rely solely on single-frame imagery, this method, after completing initial spatial screening, further incorporates a temporal analysis strategy. This algorithm uses the Hungarian algorithm to match and track bad pixel regions across frames, and assesses the stability of candidate regions based on the assumptions of "area stability" and "temporal continuity." This mechanism eliminates occasional noise points and briefly flashing targets, effectively reducing false positives.
[0027] 4) Improving the stability and reliability of detection results: By counting the frequency and area changes of bad pixels within a time window and setting a reasonable threshold for screening, the final output only includes targets that are stable and have consistent shapes across multiple consecutive frames. This improves the reliability of detection results in practical applications and avoids the impact of external interference such as brightness jumps and image jitter.
[0028] 5) Applicable to complex backgrounds and dynamic imaging scenarios: Because the present invention adopts a joint spatial and temporal analysis method, the judgment of bad pixels not only relies on spatial features but also fully considers the behavioral patterns in the temporal dimension. Therefore, it is more suitable for image sequence detection tasks with complex backgrounds, unstable environments, or certain dynamic changes, and has stronger generalization capabilities.
[0029] 6) This invention significantly improves the accuracy, stability, and robustness of bad pixel detection through a structured and modular detection process, combined with spatial enhancement and temporal stability determination, and has high engineering practical value and promotion potential. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Flow chart of the method of the present invention;
[0031] Figure 2 Provide a flow chart for airspace analysis;
[0032] Figure 3 This is the time domain analysis flow chart;
[0033] Figure 4 Schematic diagram of contrast calculation for candidate bad pixel areas. DETAILED DESCRIPTION
[0034] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.
[0035] See Figure 1-Figure 4 The first aspect of the present invention provides: a bad pixel detection method combining spatial domain analysis and time domain analysis, comprising the following steps:
[0036] In the spatial domain analysis phase, each image frame is first converted to grayscale. Next, a median filter is used to filter noise and edge information is extracted using the Sobel operator. The image is then binarized using threshold segmentation, and a morphological closing operation is used to fill potential holes and enhance the bad pixel areas. A connected component labeling algorithm is then used to identify all candidate bad pixel areas, and the bounding rectangle, area, location, and contrast attributes of each candidate bad pixel area are extracted.
[0037] In the time domain analysis stage, the candidate bad pixel areas detected in continuous frames are matched and tracked using the optimal matching method. The spatial position and area characteristics of the candidate bad pixel areas are combined to establish the correspondence between the candidate bad pixel areas across frames. The continuity of the same candidate bad pixel area on the time axis is judged, and whether the requirements of the area stability assumption and the time domain continuity assumption are met. Only candidate bad pixel areas that meet both assumptions and whose area and contrast exceed the set threshold are finally judged as stable bad pixels and output.
[0038] In this embodiment, since there are holes in the middle of the binarized image, the present invention applies a morphological closing operation to the binary image to fill the potential holes and enhance the bad pixel areas. The morphological closing operation combines the dilation and erosion operations to process the image using specific structuring elements.
[0039] The present invention uses a connected domain labeling algorithm to identify all candidate bad pixel regions. The connected domain labeling algorithm can mark the bounding rectangle, area, and position attributes of the candidate bad pixel region Blob. In order to further characterize the significance of the bad pixel, the system also calculates the contrast of each candidate bad pixel region, which is defined as the mean grayscale value I of the pixels in the candidate bad pixel region. inner The grayscale mean of its neighborhood background pixels I outer The ratio between:
[0040] ;like Figure 4 As shown in the figure, the black area is the bad pixel area, the gray area is the neighborhood, and the width and height of the neighborhood are twice that of the candidate bad pixel area. This indicator can effectively distinguish between background texture and real bad pixels.
[0041] After extracting candidate bad pixels in the spatial domain, the system performs temporal tracking of the candidate bad pixel regions. During the matching process, the Hungarian algorithm or other optimal matching methods can be used, combining the spatial location and area characteristics of the regions to establish correspondence between candidate bad pixel regions across frames. To improve robustness, this paper introduces two temporal stability assumptions.
[0042] The area change of a real bad pixel in consecutive frames should be small, so the area stability assumption is introduced; at the same time, a real bad pixel should be detected in several consecutive frames, rather than being intermittent or flickering, so the time domain continuity assumption is introduced.
[0043] Only when both assumptions are met and both the area and contrast of the candidate bad pixel exceed the set thresholds will it be finally determined as a stable bad pixel and output. This time-domain analysis process not only improves the success rate of detecting small bad pixels, but also significantly reduces false detections caused by factors such as noise and brightness jumps.
[0044] In some embodiments, extracting edge information using a Sobel operator includes the following steps:
[0045] The Sobel operator convolves the image with two 3×3 convolution kernels and calculates the horizontal gradient using the horizontal gradient operator and the vertical gradient operator. and vertical gradient , calculate the total gradient amplitude G for each pixel: .
[0046] In some embodiments, binarizing the image by threshold segmentation includes the following steps:
[0047] Pixels with a value greater than or equal to the threshold are considered edge pixels and assigned a value of 255; pixels with a value less than the threshold are considered non-edge pixels and assigned a value of 0.
[0048] In some embodiments, determining the area stability hypothesis comprises the following steps:
[0049] For a candidate bad point b, the detection area in the tth frame is recorded as A t , the detection area of the t-1 frame is recorded as A t-1 , defining the area change rate for:
[0050] ;
[0051] when When , the candidate bad point b is judged to meet the requirements of the area stability assumption, where is the set area change threshold.
[0052] In some embodiments, the determination of the time domain continuity hypothesis includes the following steps:
[0053] Define that within the continuous time window T frames, the number of frames in which a candidate bad point b is detected is N detected , set the minimum detection rate threshold ;
[0054] when When , the candidate bad point b is judged to meet the requirements of the time domain stability assumption.
[0055] In some embodiments, the optimal matching method is the Hungarian algorithm.
[0056] A second aspect of the present invention provides: a bad pixel detection system combining spatial domain analysis and time domain analysis, for implementing any of the above-mentioned bad pixel detection methods combining spatial domain analysis and time domain analysis, comprising:
[0057] The spatial domain analysis module is used to convert each image frame into grayscale, then use median filtering to filter noise and extract edge information using the Sobel operator. It then uses threshold segmentation to binarize the image and uses morphological closing operations to fill potential holes and enhance bad pixel areas. It then uses a connected domain labeling algorithm to identify all candidate bad pixel areas and extract the bounding rectangle, area, location, and contrast attributes of each candidate bad pixel area.
[0058] The time domain analysis module is used to match and track the candidate bad pixel areas detected in continuous frames using the optimal matching method, combine the spatial position and area characteristics of the candidate bad pixel areas, establish the correspondence between the candidate bad pixel areas across frames, judge the continuity of the same candidate bad pixel area on the time axis, and judge whether the requirements of the area stability assumption and the time domain continuity assumption are met. Only candidate bad pixel areas that meet both assumptions and whose area and contrast exceed the set threshold are finally judged as stable bad pixels and output.
[0059] The third aspect of the present invention provides: a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned bad pixel detection methods combining spatial domain analysis and time domain analysis is implemented.
[0060] The foregoing description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein and should not be construed as excluding other embodiments. Rather, the present invention can be used in various other combinations, modifications, and environments and can be modified within the scope of the concept described herein through the above teachings or techniques or knowledge in the relevant field. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention are intended to be protected by the appended claims.
Claims
1. A bad pixel detection method combining spatial domain analysis and temporal domain analysis, characterized by: The following steps are involved: In the spatial domain analysis phase, each image frame is first converted to grayscale. Next, a median filter is used to filter noise and edge information is extracted using the Sobel operator. The image is then binarized using threshold segmentation, and a morphological closing operation is used to fill potential holes and enhance the bad pixel areas. A connected component labeling algorithm is then used to identify all candidate bad pixel areas, and the bounding rectangle, area, location, and contrast attributes of each candidate bad pixel area are extracted. In the time domain analysis phase, the optimal matching method is used to match and track candidate bad pixel areas detected in consecutive frames. The spatial position and area characteristics of the candidate bad pixel areas are combined to establish a correspondence between candidate bad pixel areas across frames. The continuity of the same candidate bad pixel area on the time axis is determined, and whether the area stability assumption and the time domain continuity assumption are met. Only candidate bad pixel areas that meet both assumptions and whose area and contrast exceed the set threshold are finally determined to be stable bad pixels and output. The determination of the area stability hypothesis includes the following steps: For a candidate bad point b, the detection area in the tth frame is recorded as A t , the detection area of the t-1 frame is recorded as A t-1 , defining the area change rate for: ; when When , the candidate bad point b is judged to meet the requirements of the area stability assumption, where is the set area change threshold; The determination of the time domain continuity assumption includes the following steps: Define that within the continuous time window T frames, the number of frames in which a candidate bad point b is detected is N detected , set the minimum detection rate threshold ; when When , the candidate bad point b is judged to meet the requirements of the time domain stability assumption.
2. The bad pixel detection method combining spatial domain analysis and temporal domain analysis according to claim 1, characterized in that: Extracting edge information using the Sobel operator includes the following steps: The Sobel operator convolves the image with two 3×3 convolution kernels and calculates the horizontal gradient using the horizontal gradient operator and the vertical gradient operator. and vertical gradient , calculate the total gradient amplitude G for each pixel: .
3. The bad pixel detection method combining spatial domain analysis and temporal domain analysis according to claim 1, characterized in that: The image binarization by threshold segmentation includes the following steps: Pixels with a value greater than or equal to the threshold are considered edge pixels and assigned a value of 255; pixels with a value less than the threshold are considered non-edge pixels and assigned a value of 0.
4. The bad pixel detection method combining spatial domain analysis and temporal domain analysis according to any one of claims 1 to 3, characterized in that: The optimal matching method is the Hungarian algorithm.
5. A bad pixel detection system combining spatial domain analysis and temporal domain analysis, characterized by: The method for implementing the bad pixel detection method combining spatial domain analysis and temporal domain analysis as claimed in any one of claims 1 to 4 comprises: The spatial domain analysis module is used to convert each image frame into grayscale, then use median filtering to filter noise and extract edge information using the Sobel operator. It then uses threshold segmentation to binarize the image and uses morphological closing operations to fill potential holes and enhance bad pixel areas. It then uses a connected domain labeling algorithm to identify all candidate bad pixel areas and extract the bounding rectangle, area, location, and contrast attributes of each candidate bad pixel area. The time domain analysis module is used to match and track the candidate bad pixel areas detected in continuous frames using the optimal matching method, combine the spatial position and area characteristics of the candidate bad pixel areas, establish the correspondence between the candidate bad pixel areas across frames, judge the continuity of the same candidate bad pixel area on the time axis, and judge whether the requirements of the area stability assumption and the time domain continuity assumption are met. Only candidate bad pixel areas that meet both assumptions and whose area and contrast exceed the set threshold are finally judged as stable bad pixels and output.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are loaded and executed by the processor, the bad pixel detection method combining spatial domain analysis and time domain analysis as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Dynamic adaptive depth camera occlusion detection method, system and device, and storage medium
CN120182813A