Skip to main content
2 of 4
improved code formatting for more readability, added image-processing tag

OpenCV detectin skin colour

I have to capture skin colour independent of illumination. I used the following criteria(using hsv and rgb) but it ain't working:

int h = get_hue(...);
int s = get_saturation(...);
int r = get_red_component(...);
int g = get_green_component(...);
int b = get_blue_component(...);

if ((h<38)&&(h>6)&&(s>0.23)&&(s<0.68)){
    // skin color
}
else if ((r>95) && (g>40) && (b>20) && 
         ((maximum(r,g,b)-minimum(r,g,b))>15) && 
         (abs(r-g)>15)&&(r>g)&&(r>b)){
   // also skin color
}

Any Help will be appreciated. Thanks in Advance. (PS -my skin ain't white.)

Roney Island
  • 453
  • 1
  • 4
  • 13