OpenStitching / stitching

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

refactor image handling #114

Closed lukasalexanderweber closed 1 year ago

lukasalexanderweber commented 1 year ago

@3nol maybe you want to have a look on those changes. My idea was that we can produce the scaled image masks by adding

    def read_masks(self, mask_names):
        mask_names = Images.resolve_wildcards(mask_names)
        assert len(mask_names) == len(self.img_names)
        for idx, name in enumerate(mask_names):
            img = Images.read_image(name)
            size = Images.get_image_size(img)
            np.testing.assert_array_equal(self.img_sizes[idx], size)
            yield img

and just use the normal resize function in the stitcher:

feature_masks = self.images.read_masks(feature_mask_names)
feature_masks = self.images.resize(imgs, Images.Resolution.MEDIUM)
feature_masks = list(feature_masks)

Of course this change is not backwards compatible, so I would also need to adjust the tutorial (no ImageHander anymore). I think it's worth it but it would be great to have feedback about this