Docs CHOPs & sensing
MoveDetectDir
Reads which way things move in a camera or any image with optical flow and turns it into left/right and down/up channels, with thresholds, inversion and filtering, for swipe and gesture triggers.
∿ CHOPs & sensing ◆ Patreon:Base
This tool unlocks with Patreon. It installs through the same picker as everything else and unlocks with the Patreon Base tier or higher, connected from inside TouchDesigner. Everything else in the toolkit stays free and MIT, and the membership is what keeps that work moving.
What it is
MoveDetectDir watches an image and tells you which way it is moving. It runs optical flow on the input, measures how much of the flow points left, right, down and up, and when the movement passes a threshold it comes out as two channels: one for left and right, one for down and up. Wave a hand across a camera and the channel swings to the side you swiped to.
Use it to page through a slideshow with a gesture, to steer a scene from a crowd, or to trigger anything that should react to the direction of motion as well as its amount.
It is a member of the FNS operator family: pick it from the FNS tab of the OP Create dialog and it lands as one node.
Inputs and output
- in1 (TOP): the image to watch, usually a camera.
- out1 (CHOP): two channels, LR for left and right movement and DU for down and up.
Parameters
Custom
| Control | Type / default | What it does |
|---|---|---|
Input Filter SizeSize |
number7 | Blur applied to the input before the optical flow, in pixels. More blur ignores small noise. |
Optflow LambdaLambda |
number0.1 | Smoothing of the optical flow: higher values give a steadier, less detailed flow. |
OptFlow ThresholdThreshold |
number0 | The smallest flow that counts as movement; weaker flow is ignored. |
Move Threshold XMovethresholdx |
number300 | How much horizontal movement it takes before LR swings left or right. |
Move Threshold YMovethresholdy |
number300 | How much vertical movement it takes before DU swings down or up. |
Inverse XInversex |
on / offoff | Flip the left/right direction, for a mirrored camera. |
Inverse YInversey |
on / offoff | Flip the down/up direction. |
Filter WidthWidth |
number0.2 | How long the output channels are smoothed over, in seconds. |