How to Remove Bright Spots in Images, Webcam, or Video (Dead Pixels)

How to Remove Bright Spots in Images, Webcam Video, or Video (Dead Pixels)

Problem

During camera operation, pixels may light up and disappear “live.” Heating and changes in ISO alter the physical operating characteristics of the semiconductor sensor, causing defects to appear in real time.

Short answer

How to fix it: find the “Dynamic dead pixel correction” effect and select “Light” in the Page context extension.

Result: bright spots stop glowing.

There is also a “Full” mode, but it is suitable for powerful video cards, or for weaker ones if you apply the effect to a regular image rather than video. The source and type do not matter. What matters is that the frame is not scaled.

How people usually solve this

  1. Intuitive simple solution. Such pixels can easily be made less noticeable by reducing the camera resolution. The algorithm averages neighboring pixels, and you get a result where almost 100% of pixels are distorted for the sake of a few very noticeable pixels.
  2. Professional complex solution. Put a cap on the camera, warm it up to operating temperature, etc. Then the algorithm creates a permanent mask for correction.

Problems with common approaches

  1. It does not solve the problem when defective pixels appear right now. Every time people do this, they have already spoiled something before they start fixing it.
  2. A mask removes information about pixels for a long time, even though those pixels may work normally at another ISO or a lower temperature. You can remap defective pixels in hot conditions and block pixels that work normally in cold conditions.
  3. Such functions are not implemented for all cameras.
  4. All of this requires knowledge and skill.
  5. If your camera has a low resolution, you will noticeably lose quality when downscaling.
  6. Most correction algorithms work as a “black box” — the user can only turn them on or off, without knowing how many useful details in the frame were destroyed.

The defect is dynamic, so an adaptive local solution is needed, not a static mask and not global averaging.

Remapping is suitable for stable defects on a specific camera, but dynamic correction is needed because it works when defects appear/disappear depending on conditions.

Solution via the Page context extension

You can select the “Light” or “Full” preset, which works in real time and adapts to each frame. The decision is made based on the current frame, not on a saved mask. No knowledge is required to start a preset, while fine tuning is available for those who need it. For professional correction, there are many parameters for adjustment with suitable visualization of the different algorithm stages. If a pixel has just become defective or has just stopped being defective, the algorithm adapts instantly. When switching to another camera, the algorithm requires no special actions; it works with any image, even video and pictures from the internet. It does not spoil all pixels as downscaling does — it changes only detected defective pixels on the fly.

Capabilities

You can limit the algorithm’s operation by specifying which camera it should apply to, so that high-resolution cameras are not affected due to additional GPU load. You can specify a text template for the camera name to apply it to the desired camera.

Presets

  1. Light — cheaper on GPU, precise per-channel correction, but the patch may stand out and does not cover a blurred defect.
  2. Full — more expensive on GPU, expanded patch with edge blending, higher quality.

Stages

“Final result” stage

How it works

The algorithm creates patches and replaces defects with them. In the final stage, you can adjust the degree to which the patches are blended with the original image. The algorithm uses two types of patches: a precise per-channel patch and an expanded patch with edge blending.

The precise per-channel patch works on the channel where the deviation was found, but this may not be enough for two reasons:

  1. The replacement is made with a patch that may stand out.
  2. The defect may be blurred across several pixels.

To solve these problems, there is an expanded patch that blends with the original, gradually fading toward the edges. However, the expanded patch cannot work normally per-channel because the channels of the original and the expanded patch are inconsistent. Using only the defective channel in the expanded patch would lead to color distortions, so the expanded patch affects all color channels.

Parameter adjustment

  1. Precise mask strength. Adjusts the degree to which the precise per-channel per-pixel patch is blended with the original.
  2. Expanded mask strength. Adjusts the degree of blending with the expanded patch.

“Edge blending” stage

How it works

At the edge-blending stage of the expanded patch, the patch size and the blending of its edges with the original are configured.

To calculate the base for the patch, the detected defective pixel is enlarged in size across all channels, even if the defect is only on one channel. The resulting expanded area is blended with the original.

Display

An additional view shows a black-and-white expanded map of detected defects. You can see in real time how its shape changes when its settings are adjusted.

Parameter adjustment

  1. Blend size. The radius of the expansion zone around the defective pixel. The smaller this size, the smaller the patch halo will be. The larger the value, the larger the area of defects around the defective pixel itself will be corrected. You should start increasing the size while watching how the damaged zone around its central point disappears. Do not increase the size unnecessarily, otherwise useless artifacts from the algorithm will appear in the form of blurred areas.
  2. Blend blur ratio. The blur radius of the blending zone, expressed as a coefficient relative to the blend size.

“Replacement material” stage

A blurred original image is used to replace the area of defective pixels.

Skin blur radius. Sets the blur radius for the blurred original image. The larger this radius, the less the patch on the defective pixel resembles the area of the defective pixel and its immediate surroundings, but the patch may deviate too much from neighboring pixels — this is useful when a whole group of pixels is defective. With a small radius value, the patch can more accurately match neighboring pixels, but the defect itself may be hidden worse — this is useful when the defect is small in area.

“Confirmed defects” stage

How it works

At this stage, the algorithm’s response to the geometric model of defective pixels is configured. Here you set how the adaptive brightness of a defective pixel relates to the maximum of that brightness among surrounding pixels.

The brightness ratio of pixels can involve both large and small absolute values, but small absolute differences are barely noticeable to the eye. Therefore, the maximum adaptive increase in absolute brightness values for the algorithm is limited here.

Display

An additional view shows a map of detected defects that changes in real time, and the user sees the boundary between digital sensor noise and real defects.

Parameter adjustment

  1. Maximum gain (Db). Limits sensitivity in absolute brightness. It shows the limit to which brightness can be increased to detect defective pixels. That is, the larger the value, the less bright defects can be detected. The algorithm itself has artifacts, so in order not to make things worse than they were, defective pixels that are poorly visible probably should not be improved; that is, you should increase the parameter value carefully so that the negative effect does not outweigh the positive one. If you increase the value too much, you can reach a level where you simply start correcting noise and add many artifacts. But if you do not increase it enough, some defective pixels will not be detected at all.
  2. Peak ratio. Sets the minimum ratio of the adaptive brightness of the detected pixel to the maximum of that brightness among neighboring pixels.

“Potential defects” stage

How it works

At this stage, geometric parameters for identifying defective pixels are configured. Here you see a pattern that helps detect defective pixels.

As a rule, you see dark frames around bright pixels.

Display

In the additional view, you can see how the algorithm recognizes defects internally. The dark frames show how the algorithm’s settings fit geometrically for detecting defects, and the brightness of the defects themselves is adaptively amplified.

Parameter adjustment

  1. Defect radius. Here you define the radius within which the algorithm excludes data for calculating the reference brightness value. The higher the parameter value, the larger the recognition zone radius. Usually this value should be from 1 to 3 pixels. With a small radius value, the algorithm poorly recognizes large defective areas, but large values will lead to nearby defects not being detected. When tuning, you should cover the entire defect with dark frames, but not neighboring ones.
  2. Reference border thickness ratio. This is the frame thickness as a fraction of the defect radius. The frame is the reference value for determining an anomaly. The wider the frame, the fewer pixels can be detected.

Limitations

The algorithm works well only on a raw frame without scaling, because it needs the original pixel due to its brightness. If you change the scale, there is almost no point in using the algorithm: it will try to remove much larger objects than pixels, and the information for detecting defects will become difficult to access.

Related questions