Open cv

This is a discussion on Open cv within the C++ Programming forums, part of the General Programming Boards category; I am working on opecv project in c++ I have a code to detect the yellow color object and I ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    7

    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.

  2. #2
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126
    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.
    Mac OS 10.6 Snow Leopard : Darwin

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open source, easy-to-use XMPP messenger: Open-IM
    By mkruk in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 06-22-2008, 04:10 PM
  2. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  3. Open with...
    By Queatrix in forum Tech Board
    Replies: 2
    Last Post: 01-07-2006, 04:00 PM
  4. Open GL ?
    By swgh in forum C++ Programming
    Replies: 2
    Last Post: 07-27-2005, 10:05 AM
  5. Command to open the 'Open Dialog Box' found in most programs.
    By OmegaFirebolt in forum Windows Programming
    Replies: 5
    Last Post: 03-16-2003, 07:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21