Borrar filtros
Borrar filtros

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 visualización (últimos 30 días)
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;

Respuestas (1)

Mehmed Saad
Mehmed Saad el 6 de Mayo de 2020
Editada: Mehmed Saad el 6 de Mayo de 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 )

Nose Detection

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
  1 comentario
Andrea Verardi
Andrea Verardi el 6 de Mayo de 2020
I understand what you meant, but which is the code to have the result you had in the fisrt picture you posted?
Thank you in advance

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by