Week 4

This week, I worked on a few different options as I was indecisive. I spent half my time trying to figure out whether I should make use of some open source face detection code that was available for use and to try to use that: https://realpython.com/blog/python/face-recognition-with-python/
or rather to focus on blob detection instead. In the former option I thought I could detect the face to narrow down our area of focus and ignore the rest of the image as all we really care about is the eyes.

However, I had trouble understanding how to use the code and wasn’t able to make use of it yet, so I may revisit that later. Instead, I turned to blob detection; I found a nice resource online that explains how to set parameters for OpenCV’s blob detector: http://www.learnopencv.com/blob-detection-using-opencv-python-c/

I downloaded a new image of Cristiano Ronaldo and saved it to my project folder to try and use that image as a starting point for pupil detection and distance-to-pupil calculation before I generalize the program. However I kept encountering this weird error:

errpr

So naturally, I turned to the image of the cat that I already had and was opening just fine before adding any of the blob detection code. Unsurprisingly, I was able to make some progress with that and get it to detect some blobs (but also incorrectly detect fake blobs). I had to mess around with the params a bit for it to work:

area

I later discovered that playing around with the area parameter was helpful in having the program only detect real blobs. I still have yet to figure out how to get it to detect only the pupils (as opposed to the entire eyeball), and most importantly, getting it to work with other images, especially of humans. That will be my goal for next week along with making the blob detection more accurate.