Live data from Hacker News

Page Dewarping

mzucker.github.io

71–75 of 75 posts

Re: Page Dewarping

#72
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?" :)

[deleted]

Re: Page Dewarping

#73
post #10

Thanks for the feedback, everyone -- happy to answer questions here or in the Disqus comments on my blog.

I really enjoyed the article! By the way, you mentioned using word boundaries in regexes to replace variable names. GNU Emacs regexes can actually include "symbol boundaries" (which are a little better for variable names than word boundaries), represented as "\_ ". Personally, I like using the "highlight-symbol" package, which provides the "highlight-symbol-query-replace" command to basically execute M-% for the symb…

Cool - will check it out!

Re: Page Dewarping

#74
post #45
post #36

Earlier quoted context omitted.

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

As a comic artist working with scanned images, the "divide by blur" trick is going to save me significant effort in the future. THIS is exactly the sort of insight I wish I would get when I click one of those "one weird trick" links!

Then you might also like the Grain Extract and Grain Merge layer modes in GIMP (not sure if they exist in photoshop).

They're a bit obscure if you don't know how they work, basically Grain Extract subtracts the layers and adds 128, so you get sort of a fake 8-bit signed integer. Grain Merge does the opposite (add two layers, subtract 128).

I haven't tried to divide-by-blur (but I'm going to :) ). Grain Extract on the other hand, allows to subtract-with-blur, which is more like what I'd do if I were to code such an algorithm myself (the operation is roughly what the Unsharp Mask filter does, but you get a bit more control). Still I'm curious to see how divide-by-blur differs in its results.

Check this Flickr-post which has a nice explanation of using Grain Extract (used for a different purpose here, it's really a very interesting and versatile trick, only discovered it last week myself):

https://www.flickr.com/groups/48637250@N00/discuss/721576192...

Re: Page Dewarping

#75
post #45

Earlier quoted context omitted.

As a comic artist working with scanned images, the "divide by blur" trick is going to save me significant effort in the future. THIS is exactly the sort of insight I wish I would get when I click one of those "one weird trick" links!

Then you might also like the Grain Extract and Grain Merge layer modes in GIMP (not sure if they exist in photoshop). They're a bit obscure if you don't know how they work, basically Grain Extract subtracts the layers and adds 128, so you get sort of a fake 8-bit signed integer. Grain Merge does the opposite (add two layers, subtract 128). I haven't tried to divide-by-blur (but I'm going to :) ). Grain Extract on the…

I should mention that I know about Grain Extract's subtraction operation. I've used it for "leveling" also.

Subtraction would be fine if the data were logarithmic: that is to say, if the intensity information we are operating on represents decibels. We figure out the low frequency signal's "floor" over each area of the image, and simply subtract those decibels.

Division is better on the assumption that the intensity values of the pixels are linear. Division of linear samples is subtraction, in the decibel scale.

The right way is somewhere in between, because in RGB displays, pixels are put through some gamma curve. They are neither linear nor logarithmic.

Post reply on HN