My camera sensor has dead pixels (also known as "hot pixels"). I have used the PixelPatcher Vegas filter for quite some time but I really want to move this to my import flow, which is based on AviSynth. This filter is an attempt to recreate the PixelPatcher functionality in the form of an AviSynth filter.
The filter exports one function
HealDeadPixels() which takes a clip and path to an image file. All major image formats are supported, although png is probably the best choice here. The image must have the same dimensions as the clip (e.g. 1920 x 1080). Each pixel in the image with at least one color component larger than 127 (in other words, each bright pixel in the image) will be considered dead and in the video its value will be interpolated using a small number of its non-dead neighbors. The function requires the clip to be in one of the RGB color spaces. Use
ConvertToRGB() if needed.
LoadPlugin("HealDeadPixels.dll") ConvertToRGB() HealDeadPixels("pixel_mask.png")
This is what I get when I record a video with the lens cap on.
Going monochrome and applying a very steep luminosity curve yields this.
Using this image as a dead pixel mask with the HealDeadPixels filter heals the original video. Here's a frame from an actual real world video, before and after. Can you spot the bad pixels?
Just for fun, let's try an extreme dead pixel mask with a test video to see how the pixel interpolation works. Here's the mask.
Before and after test video frames.