Puzzle Solver
Athulya Simon, Aditya Kashyap
Virginia Tech, Fall 2017
Athulya Simon, Aditya Kashyap
Virginia Tech, Fall 2017
For our project we wanted to tackle the age old problem of solving a puzzle. Puzzle solving has applications in archaeology where you can take multiple images of disjoint artifacts and try to rebuild an image of what the original piece looked like. It can also be used for information retrieval by taking pictures of shredded paper and piecing it back together. While it does have useful applications as listed earlier, our main motivation for this project was to have fun and learn by doing! We had to apply a wide range of Computer Vision tools to be able to do this and in the next section we walk the reader through our approach.
While we have tested out the algorithm on multiple puzzles, we focus on one as we walk the reader through the algorithm.
Our main idea was to first get all the possible solutions based on the shape of the pieces and then decide which solution out of all the possible solutions was the best based on matching the color near the intersection of the two puzzles. This mimics the “human” way of solving puzzles too.
We went about this in the following manner:
We will now illustrate the process described above using the pictures we generated
Step 1: Obtaining the boundaries
Starting picture. Contains all pieces of the puzzle.
Rough edges using Sobel edge detection
Dilated edges
Edges "Filled In"
Boundaries Obtained!
We see the boundaries overlaid with the original image
Step 2: Straighten out the pieces
1. Get the dominant Hough line
2. Rotate based on the angle of that line
All the pieces after they have been cropped and straightened out
Step 3: Classify all the pieces
Calculate the pattern along the inner offset (blue) lines
The classification of an individual piece. We start from the left edge and work counterclockwise around the piece.
Classification of all the pieces
Step 4: Obtain all possible solutions based on shape alone (few shown for brevity)
The middle 2 pieces in the bottom row are incorrect
Correct solution
The eyes are not in the right place
Example of solution that is physically possible but unlikely
Notice that all these solutions are physically possible. Also notice that solution 1 and 3 are only off by a single pair
Step 5: Use color matching to give every solution a value. (the lower the better)
Step 6: After color matching we are able to get the final result
Solved Puzzle of Simba
Ground Truth Image
Another example: Superman
All puzzle pieces
Solved Puzzle of Superman
Ground Truth Image
3rd Example: Anna from the movie Frozen
All puzzle pieces
Solved Puzzle of Anna
Ground Truth Image
1. VT Fall 2017, ECE 5554. HW1(edge detection),HW5(color matching)
2. Using Computer Vision to Solve Jigsaw Puzzles, Travis V. Allen, Stanford University