YutaItoh / 3D-Eye-Tracker

MIT License
348 stars 103 forks source link

Exception: getDarkestPixelBetter #9

Closed Pezzl closed 6 years ago

Pezzl commented 7 years ago

Hello,

I am a student from the TU of Vienna and we are currently doing some research on nystagmus. For our research we are using the HMD FOVE, which additionally to the screen inside of the HMD has to two cameras checking the eyes. Your software would perfectly fit for our purpose, to analyses the jittering of the eye. However, when I use your software, I get an odd error. Maybe you have some input, where the error comes from.

Error in command: debugmessage1

Error in Visual Studio: debugmessage2

The image/video coming from the FOVE looks likes this: fove_eyes Can it be, that the black boarder around the eyes somehow interferes with the pupil detection?

Thanks in advance, Stefan

jason01234 commented 7 years ago

Hi Stefan,

Are you trying to run the algorithm on a single 640x240 image with two eyes? If so, I recommend you split the image into two halves and run the algorithm separately for each eye. I think the 3D model is build on a one eye per camera basis.

Also, you are correct that the dark regions will interfere with the pupil finding process. I recommend cropping the image and passing the result as a new Mat to the algorithm. The pupil should be the darkest region in the image. Based on your images above, cropping should be fairly easy. You could alternatively just color all black border pixels white.

Lastly, there is a parameter for maximum possible pupil size called sizeIn in the pupilAreaFitRR method of pupilfitter.h. Set this to some value less than 240, ideally the maximum possible pupil size for any user for that particular camera. For example, if your cropped eye image is only 200 pixels high, I recommend setting sizeIn to somewhere around 60, maybe even smaller. This also significantly speeds up processing time as the pupil ellipse candidate points will be smaller.

Let me know if that works.