cv.jit.faces replacing box with image

Jul 5, 2010 at 11:00am

cv.jit.faces replacing box with image


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.

Jul 5, 2010 at 1:17pm


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.

– Pasted Max Patch, click to expand. –
Jul 5, 2010 at 1:42pm

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.

Oct 19, 2010 at 11:18am


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



Oct 25, 2010 at 9:14am

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?



– Pasted Max Patch, click to expand. –
Oct 27, 2010 at 5:19pm

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..?



– Pasted Max Patch, click to expand. –
Oct 27, 2010 at 9:35pm

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.

Oct 28, 2010 at 11:37am

please do so! any further help appreciated..



Oct 30, 2010 at 2:15am

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

Nov 2, 2010 at 10:31am


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

all the best


Nov 3, 2010 at 11:39am

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!



Feb 10, 2011 at 2:12am


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


– Pasted Max Patch, click to expand. –

You must be logged in to reply to this topic.