How can I deal or track only one face while I have detected all the faces in front of camera?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Aurele Turnes
2014 年 8 月 5 日
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 件のコメント
Aurele Turnes
2014 年 8 月 15 日
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?
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!