Advertisement
Kali_prasad

v1 fmd with basic working code

Apr 15th, 2022
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. clc
  2. clear all;
  3. close all;
  4. cam=webcam(1);
  5. while true
  6. e=cam.snapshot;
  7. FDetect=vision.CascadeObjectDetector('Mouth','MergeThreshold',100);
  8. I=e;
  9. BB_Mouth=step(FDetect,I);
  10. imshow(I);
  11. hold on;
  12. %%
  13. FDetect=vision.CascadeObjectDetector('Nose','MergeThreshold',16);
  14. I=e;
  15. BB_Nose=step(FDetect,I);
  16. imshow(I);
  17. hold on;
  18. if(sum(sum(BB_Nose))==0 && sum(sum(BB_Mouth))==0)
  19. FDetect=vision.CascadeObjectDetector('FrontalFaceLBP','MergeThreshold',10);
  20. BB_Mouth=step(FDetect,I);
  21. if(sum(sum(BB_Mouth))~=0)
  22. title('Remove Hand Please');
  23. else
  24. title('Mask Present');
  25. end
  26. elseif((sum(sum(BB_Nose))~=0 && sum(sum(BB_Mouth))==0)||(sum(sum(BB_Nose))==0 && sum(sum(BB_Mouth))~=0))
  27. for i=1:size(BB_Nose,1)
  28. rectangle('Position',BB_Nose(i,:),'Linewidth',5,'LineStyle','-','EdgeColor','r');
  29. end
  30. for i=1:size(BB_Mouth,1)
  31. rectangle('Position',BB_Mouth(i,:),'Linewidth',5,'LineStyle','-','EdgeColor','r');
  32. end
  33. title('Please wear mask properly');
  34. else
  35. for i=1:size(BB_Nose,1)
  36. rectangle('Position',BB_Nose(i,:),'Linewidth',5,'LineStyle','-','EdgeColor','r');
  37. end
  38. for i=1:size(BB_Mouth,1)
  39. rectangle('Position',BB_Mouth(i,:),'Linewidth',5,'LineStyle','-','EdgeColor','r');
  40. end
  41. title('Please wear Mask');
  42. defaultString = 'Please wear Mask.';
  43. end
  44. pause(5)
  45. end
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement