As part of a larger project, I needed to find the coordinates of any instances of a small image inside a larger image. Here are the two images:
This outputs a new grey image, with a white spot corresponding to the location of every match. Check it out:
Note the coordinate with the color of "white." Now we're getting somewhere- a numerical coordinate corresponding to a match. Here is a quick one-liner I used to parse the coordinates out of the file:
This grabs all the lines of the file that contain 'white.' It then uses awk to parse the raw output into something more useable in Clojure:
Done! Now we have a coordinate list of all the crystals in the image. Check out how I used it in a future blog post.