[jit.openni] usermap filtering issue or: how to filter the nearest pixel

LSka's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hello everybody,
I'm trying to filter users in jit.openni's usermap in order to make further separate masking on each silouhette.
However, I'm encountering an issue, as I noticed that jit.openni does correctly output users IDs for every pixel, but it also creates an edge of value "1" around every user.
So, tracking user 1 results in showing a full user's silouhette sorrounded by the "ghosts" of other users, while tracking users >1 obviously works fine.
This patch should explain:

(the attached file is an example matrix frame showing a usermap of two users, I'm also attaching a screenshot for the lazy people ;) )

I think a solution to this issue would be an algorithm like:
"for every pixel value >1, check the nearest pixel, and if it is == 1, set pixel to 0, otherwise pass it".

I was trying to achieve this in jit.gen, but I'm currently stuck with filtering values and then sampling the nearest...maybe someone could give me some hints?

thank you

usermap_0231.jxf_.zip
zip
Screen-shot-2013-08-18-at-13.06.07-.png
png
LSka's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's a little progress, something a bit "dirty":

basically, I am passing the ">1" part into cv.jit.dilate and then subtracting it to the "==1" part. And it kinda works, with some occasional spare pixels left by the subtraction.
Anyway, I'm still looking for a more "elegant" solution...

brendan mccloskey's icon

Hi lska

Straight up I'll say Jitter is a closed book to me, but Sam shows some manipulation of "nearest pixel" logic in his video reverb tutorial. Look for "Delicious Max 6" on YouTube.

HTH

Brendan