cv.jit.blob.centroids defaults to "0"

lisamarie's icon

Hello-

I am using the cv.jit.blob.centroids object to track finger positions on a homemade multi-touch table. If someone is touching the table, the patch works perfectly. The fingers
are tracked as blobs and I am able to attach shapes and trails
to the positions of the fingers. The problem I'm having is that if the person lifts their fingers off the table, the first blob defaults to "0", causing the shape and trail to jump to the corner. This makes for a rather jagged user experience.

My goal is to have the x,y position stay where the last finger was positioned rather than the "0" effect.

Below is a striped down version of the patch I'm using. It might be difficult to recreate what is happening unless you
have a dark object with 1 point of white on it. (I've been using a CD case with a piece of white tape for testing). The image I'm tracking from the multi-touch table is basically dark blue except for where the fingers are and those spots are bright white.

Any help would be greatly appreciated!!
Lisa Marie

Max Patch
Copy patch and select New From Clipboard in Max.

Zachary Seldess's icon

Hi Lisa Marie,

Here's the way I often do this, considering you're using jit.iter. Look inside the filterZeros subpatch.

best,
Zachary

Max Patch
Copy patch and select New From Clipboard in Max.

lisamarie's icon

Thank you for the simple fix Zachary!
Your project at the ZKM looks to have been a big success.
Congratulations!