bug1not
Banned
Good day!
I saw this website while surfing for some skin detection codes..
Can you guyz please answer my questions below? Because I don't understand what the functions are of some lines in the codes..
The following are the codes I don't understand..
% Extract the Hue & Saturation into new different variables
h = hsvimage,:,1);
s = hsvimage,:,2);
What does ,:,1 or 2) means? Why is it 1 or 2?
%targeted values determined by looking at the plotted skin H S figures
h_range = [0 .11];
s_range = [0.2 1.5];
detectSkin('girl.jpg', h_range, s_range);
What are the purpose of h_range and s_range? Why there are 2 numbers?
function detectSkin(filename, h_range, s_range)
%read in image & convert to HSV
im = imread(filename);
im1 = double(im);
hsv_im1 = rgb2hsv(im1);
Why does "im" needs to be double?
%pull out H & S data into new variables
H = hsv_im1,:,1);
S = hsv_im1,:,2);
What do these lines mean?
%prevents errors
I = H+S;
I(find(I==0))=Inf;
What do these lines mean?
%targets skin by only selecting values within the rectangle skin range
skin = ((s>s_range(1)) & (s<s_range(2)) &(h>h_range(1)) & (h<h_range(2)));
What does this line means?
Hoping you guyz can help me answer my queries above because I really like to understand the codes above..
Thanks a lot!
bug1not
I saw this website while surfing for some skin detection codes..
Code:
http://www.urwelcome.us/Jstill/Matlab/Skin_Detection.htm
Can you guyz please answer my questions below? Because I don't understand what the functions are of some lines in the codes..
The following are the codes I don't understand..
Code:
http://www.urwelcome.us/Jstill/Matlab/skin_detection/hs_skin_detection.m
% Extract the Hue & Saturation into new different variables
h = hsvimage,:,1);
s = hsvimage,:,2);
What does ,:,1 or 2) means? Why is it 1 or 2?
%targeted values determined by looking at the plotted skin H S figures
h_range = [0 .11];
s_range = [0.2 1.5];
detectSkin('girl.jpg', h_range, s_range);
What are the purpose of h_range and s_range? Why there are 2 numbers?
Code:
http://www.urwelcome.us/Jstill/Matlab/skin_detection/hs_detectSkin.m
function detectSkin(filename, h_range, s_range)
%read in image & convert to HSV
im = imread(filename);
im1 = double(im);
hsv_im1 = rgb2hsv(im1);
Why does "im" needs to be double?
%pull out H & S data into new variables
H = hsv_im1,:,1);
S = hsv_im1,:,2);
What do these lines mean?
%prevents errors
I = H+S;
I(find(I==0))=Inf;
What do these lines mean?
%targets skin by only selecting values within the rectangle skin range
skin = ((s>s_range(1)) & (s<s_range(2)) &(h>h_range(1)) & (h<h_range(2)));
What does this line means?
Hoping you guyz can help me answer my queries above because I really like to understand the codes above..
Thanks a lot!
bug1not