Image unshredding using a TSP solver
11–20 of 56 posts
Re: Image unshredding using a TSP solver
#12The 2D shuffling result is a bit surprising at first glance, but less so when you think about it - row comparison doesn't care about the order of the pixels in each row as long as the order is the same in both, and the shuffling mechanism guarantees that.
the important bit is you have to unscramble in reverse order of the scrambling. Unscrambling the columns and then unscrambling the rows would lead to smooth gibberish.
Here's a more explicit breakdown:
(0,0) (1,0) (2,0)
(0,1) (1,1) (2,1)
(0,2) (1,2) (2,2)
Column scrambling: swap 1&2: (0,0) (2,0) (1,0)
(0,1) (2,1) (1,1)
(0,2) (2,2) (1,2)
Now row scrambling: swap 0&1: (0,1) (2,1) (1,1)
(0,0) (2,0) (1,0)
(0,2) (2,2) (1,2)
Notice how the x coordinates still all match along the vertical, and y coordinates still all match
along the horizontal.Let's try it in the other order, row first:
(0,1) (1,1) (2,1)
(0,0) (1,0) (2,0)
(0,2) (1,2) (2,2)
And columns: (0,1) (2,1) (1,1)
(0,0) (2,0) (1,0)
(0,2) (2,2) (1,2)
It's the same result irrespective of the order.Re: Image unshredding using a TSP solver
#13The 2D shuffling result is a bit surprising at first glance, but less so when you think about it - row comparison doesn't care about the order of the pixels in each row as long as the order is the same in both, and the shuffling mechanism guarantees that.
the important bit is you have to unscramble in reverse order of the scrambling. Unscrambling the columns and then unscrambling the rows would lead to smooth gibberish.
You can try it yourself, if you’ve cloned the repo. Here are the commands to reconstruct first by columns and then by rows:
git checkout double-shuffling
make images/double_shuffled/blue-hour-paris.png bin/compute_scores
mkdir tmp
bin/compute_scores --cols images/double_shuffled/blue-hour-paris.png > tmp/cols.tsp
bin/lkh.sh tmp/cols.tsp tmp/cols.tour
bin/reconstruct_image.py --cols tmp/cols.tour images/double_shuffled/blue-hour-paris.png > tmp/cols-unshuffled.png
bin/compute_scores --rows tmp/cols-unshuffled.png > tmp/rows.tsp
bin/lkh.sh tmp/rows.tsp tmp/rows.tour
bin/reconstruct_image.py --rows tmp/rows.tour tmp/cols-unshuffled.png > tmp/reverse-unshuffled.pngRe: Image unshredding using a TSP solver
#14I'm really surprised by double-shuffling can actually be solved. https://github.com/robinhouston/image-unshredding/#double-sh... It looks very unintuitive.
Re: Image unshredding using a TSP solver
#15I'm really surprised by double-shuffling can actually be solved. https://github.com/robinhouston/image-unshredding/#double-sh... It looks very unintuitive.
Re: Image unshredding using a TSP solver
#16Re: Image unshredding using a TSP solver
#17Now I'd like to see this run on a more realisticly shredded image. A real paper shredder creates strips that are more than one pixel thick are not straight on (I.e. the pixels don't necessarily align with the cuts) and possibly have cutting defects such as ragged edges or nicks.
Re: Image unshredding using a TSP solver
#18Earlier quoted context omitted.
the important bit is you have to unscramble in reverse order of the scrambling. Unscrambling the columns and then unscrambling the rows would lead to smooth gibberish.
No. Column scrambling doesn't affect row ordering and row scrambling doesn't affect column ordering. They are literally orthogonal. You can't tell, from a scrambled matrix, whether the rows or the columns were scrambled first. Here's a more explicit breakdown: (0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2) Column scrambling: swap 1&2: (0,0) (2,0) (1,0) (0,1) (2,1) (1,1) (0,2) (2,2) (1,2) Now row scrambling: sw…
Re: Image unshredding using a TSP solver
#19Could be used to compress images? Perhaps instead of shuffling the columns and rows randomly they could be ordered in ways that are better suited for compression.
Re: Image unshredding using a TSP solver
#20I'm really surprised by double-shuffling can actually be solved. https://github.com/robinhouston/image-unshredding/#double-sh... It looks very unintuitive.