Scheduled Binary Comparison | Akatz
Per-frame binarize driven by a schedule — and a default that surprises people
- images
- comparison_schedule
- epsilon_schedule
- images
Most "binary threshold" nodes give you one threshold for the whole image. AK_ScheduledBinaryComparison gives you one threshold per frame, pulled from a schedule list - which makes it the gate between a float schedule and an animation. You hand it an image batch and a list of thresholds, and it binarizes every frame against its own value. Same idea as the audio-reactive pipelines in the KB's animation write-ups: a schedule becomes an on/off mask, frame by frame.
How it works
For each frame i in the batch, it takes comparison_schedule[i] as the threshold and builds an output of pure 1.0/0.0 pixels. The subtle part is the comparison mode:
- With use_epsilon on (the default), a pixel becomes white when it's equal to or within
epsilon[i]of the threshold -|pixel - threshold| <= epsilon, an exact-equality OR'd in. That's a band around the threshold, not a "greater than" test. - With use_epsilon off, a pixel becomes white when it's
>= threshold. That's the plain thresholding most people picture when they hear "binary comparison."
That default matters. If you wire this up expecting a simple high-pass and get a band, flip use_epsilon off. Schedules shorter than the batch get padded by repeating the last value; longer ones get truncated. Both comparison_schedule and epsilon_schedule are expected per-frame lists, the same LIST format the pack's AK_KeyframeScheduler outputs.
Inputs and outputs
- images (
IMAGE) - the batch to binarize. - comparison_schedule (
LIST) - the per-frame thresholds. Feed it fromAK_KeyframeScheduler,AK_AudioFramesyncSchedule, or any LIST output. - epsilon_schedule (
LIST, optional, default[0.1]) - per-frame epsilon for the band mode. - use_epsilon (
BOOLEAN, defaulttrue) - the mode switch described above. - images (
IMAGE) - output, same shape, values pinned to 1.0/0.0.
Installing the pack
Part of Akatz Custom Nodes (akatz-ai/ComfyUI-AKatz-Nodes). ComfyUI Manager: search "Akatz" and install, or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-AKatz-Nodes
Restart ComfyUI; it's under 💜Akatz Nodes. Only torch is needed for this node (already in ComfyUI); the pack's other requirements.txt entries (numpy, opencv-python, pydub) belong to its image/audio nodes. No models. Docs live in the author's Notion page and custom GPT, not the README.
Gotchas
- The default epsilon mode is probably not the behavior you guessed. Test with
use_epsilonoff first if you want straightforward>=thresholding. - Your schedule must line up with the batch length. Padding repeats the last value, which is fine for a hold but silently wrong if you expected per-frame values that aren't there.
- The output images are hard 0/1, so downstream nodes that expect soft or alpha values will get harsh edges. That's the point - just know it going in.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| comparison_schedule | LIST | — | |
| epsilon_scheduleopt | LIST | — | |
| use_epsilonopt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |