MCodez / PUPIL-Detection-using-OpenCV

IRIS detection from eyes images using OpenCV 3 and Python 3.6.
MIT License
17 stars 5 forks source link

Issue running the code #1

Open hAbd0u opened 4 years ago

hAbd0u commented 4 years ago

When I run the code with the images you provide then I get this:

d:\PUPIL-Detection-using-OpenCV-master>python detect_pupil.py
Traceback (most recent call last):
  File "detect_pupil.py", line 65, in <module>
    id.start_detection()
  File "detect_pupil.py", line 48, in start_detection
    self.detect_pupil()
  File "detect_pupil.py", line 34, in detect_pupil
    thresh = cv2.cvtColor(inv, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(3.4.2) c:\projects\opencv-python\opencv\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'

I have: Python 3.6 and OpenCV 3.4.

MCodez commented 4 years ago

Hi, This error comes when the file size is zero or file is corrupted. Can you please check whether you are able to read it correctly or not.

hAbd0u commented 4 years ago

Hi @MCodez Thank you for this quick response, your suggestion make sense, I update the code to include the directory that holds the images and now it is working. One more question, what if I want just to draw a circle around iris, is this possible with your current project?

MCodez commented 4 years ago

Hi, If you want to add circle to highlight iris, you can try to change the threshold value. Being pupil the darkest part of iris, threshold of 220 was used. Iris is also covered with a white film so you can leverage that fact. We can update it for Iris detection as well. I will look into it and update if possible. Thanks

hAbd0u commented 4 years ago

Hi, I will wait for your update @MCodez.