-
Open cv
I am working on opecv project in c++
I have a code to detect the yellow color object and I want to detect the skin color.
//Variables for trackbars
int h1=23;int s1=41;int v1=133;
int h2=40;int s2=150;int v2=255;
//Creating the trackbars
cvCreateTrackbar("H1","cnt",&h1,255,0);
cvCreateTrackbar("H2","cnt",&h2,255,0);
cvCreateTrackbar("S1","cnt",&s1,255,0);
cvCreateTrackbar("S2","cnt",&s2,255,0);
cvCreateTrackbar("V1","cnt",&v1,255,0);
cvCreateTrackbar("V2","cnt",&v2,255,0);
//Infinate Loop
while(1)
{
//Getting the current frame
IplImage *fram=cvQueryFrame(capture);
//If failed to get break the loop
if(!fram)
break;
//1.PREPROCESSING OF FRAME
//Resizing the capture
cvResize(fram,frame,CV_INTER_LINEAR );
//Flipping the frame
cvFlip(frame,frame,1);
//Changing the color space
cvCvtColor(frame,hsvframe,CV_BGR2HSV);
//Thresholding the frame for yellow
cvInRangeS(hsvframe,cvScalar(h1,s1,v1),cvScalar(h2 ,s2,v2),threshy);
//Filtering the frame
cvSmooth(threshy,threshy,CV_MEDIAN,7,7);
Where I need to change from yellow to skin color I mean for skin what is rgb value.
-
I have the impression you are not understanding what the program is doing .
In order to detect skin color is better to use HSV color space rather than the usual RGB (that is why you use cvCvtColor() )
If you don't know the reason I recommend to read at least this
So instead of using RGB just use HSV with H something approx. between 10 and 50, maximum is 360.