Dear all,
I have HSV algorithm posted under "color detection algorithm" but i failed to locate the lips as i did by using RGB algorithm. I set the H to 0.1 but still with the same result.
My color image is in pgm format, so i didn't use ind2rgb but straight away to call colorDetectHSV(), will this be a problem?
This is the colorDetectHSV():
This is my main program:Code:function I = colorDetectHSV(RGB, hsvVal, tol) HSV = rgb2hsv(RGB); % find the difference between required and real H value: diffH = abs(HSV(:,:,1) - hsvVal(1)); [M,N,t] = size(RGB); I1 = zeros(M,N); I2 = zeros(M,N); I3 = zeros(M,N); T1 = tol(1); I1( find(diffH < T1) ) = 1; if (length(tol)>1) % find the difference between required and real S value: diffS = abs(HSV(:,:,2) - hsvVal(2)); T2 = tol(2); I2( find(diffS < T2) ) = 1; if (length(tol)>2) % find the difference between required and real V value: difV = HSV(:,:,3) - hsvVal(3); T3 = tol(3); I3( find(diffS < T3) ) = 1; I = I1.*I2.*I3; else I = I1.*I2; end else I = I1; end subplot(2,1,1),imshow(RGB); title('Original Image'); subplot(2,1,2),imshow(I,[]); title('Detected Areas');
The original images is in my attachment below "image.zip".Code:a = imread('m-013-1.pgm'); b = colorDetectHSV(a, [0.1 1.0 0.5], [0.5 0.5 0.5]);
However, i failed to allocate lips which is in red color. Please help, any comment will be appreciated.
Thank you.
Best regards,
Tommy




Reply With Quote