Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stitch together images with exactly matching (pixel to pixel) overlaps

I have a bunch of images in a folder that are effectively just pieces of one image that was broken into overlapping parts. How can I quickly and programmatically recombine these images to create the original image?

I would prefer a solution that uses python or mathematica (or is an existing application), but I am open to other ideas as well (I am fairly proficient with Java).

like image 728
Muhd Avatar asked Jun 24 '12 03:06

Muhd


People also ask

What is stitching in image processing?

Image stitching or photo stitching is the process of combining multiple photographic images with overlapping fields of view to produce a segmented panorama or high-resolution image.

What is overlap images?

But what does it mean by “overlap”? Overlap contains both the front-overlap (frontlap) and side-overlap (sidelap). Sidelap refers to the percentage of overlap between different flight legs. Just as the below picture shows, the same size of image (which is represented by the rectangle) is captured on each spot.


1 Answers

i realize this answer comes very late, but since i spent some time googling this problem, i thought i would post a fairly simple solution using python.

import cv2
#works in version 4.2
cv2.__version__

#mode=0 photos, mode=1 scans
stitcher = cv2.Stitcher.create(mode=1)

img1 = cv2.imread("frame-0021.png")
img2 = cv2.imread("frame-0022.png")

result = stitcher.stitch((img1, img2))
cv2.imwrite("stitched.png", result[1])
like image 172
nils-holmberg Avatar answered Oct 13 '22 20:10

nils-holmberg