fork(1) download
  1. //test.m
  2. cam=webcam(1);
  3. I = snapshot(cam);
  4. [m,n,t]=size(I);
  5. b=false(m,n);
  6. %mr,mg,mb & Mr,Mg,Mb are minimum & maximum range of colour of skin
  7. %(detected during runtime , here i m given my runtime values simply)
  8. mb=35;Mb=62;mg=48;Mg=81;mr=57;Mr=110;
  9. for i=1:m
  10. for j=1:n
  11. if(I(i,j,1)>=mr && I(i,j,1)<=Mr && I(i,j,2)>=mg && I(i,j,2)<=Mg && I(i,j,3)>=mb && I(i,j,3)<=Mb)
  12. b(i,j)=1;
  13. end
  14. end
  15. end
  16. b=fliplr(b);
  17. Iz=bwareafilt(b,1); %Assuming largest skin-coloured object is hand ,removes other objects with skin color
  18. se=strel('disk',5);
  19. Iblur=imclose(Iz,se); %Bluring image
  20. %Displaying Both images
  21. subplot(1,2,1)
  22. imshow(b)
  23. title('Processed Image');
  24. subplot(1,2,2)
  25. imshow(Iblur)
  26. title('Blurred Image')
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:18:10: warning: multi-character character constant [-Wmultichar]
 se=strel('disk',5);
          ^
prog.cpp:23:7: warning: character constant too long for its type
 title('Processed Image');
       ^
prog.cpp:26:7: warning: character constant too long for its type
 title('Blurred Image')
       ^
prog.cpp:2:1: error: 'cam' does not name a type
 cam=webcam(1);
 ^
prog.cpp:3:1: error: 'I' does not name a type
 I = snapshot(cam);
 ^
prog.cpp:4:1: error: expected unqualified-id before '[' token
 [m,n,t]=size(I);
 ^
prog.cpp:5:1: error: 'b' does not name a type
 b=false(m,n);
 ^
prog.cpp:6:1: error: expected unqualified-id before '%' token
 %mr,mg,mb & Mr,Mg,Mb are minimum & maximum range of colour of skin
 ^
prog.cpp:8:7: error: 'Mb' does not name a type
 mb=35;Mb=62;mg=48;Mg=81;mr=57;Mr=110;
       ^
prog.cpp:8:13: error: 'mg' does not name a type
 mb=35;Mb=62;mg=48;Mg=81;mr=57;Mr=110;
             ^
prog.cpp:8:19: error: 'Mg' does not name a type
 mb=35;Mb=62;mg=48;Mg=81;mr=57;Mr=110;
                   ^
prog.cpp:8:25: error: 'mr' does not name a type
 mb=35;Mb=62;mg=48;Mg=81;mr=57;Mr=110;
                         ^
prog.cpp:8:31: error: 'Mr' does not name a type
 mb=35;Mb=62;mg=48;Mg=81;mr=57;Mr=110;
                               ^
prog.cpp:9:1: error: expected unqualified-id before 'for'
 for i=1:m
 ^
prog.cpp:13:13: error: 'end' does not name a type
             end
             ^
prog.cpp:17:1: error: 'Iz' does not name a type
 Iz=bwareafilt(b,1); %Assuming largest skin-coloured object is hand ,removes other objects with skin color
 ^
prog.cpp:17:21: error: expected unqualified-id before '%' token
 Iz=bwareafilt(b,1); %Assuming largest skin-coloured object is hand ,removes other objects with skin color
                     ^
prog.cpp:19:1: error: 'Iblur' does not name a type
 Iblur=imclose(Iz,se); %Bluring image
 ^
prog.cpp:19:23: error: expected unqualified-id before '%' token
 Iblur=imclose(Iz,se); %Bluring image
                       ^
prog.cpp:24:8: error: expected constructor, destructor, or type conversion before '(' token
 subplot(1,2,2)
        ^
stdout
Standard output is empty