Align two scanned pages

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
LongDog
Posts: 1
Joined: 2011-01-19T16:56:28-07:00
Authentication code: 8675308

Align two scanned pages

Post by LongDog »

Hi,
I am trying to join up a number of (30,000 or so) scanned pages (left and right) to present one image of an open book. Sounds quite straightforward I suppose, but every step forward seems to be two steps back...
A bit of info...each page has a black background and there is some overlap between each image - both left and right show the centre 'spine' of the book and first 100 pixels or so of the opposite page.
Running this
montage null: in1.jpg in2.jpg null: -tile x1 -geometry -100+10 out.jpg
gets me great results for 60% of the images that are naturally horizontally aligned but it is not sophisticated enough to deal with the cases that are not.
Is there any way that I can force the statement to align the images at the join point so that top-right (corner of the page) join point of left page (in1.jpg) and top-left join point of right page (in2.jpg) are horizontally level as they merge?
I am out of my depth and have been working on this / hunting for code for about 48 hours now, any help and advice will be much appreciated!
Thanks
LD
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Align two scanned pages

Post by anthony »

An example image (resize it smaller for discussion purposes) would be useful.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Align two scanned pages

Post by fmw42 »

The compare function in IM will allow you to align a smaller image to where it best fits in a larger image. But there can be no rotation or other scale or perspective distortion. It won't actually do the aligning, only tell you the best match location. Not sure this will help much.

The better solution is to look for commercial software that is used to convert overlapping images into panoramas. But they wont work well if the images or rotated or scale or perspective either.

IM has a polygon distortion, but it requires manually locating many corresponding control points on both images
Post Reply