I want to merge two pictures but I do not know how to find the cut location in y-axis by any Linux/Unix tools, but here ImageMagick as the first idea.
Any approach is welcome: a programmatic solution or a method for solving the problem with manual assistance.
Two pictures have joint similarity in y-axis, which I want to minimise and then merge for output.
Pseudocode
- Find the y-axis location where the data is first time equal in both pictures.
- Minimise the y-axis equality of two pictures as long there is no equality between the pictures.
- Cut each picture by appropriate location. For top by percentages here,
convert -gravity SouthWest -crop 100x70%x+0+0 infile.jpg outfile.jpg
. For bottom similarly,convert -gravity NorthWest -crop 100x70%x+0+0 infile.jpg outfile.jpg
. - To merge correct parts of two images etc (here) by
convert -append A-edit.jpg B-edit.jpg output.png
Fig. 1 Image A,
Fig. 2 Image B,
Fig. 3 Expected output
Best Answer
Hugin will stitch these images for you.
There's a script available within the tutorial for stitching scanned images called run-scan-pto_var.sh that will do exactly what you need.
On my Debian system I need to install two packages (and, of course, their dependencies):
In the interests of question completeness I've included a slightly modified version here (this version accepts image filenames on the command line instead of them being hardcoded):
If your images are called
wIowW.jpg
andorMDp.jpg
- as yours are named - and you want the result inrsp.tif
you can run the script like this:The output is always written to a TIFF file. However, this format is trivially converable to just about any other image format.
The result?