Hysteresis filter as a VapourSynth plugin, with the same API as
misc.Hysteresis() from vs-miscfilters-obsolete.
Description from vs-miscfilters-obsolete:
Grows the mask in
clipainto the mask inclipb. This is an equivalent of the Avisynth functionmt_hysteresis. Note that both clips are expected to be in the typical mask range which means that all planes have to be in the 0-1 range for floating point formats.Specifically, Hysteresis takes two bi-level masks
clipaandclipband generates another bi-level mask clip. Bothclipaandclipbmust have the same dimensions and format, and the output clip will also have that format.If we treat the planes of the clips as representing 8-neighbourhood undirected 2D grid graphs, for each of the connected components in
clipb, the whole component is copied to the output plane if and only if one of its pixels is also marked in the corresponding plane fromclipa. The argumentplanescontrols which planes to process, with the default being all. Any unprocessed planes will be copied from the corresponding plane inclipa.
pip install vapoursynth-hysteresis
hysteresis.Hysteresis(
clipa: vs.VideoNode,
clipb: vs.VideoNode,
planes: list[int] = [0, 1, 2]
)Rust v1.91.0-nightly and cargo may be used to build the project. Older versions will likely work fine but they aren't explicitly supported.
$ git clone https://github.com/sgt0/vapoursynth-hysteresis.git
$ cd vapoursynth-hysteresis
# Debug build.
$ cargo build
# Release (optimized) build.
$ cargo build --release
# Release build optimized for the host CPU.
$ RUSTFLAGS="-C target-cpu=native" cargo build --release