I started the week trying to figure out how to create templates of the eyes to make a more reliable method of blink detection. First, I created two boxes on the video images for the user to put their eyes:
Then, using the method of detecting blinks from my first version, I found a way to make bitmaps of the eyes. By making byte arrays of two consecutive frames, I found the difference images and made projection arrays of the horizontal and vertical axes of each frame. Using experimentation, I found that by making a cut-off brightness value of 90, and looking for where there were fewer than 25 zero columns and fewer than 10 zero rows, I could get accurate templates of my eyes:
Now, to use these templates to find blinks, I planned to use the OpenCV matchTemplate method to find the Normalized Correlation Coefficient to find matches to the templates of the open and closed eyes. This proved to be difficult from the start. I had never used OpenCV before and I had no idea how to implement this. Also, since it was still morning, there was no one I could get help from.