Hi, I have a problem. I wrote a code that recognizes faces, mouths and noses. Now I can't write the code that, if the code doesn't find out the mouth and nose in a photo, will tell that the person is wearing something on them. Thanks
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
FDetect = vision.CascadeObjectDetector;
I = imread ('Test 3.jpg');
figure(1),imshow(I);
title ('foto da analizzare');
BB = step(FDetect,I);
figure(2),
imshow (I); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
end
title ('focalizzazione volto');
hold off;
NoseDetect = vision.CascadeObjectDetector('Nose','MergeThreshold',16);
BB=step(NoseDetect,I);
figure(3),
imshow(I);hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','b');
end
title ('focalizzazione naso');
hold off;
MouthDetect = vision.CascadeObjectDetector('Mouth','MergeThreshold',16);
BB=step(MouthDetect,I);
figure(4),
imshow(I);hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','g');
end
title ('focalizzazione bocca');
hold off;
0 Kommentare
Antworten (1)
Mehmed Saad
am 6 Mai 2020
Bearbeitet: Mehmed Saad
am 6 Mai 2020
I am assuming a single person face for this purpose
After detection of the face, the next thing to do is detect nose (now do not detect nose if face doesn't exist and donot apply that on the whole picture )
In nose detection, the position of nose is BB in imaga I given by NoseDetect which is
BB=step(NoseDetect,I);
Now remember if BB is empty it means no nose is detected in the current figure and if BB is not empty nose is detected.
Hint: isempty, save value of nose detected or not in a variable
Follow a simialr step for mouth (you may need to change threshold of mouth detection)
Now suppose i have two variables, one for nose_detected and other for mouth_detected.
Hint: they will be boolean
so now at the end of the code you can (and) both variable and tell if a person is wearing mask or not
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!