Integer Motion Controller ππ ‘π £π
Motion Detection, but the Output Counts Whole Numbers
- image
- roi_chain
- INT
- MASK
Motion Controller's integer sibling. Integer Motion Controller watches a frame for motion, but instead of a smooth float it hands you a whole number - which makes it the node to reach for when the thing you're driving wants discrete values. Think counters, stage indices, preset slots, or anything that steps rather than glides.
It inherits everything from Motion Controller: frame-differencing against the previous frame, Gaussian blur (blur_size), a threshold for what counts as motion, and an roi_chain of regions of interest from an ROINode. Each ROI carries an action - trigger, momentary, toggle, counter, or the math ops add/subtract/multiply/divide/set - and that action decides how the value changes when motion is detected in that region. The one real addition is rounding_mode, and it's where the integer-ness gets interesting.
rounding_mode offers four ways to convert the internal float to an int: round (nearest, the default), floor (always down), ceil (always up), and truncate (chop the decimal). It sounds pedantic, but it changes the feel of an effect. If your ROI action is add with a tiny value, ceil makes the count climb fast while floor makes it stick stubbornly low; if you're mapping motion to a discrete effect, picking the right rounding is half the tuning.
The inputs that matter
- roi_chain - the
ROIfrom an ROINode; defines where motion counts and what it does. - image - the frame to analyze.
- threshold - sensitivity, 0β1.
- minimum_value / maximum_value - the integer output range (defaults 0β100).
counterin particular uses this range to wrap its count. - rounding_mode -
round,floor,ceil, ortruncate.
Outputs: INT and MASK (the motion mask, same as the float version).
Install & gotchas
Same pack, ryanontheinside/ComfyUI_RealtimeNodes - ComfyUI Manager (search "Control Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RealtimeNodes
cd ComfyUI_RealtimeNodes
pip install -r requirements.txt
All the Motion Controller caveats apply: it's stateful and needs to run every frame, so a single still image produces no motion by definition; it clamps to min/max; and too-low a threshold turns webcam noise into jitter. The integer twist adds one more: because the value is quantized, small changes in motion can snap the output between adjacent integers - that's the rounding doing its thing, not a glitch. If you wanted smooth motion feeding a continuous parameter, you picked the wrong one of the pair. If you want "wave and it advances a preset by one," this is exactly right.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| always_execute | BOOLEAN | true | When enabled, the node updates every execution |
| image | IMAGE | β | |
| roi_chain | ROI | β | |
| threshold | FLOAT | 0.100β1 | Motion detection threshold |
| blur_size | INT | 51β21 | Size of Gaussian blur kernel |
| minimum_value | INT | 0 | Minimum output value |
| maximum_value | INT | 100 | Maximum output value |
| starting_value | INT | 0 | Initial output value |
| rounding_mode | COMBO | round | 4 options: round, floor, ceil, truncate |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |
| MASK | MASK | β |