Page 2 of 2

Re: ebook distortion

Posted: 2010-12-13T00:36:12-07:00
by jumpjack
Ops, my mistake, actual situation is this:
Image

Re: ebook distortion

Posted: 2010-12-13T11:48:30-07:00
by fmw42
If this is an ebook page (presumably digital), why are the pages bulging outside the e-book bounds? If the pages were not outside the bounds then a perspective on each side should do the trick. If there is some digital distortion to curl the pages then you have a tough problem and perhaps higher order polynomial may be the only solution.

Re: ebook distortion

Posted: 2010-12-13T13:02:51-07:00
by jumpjack
It is NOT an ebook! It's a paper book, and I'm trying to digitize it to turn it into an ebook!

Re: ebook distortion

Posted: 2010-12-13T14:11:36-07:00
by geep999
Out of curiosity I tried to remove the distortion using Hugin as per the tutorial
http://hugin.sourceforge.net/tutorials/ ... e/en.shtml
Somewhat successful. It might have been better if I'd had the page edges to use for control points.
Probably useless for batch processing if you're trying to process a whole book.
Why not scan and OCR it?
I think Sirius Cybernetics Corporation might have a suitable product.
Cheers,
Peter
Image
Image

Re: ebook distortion

Posted: 2010-12-14T01:51:01-07:00
by jumpjack
geep999 wrote:Out of curiosity I tried to remove the distortion using Hugin as per the tutorial
http://hugin.sourceforge.net/tutorials/ ... e/en.shtml
I'm sorry but you got a very poor result! Characters are even more distorted! (some ones are bigger than others)
Somewhat successful. It might have been better if I'd had the page edges to use for control points.
Probably useless for batch processing if you're trying to process a whole book.
All pages would have same distortion, so once I find the algorithm for first pages, it will be ok for all of them.
Why not scan and OCR it?
I don't unsrestand the question: this is what I am trying to do! I am "scanning" a book with a camera, and I'd like to distort the resulting images to get then processable by an OCR.

Re: ebook distortion

Posted: 2010-12-14T02:56:57-07:00
by geep999
All pages would have same distortion, so once I find the algorithm for first pages, it will be ok for all of them.
Gwenview (Linux viewer) displayed a thumbnail image of your book in which I saw it being held between two hands standing on a table. I was thinking that it would be difficult to make that accurately repeatable.
Why not scan and OCR it?
I don't unsrestand the question: this is what I am trying to do! I am "scanning" a book with a camera, and I'd like to distort the resulting images to get then processable by an OCR.
Sorry - I meant scan with a real scanner, not a camera. But if you've no scanner then you're stuck with the camera.
Even with a scanner you run into problems with distortion at the middle of the book.

Good luck,
Peter

Re: ebook distortion

Posted: 2010-12-14T05:15:15-07:00
by jumpjack
geep999 wrote:
All pages would have same distortion, so once I find the algorithm for first pages, it will be ok for all of them.
Gwenview (Linux viewer) displayed a thumbnail image of your book in which I saw it being held between two hands standing on a table. I was thinking that it would be difficult to make that accurately repeatable.
Putting some markers on the table, I was able to shoot 10 pictures with identical shape of the pages.
geep999 wrote:
Why not scan and OCR it?
I don't unsrestand the question: this is what I am trying to do! I am "scanning" a book with a camera, and I'd like to distort the resulting images to get then processable by an OCR.
Sorry - I meant scan with a real scanner, not a camera. But if you've no scanner then you're stuck with the camera.
I also have a flatbed scanner, but don't want to use it, for two reasons:
- fully opening a book a couple of hundreds of times can damage it
- I'd like to make a"DIY bookscanner" affordable for every owner of just a cellphone. My one has 5 MP camera, but I think 3 or even 2 would be enough.

edit:
3rd reason: my phone can take automagically thousands of picture at 10 seconds delay. I think all nokia phones can do it.

Re: ebook distortion

Posted: 2010-12-14T19:15:42-07:00
by anthony
Okay so it looks like you are stuck with a very freeform polynomial.

So get a book containg a large grid pattern. Locate all the gird pixels (morphology can help with that. and figure out where you want each of those points to end up in the final image. Store that in a file...

sx1 sy1 dx1 dy1
...

for source x,y to destination x,y

now add one more line at the top (the polynomial order) to fit to that data. make it at least 2 may be 3. And use it.
Do it with the grid photo image first
convert input_grid.png -distort polynomial '@grid_data.txt' result.png

Give us links to your grid image and data would also be good.

once you have it for the grid, you can repeat it for all your other pages.

Re: ebook distortion

Posted: 2010-12-15T01:01:01-07:00
by jumpjack
anthony wrote: now add one more line at the top (the polynomial order) to fit to that data. make it at least 2 may be 3. And use it.
I don't understand this part.

Re: ebook distortion

Posted: 2010-12-15T22:57:53-07:00
by anthony
The one number on the first to specify the 'order' for the polynomial

Eg:

3
10,10 0,0
10,5 0,10
and so on

Re: ebook distortion

Posted: 2010-12-16T02:50:41-07:00
by jumpjack
anthony wrote:The one number on the first to specify the 'order' for the polynomial

Eg:

3
10,10 0,0
10,5 0,10
and so on
I guess you mean "add a '3' as first line". I didn't get why you were talking about one line while meaning one number (as I'm specifying all parameters on a single line).
But I already did it, with weird results; that's why I was asking at the beginning if I have to specify points in a specific oder (clockwise, ccw, line by line... ?).
I thought just specifying points for the "contour" of the text area was enough. Specifying 3-4 points per each text line is not a good option, I think.

Re: ebook distortion

Posted: 2010-12-16T17:38:09-07:00
by anthony
The order of control points is not important.

However do not just select points along the curve. It will fail.

You need to specify pixels all over the image. including all corners, edges, and middle.

Polynomial requires lots of points. The more the better, the more uniform the better.

perhaps you can give use the list of points?

Re: ebook distortion

Posted: 2010-12-17T09:06:36-07:00
by jumpjack
anthony wrote: Polynomial requires lots of points. The more the better, the more uniform the better.
Like describing a surface rather than a line?
Thanks, I'll try.