How to count the number of faces

Dec 28, 2010 at 6:49pm

How to count the number of faces

Hi Everyone,
I’m trying to set up a patch with the cv.jit.faces object and I need some sort of attribute that gives me the ability to count the number of faces of detected. You see, I want the patch to do one thing if there are LESS than 3 faces and another if there are MORE than 3.

I hope my question is clear and I would really appreciate anyone to share some thoughts on the problem at hand.

Thanks!

#54141
Dec 28, 2010 at 7:07pm

This solution is mentioned in the [cv.jit.faces] help file.

Send message getnfaces to [cv.jit.faces] connect to the second outlet [route nfaces] with a [number] box and you have what you want.

#194810
Dec 28, 2010 at 7:32pm

another way would be to use jit.iter to get the count of the faces. since you have to use jit.iter in any case to do anything useful. use the middle outlet to get the instance number. look for the highest number + 1 and you have the amount of faces found (+1 because they are indexed from 0).

#194811
Dec 28, 2010 at 7:53pm

BITter, thank you for your reply but I checked the help file and tried the getnfaces message, and I was unable to make any use of it.

MIB, thank you as always for your immediate response. I’m trying to do what you said, but for some reason I can’t seem to piece the parts together. Do you mind taking a look at what I’ve put together so far?

– Pasted Max Patch, click to expand. –

Thanks!

#194812
Dec 28, 2010 at 8:03pm
– Pasted Max Patch, click to expand. –

I did this, but for some reason, it only starts counting after there is more than one face??

#194813
Dec 28, 2010 at 9:48pm

it’s indexed from 0 so your first face is 0!!

– Pasted Max Patch, click to expand. –
#194814
Dec 28, 2010 at 10:55pm

If you don’t mind, this is what I got so far, could you take a look at this?

– Pasted Max Patch, click to expand. –
#194815
Dec 29, 2010 at 2:19am

how about something like this:

– Pasted Max Patch, click to expand. –
#194816
Dec 30, 2010 at 3:47pm

It should work like this:

– Pasted Max Patch, click to expand. –
#194817

You must be logged in to reply to this topic.