cv.jit.faces replacing box with image

AmazingRolo's icon

Hello,

I'm working on a simple installation that will recognize faces and replace them with an image. I'm planning on using cv.jit.faces for this.

I'm succeeding in doing this very well with one face. I've simply made my own version of cv.jit.faces.draw, and using the "drawpict" command for jit.lcd. That works great.

The problem is when multiple faces are recognized...rather than place the image where each face is (as cv.jit.faces.draw does by default with the drawrect), it seems to get confused and place the images in between the faces.

I'm imagining that this is because jit.lcd treats images differently than simple shapes, but I can't figure out a solution!

Any help would be great, many thanks in advance.

Jean-Marc Pelletier's icon

Hi,

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

It's not really clear from the documentation, but to get drawpict to draw as you would expect you have to format your message like this: drawpict . Since cv.jit.faces outputs left-top-right-bottom coordinates, you're going to have to massage those numbers a bit, but it should work.

AmazingRolo's icon

Merci Jean-Marc!

That works perfectly, it was definitely a problem with the drawpict command.

Thanks so much, and thanks for your amazing work on cv.jit.

flim's icon

Hello!

Is there a way to allot different pictures to different faces? (So not everyone showing up has the same "face replacement"..?)

Cheers!

Jonas

flim's icon

assuming one has colorbars.pict & colorbars2.pict for replacing two faces.. this might be a simple approach, but for now the "closest" I get (considering my grasp of logic).. apparently this doesn't suit max at all.. where am I mistaking?

cheers!

-jonas

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

flim's icon

ok, I've come this far.. everybody's got his own image as a "face replacement"..

the problem now is that the face appearing last in the camera's view gets the first image. (imagining we only have 2 people looking into the camera, the second person being detected gets the first persons image, respectively image2 suddenly being alloted to the first person)

how can I make the images stick to their "partners", prevent them from swapping..?

cheers!

-jonas

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

strawberryt's icon

I have the same issue except I am not using faces but people silhouettes, so I'm using cv.jit.blob.centroid instead of cv.jit.faces.

will post a sketch once i have a sample of the video input I get.

flim's icon

please do so! any further help appreciated..

best

-j

cap10subtext's icon

Yeah, I think at some point you'll have to use blobs and blob.sort to keep your tracked areas in the right order.

flim's icon

so..

is there a way to use [cv.jit.blobs.sort] in combination with [cv.jit.faces]?

all the best

-jonas

flim's icon

sorry to keep bringing this up. it'll be my last go this week (:

I just saw that I'm not the only one looking for a sorting solution in [cv.jit.faces] (what a surprise), as these earlier posts show

at least I'm relatively sure to be on the right track when aiming for a [cv.jit.blobs.sort] suitable for [cv.jit.faces]

any (modification) hint appreciated!

best

-j

tindolent's icon

Hey

So i have been able to layer an image over the face with the above patches, but how would you take a live camera to replace the box, rather then the image?

I am trying to use cv.jit.faces.draw to take the live feed since jit.lcd can't take video (unless i'm mistaking)

any help would be great!

patch is below

thanks!

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

Les Stuck's icon

There's a brand new build for Mac and Windows that’s 64-bit compatible
and tested on Max 7!

Download the cv.jit Starter Kit at http://www.maxology.club

Leave a comment and let us know how it's working for you!

Happy patching!