I want to crop out eyes, nose and mouth at the same time.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a code inwhich i can detect the face, eyes, nose and mouth and crop them individually. But what i want know is to crop the eyes, nose and mouth at the same time so that they all appear in the window instead of seperate windows. Pls can someone help me with a code for it or help me adjust mine. I have tried but to no avail. Here is my codes
%
I = imread('05_02.jpg');
J = imresize(I,0.5);
% %To detect Face
FDetect = vision.CascadeObjectDetector;
%Returns Bounding Box values based on number of objects
BB = step(FDetect,J);
%
figure,
imshow(J); hold on
rectangle('Position',BB,'LineWidth',3,'LineStyle','-','EdgeColor','y');
title('Face Detection');
hold off;
Face=imcrop(J,BB);
figure,imshow(Face)
%To detect Eyes
EyeDetect = vision.CascadeObjectDetector('EyePairBig');
BB=step(EyeDetect,J);
figure,imshow(J);
rectangle('Position',BB,'LineWidth',4,'LineStyle','-','EdgeColor','b');
title('Eyes Detection');
Eyes=imcrop(J,BB);
figure,imshow(Eyes);
%To detect Nose
NoseDetect = vision.CascadeObjectDetector('Nose','MergeThreshold',64);
BB=step(NoseDetect,J);
figure,
imshow(J); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',2,'LineStyle','-','EdgeColor','b');
end
title('Nose Detection');
hold off;
nose=imcrop(J,BB);
figure,imshow(nose);
%To detect Mouth
MouthDetect = vision.CascadeObjectDetector('Mouth','MergeThreshold',128);
BB=step(MouthDetect,J);
figure,
imshow(J); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','r');
end
title('Mouth Detection');
hold off;
mouth=imcrop(J,BB);
figure,imshow(mouth);
2 comentarios
KSSV
el 12 de Nov. de 2018
How it going to matter? If you do all at once or one after another? If you want to display them in a singl eplot..use hold on and use imshow. Note that you need to use different p[positions to them to plot. Or mask the unwanted region and show only required.
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!