JS wave detector research prototype

A little script that tries to detect people waving at a webcam. The debugging images below show the various stages of the computer vision pipeline.

It works by detecting a minimum number of rapid brightness transitions. View the source for more details.

Is someone waving right now: initialising...

Camera image Diff with previous frame Increase contrast
Annotate 0 and 255 Counts ( 0 1 2 3 4 5 6 7+ ) count >= transition threshold

Tweak various constants...

Contrast factor: Larger values make the system more sensitive to poor lighting contrast but more prone to false positives
Max interval: The maximum number of frames to wait between brightness transitions. Too low and the system can't see the relaxed and elderly. Too high and random fidgeting will be classes as a wave.
Transition count: The number of consecutive transitions classified as a wave
Outlier threshold: Ignore potential wave pixels if they have less than this number of wavey neighbours