Here is the algorithm:
1. Save the snapshot of image into a PNG file
2. Read the file using R library as a matrix
3. Convert the image to grayscale
4. Flip the image Horizontally
5. Convert into a binary image with threshold 0.99999.
6. Apply thinning algorithm to the matrix
7. Apply R's cor function to get the correlation from the matrix
8. Print it
9. Use it :-)
Here is the program:
Note: I spent 3 hours and learnt some amount of R just for this stint. So the program might not be efficient.
Here are the custom functions: