Search code examples
copencveye-detection

Detect Eye using HSV value in Open CV


I want to detect an Eye, I have some code where I can detect blue color object, so if I made changes(how I can?) then it would be possible for me to detect an eye. As the below color has its own specific range value so, if I specify the eye color HSV value then can I detect EYE with this method.

In this below code I am going to detect BLUE Color Object, please tell me that where I do changes in my code so that I could get EYE using Open CV.

     IplImage* GetThresholdedImage(IplImage* img)
    {
    // Convert the image into an HSV image
    IplImage* imgHSV = cvCreateImage(cvGetSize(img), 8, 3);
    cvCvtColor(img, imgHSV, CV_BGR2HSV);

    IplImage* imgThreshed = cvCreateImage(cvGetSize(img), 8, 1);
      //For detecting BLUE color i have this HSV value, 
     cvInRangeS(imgHSV, cvScalar(112, 100, 100), cvScalar(124, 255, 255), imgThreshed);//this will not recognize the yellow color
     cvReleaseImage(&imgHSV);
      return imgThreshed;
    }

Solution

  • Eye detection is much easier with Haar classifier. link here