This program is able to puzzle images with random piece flips and rearrange (unpuzzle) them.
- cv2 4.0.0
- Python 3.6.4
- numpy 1.16.1
[usage]: python3 puzzle.py file_name pieces_in_vertical pieces_in_horizontal
[example]: python3 puzzle.py sample.png 4 3
Execute puzzling program with above usage. Result image is generated as "puzzled_image.jpg". In the case of the example, sample.jpeg will be puzzled into 4 pieces vertically and 3 pieces horizontally.
[usage]: python3 unpuzzle.py pieces_in_vertical pieces_in_horizontal
[example]: python3 unpuzzle.py 4 3
Execute unpuzzling program with above usage. It will attempt to rearrange puzzled_image.jpg created from the puzzling program. Result image is generated as "unpuzzled_image.jpg". In the case of the example, puzzled_image.jpg will be unpuzzled given 4 pieces vertically and 3 pieces horizontally.
You can adjust the threshold value in lines 139 and 140 in "unpuzzle.py" to increase the accuracy of the image.
python3 puzzle.py sample.png 4 4
python3 unpuzzle.py 4 4