フィルターのクリア

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 回表示 (過去 30 日間)
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;

回答 (1 件)

Mehmed Saad
Mehmed Saad 2020 年 5 月 6 日
編集済み: Mehmed Saad 2020 年 5 月 6 日
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 件のコメント
Andrea Verardi
Andrea Verardi 2020 年 5 月 6 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by