Live data from Hacker News

Image unshredding using a TSP solver

github.com

51–56 of 56 posts

Re: Image unshredding using a TSP solver

#51

Now 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.

Sounds like the DARPA Shredder Challenge from 2011: https://en.wikipedia.org/wiki/DARPA_Shredder_Challenge_2011

Re: Image unshredding using a TSP solver

#52
post #20
post #8

I'm really surprised by double-shuffling can actually be solved. https://github.com/robinhouston/image-unshredding/#double-sh... It looks very unintuitive.

Think about it like this: for a 100x100 image, there are 100!*100! ways to double-shuffle. But there are 10000! ways to shuffle the pixel. So a lot of structure remains in the double-shuffled image.

In case your point is not obvious to someone, 10000! is FAR larger than 100!*100! (by something like 350,000 orders of magnitude), so the possibility space is vastly bigger if you shuffle the pixels individually than if you shuffle columns first, then rows.

Re: Image unshredding using a TSP solver

#53

Could 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.

That's what the Burrows–Wheeler transform does for text. A similar approach could work for images.

It's a good point. PNG uses DEFLATE internally for the compression, it would be interesting to see what would happen if you used bzip2 instead, which uses the Burrows-Wheeler transform.

Re: Image unshredding using a TSP solver

#54
post #47

Earlier quoted context omitted.

I always thought "NP-complete/NP-hard" metaphor only meaningful in theoretical work. In practice, it does not make much sense in guiding what/how the real world problem is to be solved.

I don't know. I find it useful in practice. Apart from anything else it means there's (probably) no point looking for an exact polynomial-time algorithm, which can save a lot of wasted effort. But it also gives useful clues about what sort of algorithmic approaches might be useful, and allows you to relate your problem to a huge amount of existing research. It's really basic taxonomy: what sort of problem are we deal…

Maybe you are heavily on huge algorithmic work. In practice, most algorithms are polynomial-time, and we are looking for under-polynomial-time alternative - log(n). For exponential-time, we are just looking for an approximate alternative.

Re: Image unshredding using a TSP solver

#55
post #40
post #36

Do you know of any image compression technique that would drop information that we expect to be redeemable in a reasonable time using a solver of this sort?

Since the shuffling adds information, it seems unlikely.

Don't you think that for any image there exist a shuffled version that compress better?

Re: Image unshredding using a TSP solver

#56
post #55
post #40

Earlier quoted context omitted.

Since the shuffling adds information, it seems unlikely.

Don't you think that for any image there exist a shuffled version that compress better?

I don't see any reason why there necessarily would be. Generally speaking, compression algorithms do better when adjacent pixels have similar colors, which is the unshuffled state.

In cases where there is a version that compresses better, unshuffling might not work. If you had an "pinstripe" image consisting of alternating black and white columns of pixels, obviously it could compress better after being "shuffled" with all the similarly colored columns together. But then this algorithm would be unable to get the original image back.

Post reply on HN