adamancer / stitch2d

A Python script used to stitch a two-dimensional grid of tiles into a mosaic
MIT License
26 stars 6 forks source link

Defining stitching positions #5

Open LigoMan99 opened 8 months ago

LigoMan99 commented 8 months ago

Hi Adam, I am a fellow geologist. I built this rig:

image

so i could take pictures of the drill core as it comes out of the ground. I am trying to stitch the resulting images with Stitch2D and hitting a wall. In the first case it is just putting the images next to each other, in the second case it cannot find any alignment.

image

These are the sample images I am trying to stitch:

Run2.zip

I am a python and programing newbie, many thanks in advance for you help.

adamancer commented 8 months ago

This is an interesting use case (and very much up my alley) but I'm sorry to say that I don't think this library is going to work for it. There are two issues. One is the part of the tray that is visible in the right side of the image. This isn't a huge deal and can be cropped, but the other issue is that it looks like the images aren't framed similarly enough. To see what I mean, you can run the following code to put the cropped images together side by side:

from stitch2d import StructuredMosaic

mosaic = StructuredMosaic("Run2", dim=7)
mosaic.save("mosaic.jpg")

Which produces this:

mosaic

If you look at the seams where the tiles meet, it looks like the spacing/size of the rulers varies from image to image (that is, the images are not quite flat or at the same distance from the camera). It should still be possible to align them using an image recognition tool. OpenCV, which does most of the heavy lifting in this package, handles cases like these by warping the individual images to better align common features. I didn't include warping in stitch2d (I've found it to be counterproductive for microscope mosaics), so it's too dumb/simple to handle this case.

You might want to check out the stitching tools here, which are more complex but also a lot more flexible. Good luck!