Vapoursynth DeSpot

From wiki.selur.net
Jump to navigation Jump to search

DeSpot removes temporal noise that shows up as spots, dots and short streaks: dust and dirt on film, drop-outs and small scratches. It is mainly meant for telecined 8 mm and other film transfers.

Filtering → Vapoursynth → Artifacts

DeSpot controls in Hybrid
DeSpot controls in Hybrid

What it does

A pixel becomes a spot candidate when it is brighter or darker than the same place in both the previous and the next frame. Candidates are grown into spots; spots that are too large or touch moving areas are kept, all others are replaced from the neighbor frames. Detection and removal work on luma; chroma only changes with Color correction or the highlight view. In Median mode every static pixel is instead replaced by the temporal median of three frames.

Settings

Control Parameter Range / values Hybrid default Meaning
Mode median Spot removing, Median mode Spot removing Median mode replaces static pixels with the 3-frame median; the spot settings are then disabled (Count stays usable).
Difference P1 / P2 p1, p2 0 – 255 24 / 12 P1: difference needed to start a spot; P2: difference for neighbor pixels to join it (8-bit scale).
max Dimensions w/h pwidth, pheight 0 – 32000 16 / 5 Larger spots are kept.
ranked ranked on/off on Compare with the minimum/maximum of three pixels in the previous and next frame instead of one each; steadier on noisy video.
Remove sign only light spots any outliers, only light spots and outliers, any spots and outliers, only dark spots and outliers, only dark spots any outliers any spots and outliers Which spots (light, dark or both) and outliers are removed.
Limit (min/max) minpts, maxpts 0 – 10000000 0 / 0 Smallest and largest pixel count of a spot; 0 = no limit.
Relative p1percent 0 – 100 10 Smallest percentage of pixels above P1 in a spot.
Dilate dilate 0 – 1000 1 Grows removed spots to cover soft edges.
fit luma fitluma on/off off Adapts the luma of replaced pixels to the surroundings.
Blur blur 0 – 4 1 Blur length across the borders of removed spots.
Temporal smooth tsmooth 0 – 255 0 Smooths static areas; 0 = off, 4 – 8 is a good start.
Motion detection motpn on/off on On: compare the previous with the next frame; off: previous with current and current with next (the method before version 3.0).
Scene mscene 0 – 100 40 If more than this percentage of the frame moves, nothing is removed (scene change).
Segment removing method seg 0 – 2 2 0: remove spot pixels without any overlap with motion (strongest); 1: line segments; 2: only whole spots (safest).
Color correction color on/off off Replaces the chroma of removed spots with the mean of three frames.
Count – 1 – 25 1 Number of DeSpot passes in a row (both modes).
Motion thresh/width/height/erode mthres, mwidth, mheight, merode 0 – 255, 0 – 32000, 0 – 32000, 0 – 100 16 / 7 / 5 / 33 Motion detection used in both modes; the threshold should be above P2.
Show show none, highlight, motion map none Tuning views: highlight paints spots in the Mark color and brightens motion; the motion map shows removed spots, kept spots, motion and the rest as gray levels.
Mark mark_v 0 – 255 255 Color of the highlight (only with highlight); the value modulo 3 picks pink, green or gray chroma.
Show chroma show_chroma on/off off Keeps the clip's chroma in the motion map instead of gray (only with motion map).

Example

Default settings on a 10-bit YUV 4:2:0 source:

# spot/dot removal using DeSpot
clip = core.despot.DeSpot(clip)

How Hybrid calls it

  • DeSpot works on 8 – 16-bit integer YUV (4:2:0, 4:2:2, 4:4:4, 4:1:0, 4:1:1, 4:4:0) and gray clips; other formats are converted first.
  • Values are passed on the 8-bit scale; the plugin scales P1, P2, the motion threshold, Temporal smooth and Mark to the bit depth itself.
  • Each value is only written when it differs from the default; Hybrid's defaults equal the plugin's. In median mode only median=1 and the motion and show values are written.
  • With Count above 1 the call is repeated in a loop.
  • DeSpot also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The plugin

DeSpot 3.7.0 is a port of Fizick's DeSpot 3.6.3, which is based on Kevin Atkinson's Conditional Temporal Median Filter. The output is the same as 3.6.3 apart from fixed defects; the port adds multithreading, SIMD code, 9 – 16 bit and more subsampling formats. The first and the last frame are returned unchanged. Old documentation lists other defaults for pwidth and fitluma than the binaries ever used.

Tuning

The README suggests: make the maximum dimensions a little larger than the specks, usually keep P1 above the motion threshold and that above P2, use the show views while tuning, set Temporal smooth to 4 – 8 for noisy static areas and lower Scene against artifacts at scene changes.

Sources