How can I deal or track only one face while I have detected all the faces in front of camera?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have face recognition code which recognizes the face and show its name when I will generate the database for that, it is working well when only one face is in front of camera but I am using "FaceDetect = vision.CascadeObjectDetector;" for face detection which will detect all the faces in front of camera and I am getting bounding box around all the faces. Is there any way to track face of my choice among the detected all faces? Or can I code each bounding box face separately? Please give me some guideline. Thanks
0 Commenti
Risposta accettata
Aurele Turnes
il 5 Ago 2014
Once you have created your vision.CascadeObjectDetector object, you can apply it to your image I to detect the faces on the image as follows:
bboxes = step(faceDetect, I);
The returned matrix bboxes is M-by-4, where M is the number of faces detected and the 4 elements describe the bounding box around each face, as explained in the following documentation page:
To access the ith face, you can simply extract the corresponding pixels from the original image:
i = 1;
indexi = bboxes(i,:);
facei = I(indexi(2):indexi(2)+indexi(4),indexi(1):indexi(1)+indexi(3),:);
figure;
imagesc(facei)
You can then pass facei to your face recognition algorithm to detect which person this face corresponds to and track who is on the picture.
3 Commenti
Aurele Turnes
il 15 Ago 2014
It seems like you are getting an error when you use the rgb2gray function because your frame face1 is only a 2D-matrix. The function rgb2gray expects its input to be in color, and thus to be a 3D-matrix. Can you check if your face1 frame is a 3D-matrix?
Più risposte (1)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!