The “Retoucher” of CMOS Sensors: A Deep Dive into ISP Bad Pixel Correction Algorithms

We take photos with our smartphones every day, capturing moments of our lives. However, you may not realize that the raw data collected from the CMOS sensor at the moment the shutter is pressed is often filled with “flaws.” So why do the final images look so clean? This is thanks to a behind-the-scenes hero—the Image Signal Processor (ISP)—and its crucial internal “repair magic”: bad pixel correction algorithms.

1

The Source of the Problem: “Flaws” on the CMOS Sensor

First, we need to understand where the problem originates. The core of the camera is the CMOS image sensor, which you can think of as a massive grid composed of millions or even billions of pixels. Each pixel is responsible for receiving light and converting it into an electrical signal.

However, while a perfect CMOS chip theoretically exists, it is challenging to achieve in reality. Due to microscopic differences in the manufacturing process, long-term use, or high-temperature and high-humidity environments, some pixels inevitably become “unruly”:

Bright Bad Pixels: They act like an “overzealous employee,” continuously outputting an abnormally high signal even in complete darkness, resulting in a permanent bright spot or color blotch in the final photo.

Dark Bad Pixels: In contrast, these pixels are completely “on strike,” outputting black regardless of the light intensity.

If these flaws are not addressed, they will permanently mar every photo, much like an ink stain on a white shirt. The ISP’s bad pixel correction algorithm is designed to automatically fix these ink stains.

The "Retoucher" of CMOS Sensors: A Deep Dive into ISP Bad Pixel Correction Algorithms

2

The Foundation of the Algorithm: Static Bad Pixel Correction and the “Bad Pixel Map”

This is the most basic and core correction method, akin to a teacher managing a class with a “watch list” of students. It consists of two phases:

Phase One: Establishing a “Blacklist”—The Bad Pixel Map

This process is typically completed before the phone leaves the factory or when the camera is powered on. The system prompts the sensor to take a quick shot in complete darkness (with the lens cap on).

Algorithm Logic: In the absence of light, normal pixels will only output a very low and uniform random noise (background noise). Bad pixels, however, will “stand out,” outputting an abnormally high signal far above the average level.

Execution Process: The ISP scans the raw image output from the entire sensor and uses a threshold judgment algorithm to record the coordinates (e.g., row X, column Y) of all pixels whose output signal exceeds a predetermined threshold, generating a bad pixel map that is permanently stored in the device’s memory.

Phase Two: Real-Time Repair—The “Neighborhood Interpolation” Algorithm

When users take photos normally, the ISP will reference this “bad pixel map” in real-time. For each bad pixel marked on the map, the ISP will never use the erroneous data it provides. So what will it use instead? The answer is:to seek help from its neighbors.

The most commonly used and efficient algorithm is the median filtering algorithm.

How does it work? Imagine a bad pixel sitting in the center of a 3×3 grid. The ISP will immediately gather the brightness values of the surrounding 8 “neighbor” pixels.

1.Collect: Read the values of the surrounding 8 pixels.

2.Sort: Sort these 8 values from lowest to highest.

3.Take the Median: Take the value that is in the middle after sorting (the 4th or 5th largest value) as the final result.

4.Replace: Replace the bad pixel’s original anomalous value with this median value.

Why use the “Median” instead of the “Average”?

Because the average can easily be skewed by another noise point that may exist among the neighbors. The median has excellent resistance to impulse interference, ensuring that the replacement value best represents the true background of the area, making the transition after repair very natural and leaving no trace of the fix.

The "Retoucher" of CMOS Sensors: A Deep Dive into ISP Bad Pixel Correction Algorithms

For example, the process of repairing a bright bad pixel. In a 3×3 pixel grid, the center is marked as a “bad pixel” with a value of 253 (abnormally high). The surrounding 8 pixels are normal, with values of 52, 48, 55, 50, 49, 51, 46, 54.

Algorithm Steps:

1. Sorted as follows:

46,48,49,50,51,52,54,55,253;

2. Median → 51;

3. Replacement → The bad pixel value changes from 253 to 51.

3

The Evolution of the Algorithm: Dynamic Bad Pixel Correction

Static correction is very effective, but CMOS sensors may temporarily produce new “dynamic bad pixels” under high temperatures or prolonged exposure. Advanced ISPs are equipped with smarter dynamic bad pixel correction algorithms.

This algorithm no longer relies on a fixed “blacklist” but performs real-time analysis on each frame of the image. Its core idea is:

Adaptive Threshold Judgment: The ISP analyzes the local statistical characteristics of the current scene. If a pixel’s value significantly deviates from its surrounding pixels (in brightness and color) beyond a dynamically calculated threshold based on the current scene, it will be immediately flagged as a suspicious bad pixel and repaired using the neighborhood interpolation algorithm.

This is akin to a teacher not just looking at the list but continuously observing all students’ performances. Once someone behaves abnormally, immediate intervention occurs. This allows the camera to maintain image purity in various complex environments.

Conclusion

The bad pixel correction algorithm in ISPs is a silent yet remarkable achievement in modern imaging technology. It operates behind the CMOS sensor, functioning within milliseconds to silently erase flaws from every photo. HaiTu Microelectronics has independently developed dynamic bad pixel correction algorithms, continuously optimizing area and power consumption, and has successfully applied them across various product lines.

Disclaimer: Some content is sourced from the internet for educational and communication purposes. The copyright of the article belongs to the original author. If there are any issues, please contact for removal.

Leave a Comment