Page 1 of 1

extracting multiple pages from one image

Posted: 2016-07-17T05:29:40-07:00
by analyst
I have 3 pages scanned in the 1 image. How do I extract them ?

Re: extracting multiple pages from one image

Posted: 2016-07-17T05:41:12-07:00
by snibgo
Wave a magick wand.

If you want a more helpful answer, you could provide an example image.

Re: extracting multiple pages from one image

Posted: 2016-07-17T05:51:16-07:00
by analyst
how do I attach an image to this board. I look carefully and could not find it.

Re: extracting multiple pages from one image

Posted: 2016-07-17T05:57:02-07:00
by snibgo
Upload to somewhere like dropbox.com and paste the URL here.

Re: extracting multiple pages from one image

Posted: 2016-07-17T06:08:10-07:00
by analyst
multicrop -f 10 -u 2
is not working because background apparently sucks.

http://www.fmwconcepts.com/imagemagick/multicrop2


Image Link:
https://drive.google.com/open?id=0Bx0mR ... lBYZHJndlE

Re: extracting multiple pages from one image

Posted: 2016-07-17T06:42:31-07:00
by snibgo
There are no straight lines that will separate the books from each other. A general method is unlikely to work for images like this.

If the books are always laid out like this, you could write a custom script. For example, finding the four corners of the right-hand book is easy, so it can be isolated and corrected for perspective. But where is the boundary of the two left-hand books? There is a small background area on the left, but extending that horizontally to the right would chop text from the upper book.

You would need to follow the curved shadow between the books. Eg make that shadow black, and use it as the boundary between the books. You know the other edges, so the other boundaries can be painted black, the books painted white, and use connected-components.

Then, dividing each book into two pages is simpler.

So, it could be done, but not easily.

Re: extracting multiple pages from one image

Posted: 2016-07-17T06:51:15-07:00
by analyst
I will use this thread to document my experience. To start with, what is the command(s) to find the curved shadow in general ?

Re: extracting multiple pages from one image

Posted: 2016-07-17T07:15:14-07:00
by snibgo
This makes the curved shadow between the left-hand books black:

Code: Select all

convert sixPages.jpg -colorspace Gray -blur 0x5 -unsharp 0x5+100+0 -threshold 40% x.png
Assuming the two left-hand books have been cropped out, the widest black connected-component is the shadow.

EDIT: -blur 0x5 works better.