Friday, 6 September 2013

PLOTTING SKIN AND NON SKIN PIXELS IN HSV COLOR SPACE

%%
clear all;
close all;
clc;



figure
xlabel('s');
ylabel('h');
hold on;
grid on;





%%
k=dir('*face*'); %reading the files that has "face" in the name of the image
%facial images
for i=1:6
    filename=k(i).name;
    img=imread(filename);
    hsv=rgb2hsv(img);
    h=hsv(:,:,1);
    s=hsv(:,:,2);
 
    h=h(:);
    s=s(:);
 
    plot(s,h,'.b');
end


%%
%non facial images
k=dir('*dummy*');%reading images containing name dummy

for i=1:3
    filename=k(i).name;
    img=imread(filename);
    hsv=rgb2hsv(img);
    h=hsv(:,:,1);
    s=hsv(:,:,2);
 
    h=h(:);
    s=s(:);
 
    plot(s,h,'.r');
end

No comments:

Post a Comment