Week 11

It took some time to get it to work, but with trial and error and cutting out multiple combinations of checkerboards, I might have got OpenCV to detect the board. The problem was the pattern has to be larger than 2×2 (OpenCV detects only the inner circle and likes having a wide border, so in essence a 3×3 cutout would actually be detected as 2×2, however that works)

3×3 was the largest that I could get to fit on my forehead, so I decided to get a printout of a chessboard with smaller square sizes, and cut out a 5×5 piece to test it as 4×4 and this is the outcome:
checkerworks

I wrote an if statement that draws a pattern around the detected corners of the chessboard, and the screenshot appears to faintly show this, I couldn’t get the pattern to be colored to be more visible. Here’s the original image:lasttry

Or I might just be seeing things; it seems as though the closer I focus on the gray screenshot, I can see a pattern, but not further away. May just be an optical illusion and I’ll take a look at ret’s boolean value to know for sure.

 

However another problem that popped up with this specific input photo is overflow, which the command prompt shows in the screenshot. This leads me to get an inaccurate result for the pixels distance, despite it working for every other image. This is another hurdle that I spent time trying to fix but wasn’t able to.

For next I’ll try to get done with the process of getting the detected points of the chessboard to get the distance in pixels (minus the white border perhaps) for a conversion value, and then perhaps take another photo with the chessboard to get an accurate pixels distance, and then complete the calibration from there.

Week 10

This week, a chessboard pattern was printed out and tested with multiple pictures of my face and my roommate Julian’s face. OpenCV’s chessboard detector method wouldn’t quite work on us but the problem seems to be the size of the squares. For it to fit on the forehead, it had to be cut down to 3×2. However, OpenCV’s method detects the inner corners only which makes it 2×1, and requires at least 2×2. So I will spend more time trying to work with that and if it doesn’t work out I’ll try other calibration methods.

badtest

In this screenshot, the algorithm didn’t quite accurately detect my eyes but that was a rarity as it works with most other images:
julian

oktest

Applying the distance method to these photos, the result in pixels actually seems pretty accurate. The distance between the eyes turns out to be around half of the image’s width in pixels, more or less.

After some trial and error for finding the distance in pixel, a (potentially tentative) solution has been found. Actually, two different solutions were found which yielded me different results with the picture I was testing:distance

In this screenshot I used a method widely recommended by stackoverflow and other sources for finding the distance between two points, which can be seen in the code. To find the center of the two circles in the first place, a small and probably inefficient algorithm was used.

The current result from the image that I’m going to go with for now is 266.27 pixels.

The next task is to figure out the width in pixels of the image itself to determine whether this is a plausible solution, as the other solution I was getting was 92485 pixels.

Once that is figured out, I should very soon be able to begin with the cardboard detection and conversion values to find distance in mm. I will try to accomplish this with a picture of my own face.

Week 8

This week’s post won’t involve many useful screenshots as most my time was spent
1) trying to get things to work
2) looking into how to calculate the IPD in pixels

This post comes a bit late as most of last Monday-Thursday was spent a bit scattered with a little lack of direction, with uncertainty of how the checkerboard pattern was supposed to be used. I tried reading through many, many tabs of documents and tutorials involving distance between objects in OpenCV but so far didn’t make much progress:

tabs

My meeting with Kevin Ponto and Alex Peer on Friday was pretty helpful for me to get back on track and have a better idea of what to do.

Since the meeting, a lot of my time has been consumed trying to get the Hough Circles method to work on a picture of my own face (so far I have been failing a lot, and haven’t yet been able to figure out why. Inputting an image of my face doesn’t even output the image when I run the program). So instead I tried taking a picture of my friend’s eyes, who has much more defined irises and pupils and the method worked on her:

kt

As work is ongoing, I will keep trying to get a picture of my face working, in prep for the final step of the camera calibration with the checkerboard. In the meantime, the immediate goal is to figure out how to get the IPD in pixels. I have a good idea of the formula and math to be used, although I am still digging for documentation and tutorials to get the location/coordinates of the centers of the circles in the image.