3 ms·
K-means clustering is super cool. Myself and a friend used it a few months ago to filter moving things out of webcam video in JavaScript. It takes samples of vi
by Sidnicious 14y ago
K-means clustering is super cool. Myself and a friend used it a few months ago to filter moving things out of webcam video in JavaScript. It takes samples of video and puts the color of each pixel across all the recent samples into clusters, and discards the smaller cluster (for each pixel) because it was probably some object (like a person) moving across the frame without sticking around.
It’s not super performant, but the end result is awesome — after a few seconds, you and up with a picture what your webcam sees minus the moving things. For the curious:
http://sidnicious.github.com/longcamera/k-means/longcamera.html http://sidnicious.github.com/longcamera/k-means/longcamera.h...
(I haven’t touched the code in a while, save for fixing a bug just now)