Forums > Jitter

How to count the number of faces

December 28, 2010 | 6:49 pm

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!


December 28, 2010 | 7:07 pm

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.



MIB
December 28, 2010 | 7:32 pm

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


December 28, 2010 | 7:53 pm

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!


December 28, 2010 | 8:03 pm
– Pasted Max Patch, click to expand. –

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



MIB
December 28, 2010 | 9:48 pm

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

– Pasted Max Patch, click to expand. –

December 28, 2010 | 10:55 pm

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


MIB
December 29, 2010 | 2:19 am

how about something like this:

– Pasted Max Patch, click to expand. –

December 30, 2010 | 3:47 pm

It should work like this:

– Pasted Max Patch, click to expand. –

Viewing 9 posts - 1 through 9 (of 9 total)