extracting multiple pages from one image
extracting multiple pages from one image
I have 3 pages scanned in the 1 image. How do I extract them ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: extracting multiple pages from one image
Wave a magick wand.
If you want a more helpful answer, you could provide an example image.
If you want a more helpful answer, you could provide an example image.
snibgo's IM pages: im.snibgo.com
Re: extracting multiple pages from one image
how do I attach an image to this board. I look carefully and could not find it.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: extracting multiple pages from one image
Upload to somewhere like dropbox.com and paste the URL here.
snibgo's IM pages: im.snibgo.com
Re: extracting multiple pages from one image
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
is not working because background apparently sucks.
http://www.fmwconcepts.com/imagemagick/multicrop2
Image Link:
https://drive.google.com/open?id=0Bx0mR ... lBYZHJndlE
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: extracting multiple pages from one image
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.
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.
snibgo's IM pages: im.snibgo.com
Re: extracting multiple pages from one image
I will use this thread to document my experience. To start with, what is the command(s) to find the curved shadow in general ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: extracting multiple pages from one image
This makes the curved shadow between the left-hand books black:
Assuming the two left-hand books have been cropped out, the widest black connected-component is the shadow.
EDIT: -blur 0x5 works better.
Code: Select all
convert sixPages.jpg -colorspace Gray -blur 0x5 -unsharp 0x5+100+0 -threshold 40% x.png
EDIT: -blur 0x5 works better.
snibgo's IM pages: im.snibgo.com