cv.jit.faces: keeping order with [coll]'s renumber argument?

flim's icon

hello!

I'm trying to replace faces with individual images. the problem is, that in my current set-up image1 always stays present. meaning, when person1 "leaves the building" his image(1) swaps to person2 (automatically replacing image2).

jean-marc pelletier has come up with something similar with cv.jit.touches[recycle] to keep the order in place - its core being [coll]'s renumber argmuent (which looks more promising than modifying [cv.jit.blobs.sort] for my purpose)

does anyone have hints/suggestions on how to keep an order in this with [coll]?

thankful for ANY hint..
best
-jonas
(images in the zip file)

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

my set-up:

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

jean-marc's [cv.jit.touches.recycle] solution:

1357.face_replace.zip
zip
flim's icon

I'm giving up on the [coll] approach, I feel there's no need for that..

in the meanwhile I'd be grateful for at least somebody telling me WHY the coordinates of my second face being detected are allocated to the value of my first?

best

-jonas

Jean-Marc Pelletier's icon

The object does not in any way track faces in time. It works on a frame per frame basis. There is no guarantee that the same person's face will show up at the same index.

Of course, this is a problem for what you are doing. The simplest solution is to try to sort the faces yourself. You could, for instance use cv.jit.track to find out where the person's nose (in the middle of the face) moved. If it's inside a face rect then it's probably the same person.

JM

flim's icon

thanks for replying, jean-marc!

that's something I'll have to wrap my head around. (:

I've found this patch by nesa, which at least works with cv.jit.track & cv.jit.faces in one patch.. does this get me close - would you think this to be a good starting point (for modification)?

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

cheers!

& all the best

-j

Nick's icon

Thanks for that link to nesa's patch Jonas - still works in 64bit Max 7, 6 years later!