Live data from Hacker News

Page Dewarping

mzucker.github.io

51–60 of 75 posts

Re: Page Dewarping

#51

This strikes close to home for me, because I've done this "by hand" quite a number of times, using some interactive Gimp filters, with very good results. I've been able to take a perspective photo of a curved page lying on a desk, get it almost perfectly straight, and threshold it to clean black and white or sharp gray scale. Here is my very quick and dirty manual job of the same example page: http://www.kylheku.com/…

Hence the tagline on the blog: "Why do it by hand if you can code it in just quadruple the time?" :)

Re: Page Dewarping

#52
post #51

This strikes close to home for me, because I've done this "by hand" quite a number of times, using some interactive Gimp filters, with very good results. I've been able to take a perspective photo of a curved page lying on a desk, get it almost perfectly straight, and threshold it to clean black and white or sharp gray scale. Here is my very quick and dirty manual job of the same example page: http://www.kylheku.com/…

Hence the tagline on the blog: "Why do it by hand if you can code it in just quadruple the time?" :)

I really enjoyed the various random thoughts in the wrapping up section of this post, thank you a good read!

Re: Page Dewarping

#54
post #32

Earlier quoted context omitted.

If she literally scans it with a scanner, why would it need dewarping? This is for when you use a digital camera on pages not lying flat. If you have the option go for scanning. Scans still benefit from cleanup, such as rotation and adjusting the levels (making everything near white perfectly white) and possibly manual cleanup (removal of specks of dust or the odd hair that was on the scanner).

She scans it in a scanner, but the music is often in large books that don't lay completely flat, so you still see the warping near the binding.

I remember when I was in my middle school orchestra, occasionally I'd get a piece of sheet music with this problem. If it was bad enough, it might even make it impossible to read the last few notes. If you could fix this for your wife, I'm sure her students will greatly appreciate it!

Re: Page Dewarping

#55
post #51

This strikes close to home for me, because I've done this "by hand" quite a number of times, using some interactive Gimp filters, with very good results. I've been able to take a perspective photo of a curved page lying on a desk, get it almost perfectly straight, and threshold it to clean black and white or sharp gray scale. Here is my very quick and dirty manual job of the same example page: http://www.kylheku.com/…

Hence the tagline on the blog: "Why do it by hand if you can code it in just quadruple the time?" :)

More work up front, less work afterwards.

Re: Page Dewarping

#56
Here's something that I think has not been done, but could be quite lucrative, building a high resolution scanner using the phone camera, multiple pictures and interpolation/noise removal.

Most phone cameras these days have good resolutions, and you could technically take a 6x4 photo, divvy it to 3x3 grid and take close up photos, and have smart algorithms interpolate the pixels to form a single image with high res. I'd even bet you'd results equal to or better than a flat bed scanner.

For better us, just open the camera preview and slowly pan over the image.

Has someone tried something like this? With FOSS apps like mosaic, hdr tools and imagemagick, it should be possible. I'm guessing opencv would be needed for interpolation and noise removal..

Re: Page Dewarping

#58
post #36

This strikes close to home for me, because I've done this "by hand" quite a number of times, using some interactive Gimp filters, with very good results. I've been able to take a perspective photo of a curved page lying on a desk, get it almost perfectly straight, and threshold it to clean black and white or sharp gray scale. Here is my very quick and dirty manual job of the same example page: http://www.kylheku.com/…

Divide by blur is very crafty. Will have to give that a shot next time I have a similar need in Photoshop.

Reminds me of the "frequency separation" [1] technique, used a lot in the high end retouching business.

[1] https://fstoppers.com/post-production/ultimate-guide-frequen...

Re: Page Dewarping

#59

it came in handy whenever a student emailed me their homework as a pile of JPEGs. Gotta admire this guy's resourcefulness—and patience. If I were a professor, I'd probably just reject the assignment outright if a student sent me a bunch of photos from their smartphone in lieu of a PDF or a "proper" scan. :)

Or compromise; write up an awesome blog post about how you wrote software to turn their photos into proper scans, and reject their homework (with a link to the blog post).

Re: Page Dewarping

#60
"You can see these are not exactly small optimization problems. The smallest one has 89 parameters in the model, and the largest has 600."

Those are small optmization problems. These types of problems are solved in computer vision for hundreds of thousands of variables. His problem can be solved in real-time, not tens of seconds.

Post reply on HN