OpenStitching / stitching

A Python package for fast and robust Image Stitching
Apache License 2.0
2.01k stars 157 forks source link

Support for stitching multi channel images (e.g. as numpy arrays instead of filenames) #46

Closed Nelson-Gon closed 1 year ago

Nelson-Gon commented 1 year ago

Hi,

Thanks for this package. I was trying it out and noticed that currently Stitcher.stich() only supports a list of filenames.

I was wondering whether it could be possible to support a list of NumPy arrays instead, for instance. This would be useful for example in cases where you only want to stitch specific channels of different images.

Currently, it also seems to fail with multiple channel images with the error:

...
---> 53             raise StitchingError("No match exceeds the " "given confidence threshold.")
     54 
     55         return indices

StitchingError: No match exceeds the given confidence threshold.

Thank you and apologies if you've tackled this issue already elsewhere. NelsonGon

lukasalexanderweber commented 1 year ago

Can you give me some more details on your use case? How many bands do the images to bei stitched have?

Having the "raw" numpy arrays in memory as Input can leed to memory issues on high resolution Images, thats why its not supported (yet)

(Sorry for closing, that was by mistake)

lukasalexanderweber commented 1 year ago

Can you give me some more details on your use case? How many bands do the images to bei stitched have?

any updates?

Nelson-Gon commented 1 year ago

Hi sorry,

For example if each image has the shape (channels, height, width), would it be possible to stitch together each of the first channels. So:

Stitcher.stitch([x[0] for x in multi_channel_images])

or

Stitch.stitch([imread(x)[0] for x in image_files])

or maybe some channel flag to specify which channels to stitch?

lukasalexanderweber commented 1 year ago

On which channels do you want to perform the image registration (Feature Detection, Matching)? Do you have an example dataset?

I think that we should be able to utilize the obtained cameras to stitch all channels together.

I don't think that we can perform the image registration part on more or less than three bands (but we need to check this).

Nelson-Gon commented 1 year ago

I unfortunately do not have a sample dataset right now but will look into creating one. For the registration, I think it should be possible since we can register two images with (height, width) independently, at least in packages like skimage. I think the same should be possible with opencv.