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!
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.
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).
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?
Thanks!
I did this, but for some reason, it only starts counting after there is more than one face??
it's indexed from 0 so your first face is 0!!
If you don't mind, this is what I got so far, could you take a look at this?
how about something like this:
It should work like this: