Code

Embed Size (px)

Citation preview

Face Detection of Individual Image Frame %Detection of Face on the basis of skin color clear all; close all; clc I=imread('salu3.jpg'); imshow(I) cform = makecform('srgb2lab'); J = applycform(I,cform); figure;imshow(J); K=J(:,:,2); figure;imshow(K); L=graythresh(J(:,:,2)); BW1=im2bw(J(:,:,2),L); figure;imshow(BW1); M=graythresh(J(:,:,3)); figure;imshow(J(:,:,3)); BW2=im2bw(J(:,:,3),M); figure;imshow(BW2); O=BW1.*BW2; % Bounding box P=bwlabel(O,8); BB=regionprops(P,'Boundingbox'); BB1=struct2cell(BB); BB2=cell2mat(BB1); [s1 s2]=size(BB2); mx=0; for k=3:4:s2-1 p=BB2(1,k)*BB2(1,k+1); if p>mx && (BB2(1,k)/BB2(1,k+1))