Beruflich Dokumente
Kultur Dokumente
Human Skin
The color of human skin is created by a combination of blood (red) and melanin (yellow, brown). Skin colors lie between these two extreme hues and are somewhat saturated. The human skin is a fraction of the actual color cube, about 0.25 % of the total colors Except for extremely hairy subjects, which are rare, skin has only lowamplitude texture.
Human Skin
Robust skin segmentation involves the formulation of an efficient mathematical model to represent the skin color distribution. Segmenting skin from real-world images is a difficult task even though human skin is known to possess a unique color range, which is but a fraction of all the possible color combinations.
Multilayer perceptron
Back-Propogation
Skin likelihood of an input chrominance vector x is given by p(x) = exp [ -0.5 (x m )t*inverse)*( x-m)] So we could create three sets: one set of people with white skins Set W), second set of people with black-brown (Set B) skins and third set as an union of first and second set (Set WB).
Processing an Image
The first step in the processing of an input picture is creating a skinlikehood image in which each pixel corresponds to the probability of occurrence of skin-color (in the same pixel in the original input image). The values of probability can be easily transformed into greyscale values. Second step is creating a skin-segmented image by using a threshold value of probability. We can use fixed threshold value for every image or adaptive thresholding. A fixed threshold value is generally more efficient.
Advantages
Skin regions can be made more integral by use of low pass filtering. This method can be effectively used in images of faces that have some parts more affected with ambient light. Quality of estimated color model can easily improved by using larger set of analysed samples. EM algorithm can be used to estimate more appropriate values of mixture Gaussian model.
Disadvantages
To improve performance we use more number of samples but computation burden increases considerably. Algorithm works better for images of white skin than black ones.
Problem Statement
What we need is a function which can tell whether a given color pixel is a skin pixel or not.
0
Input Color Pixel (RGB/HSV)
F(R,G,B)
OR 1
254 0 255 0
Training Set
Linear Classifier
1 [ A skin pixel]
Final Algorithm
DEMO
Thank You
Appendix
1) Matlab Codes Skin.m
function skin2(fname,race) %reading the image img=imread(fname); %converting RGB image to HSV image hsv_img = rgb2hsv(img); %uploading the database data=importdata('data2.txt'); [m,n]=size(data); % x=data d=decision x=zeros(m,4); d=zeros(m,1); for i=1:m [H S V]=rgb2hsv(1/255*[data(i,1) data(i,2) data(i,3)]); x(i,1)=H; x(i,2)=S; x(i,3)=V; x(i,4)=data(i,4); d(i,1)=data(i,5); end %uploading K matrix K=importdata('K.txt'); %a=lagrangian multiplier column vector a=importdata('a.txt'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%detection of skin%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %displaying original image colormap(gray(256)); image(img); [q,p,r]=size(img); %final_img=zeros(q,p); for X=1:5:p for Y=1:5:q H=hsv_img(Y,X,1); S=hsv_img(Y,X,2); V=hsv_img(Y,X,3); out=0; if(race(1)==1) for i=1:m out=out+a(i)*d(i)*exp((-1/(2*0.00006))*((x(i,1)-H)^2+(x(i,2)S)^2+(x(i,3)-V)^2+(x(i,4)-1)^2)); end
if(out>0) % final_img(Y,X)=255; rectangle('Position',[X,Y,2,2]); end end if(race(2)==1) out=0; for i=1:m out=out+a(i)*d(i)*exp((-1/(2*0.00006))*((x(i,1)-H)^2+(x(i,2)S)^2+(x(i,3)-V)^2+(x(i,4)-2)^2)); end if(out>0) % final_img(Y,X)=255; rectangle('Position',[X,Y,2,2]); end end if(race(3)==1) out=0; for i=1:m out=out+a(i)*d(i)*exp((-1/(2*0.00006))*((x(i,1)-H)^2+(x(i,2)S)^2+(x(i,3)-V)^2+(x(i,4)-3)^2)); end if(out>0) % final_img(Y,X)=255; rectangle('Position',[X,Y,2,2]); end end end end
update_data.m
function update_data %uploading the database data=importdata('data2.txt'); [m,n]=size(data); % x=data d=decision x=zeros(m,4); d=zeros(m,1); %coverting RGB data to HSV data for i=1:m [H S V]=rgb2hsv(1/255*[data(i,1) data(i,2) data(i,3)]); x(i,1)=H; x(i,2)=S; x(i,3)=V; x(i,4)=data(i,4); d(i,1)=data(i,5); end
%mapping from input space to feature space %formation of K matrix K=zeros(m,m); for i=1:m for j=1:m K(i,j)=exp((-1/(2*0.00006))*((x(i,1)-x(j,1))^2+(x(i,2)x(j,2))^2+(x(i,3)-x(j,3))^2+(x(i,4)-x(j,4))^2)); end end %updating the K matrix dlmwrite('K.txt', K, 'delimiter', '\t', 'precision', 4); %a=lagrangian multiplier column vector a=zeros(m,1);
%updating the lagrangian multipliers Kd=zeros(m,m); for i=1:m for j=1:m Kd(i,j)=K(i,j)*d(i)*d(j); end end a=inv(Kd)*ones(m,1); dlmwrite('a.txt', a, 'delimiter', '\t', 'precision', 4);
2) Results:
Before
Before
After
After