Friday 25 January 2013

Skin Detection Matlab Code

skin_detect.m

function [out bin] = generate_skinmap(filename)

 
    if nargin > 1 | nargin < 1
        error('usage: generate_skinmap(filename)');
    end;
    img_orig = imread(filename);
    height = size(img_orig,1);
    width = size(img_orig,2);
    out = img_orig;
    bin = zeros(height,width);
    img = grayworld(img_orig);  
    img_ycbcr = rgb2ycbcr(img);
    Cb = img_ycbcr(:,:,2);
    Cr = img_ycbcr(:,:,3);
    [r,c,v] = find(Cb>=77 & Cb<=127 & Cr>=133 & Cr<=173);
    numind = size(r,1);
    for i=1:numind
        out(r(i),c(i),:) = [0 0 255];
        bin(r(i),c(i)) = 1;
    end
    imshow(img_orig);
    figure; imshow(out);
    figure; imshow(bin);
end

run.m


clc;
skin_detect('sample.jpg');


You might also like : Face Detection



8 comments:

  1. Fantastic blog! I'm so glad to find your page.I really appreciated the concept that you have posted here. Thanks for sharing !

    ReplyDelete
  2. sir can you plz send me the code for real time hand gesture recoginition

    ReplyDelete
  3. what function is grayworld?

    ReplyDelete
    Replies
    1. This comment has been removed by a blog administrator.

      Delete
  4. please send the gesture recognition code to sudhakartime@gmail.com

    ReplyDelete
  5. i try to implement this project in neural network but i can not
    please help me

    ReplyDelete
  6. Casino City | Visit Missouri Casino Hotel
    Casino City is 전라남도 출장마사지 a destination hotel and casino in Lawrenceburg, MO. It is an entertainment baoji titanium destination located close to 전라남도 출장샵 Kansas 원주 출장안마 Speedway and 통영 출장안마 Kansas Speedway Opened: January 23, 2005

    ReplyDelete