manju
manju

Reputation: 98

Stitching binary image in python

For text detection, I split the entire image for better results (all those images with the same dimensions having overlapping) and generate its mask(Binary image) and merge those split images into one full image(with the dimension of the original image).

image: Full image split images masked binary image

now I used to merge all these images, but the overlapped image where the text not detected removes the white patch in the image full merged mask image.

In order to overcome this issue I came to know about the stitching image in OpenCV, hence I used this link for stitching imagehttps://www.pyimagesearch.com/2018/12/17/image-stitching-with-opencv-and-python/#pyi-pyimagesearch-plus-pricing-modal, but this code doesn't work for a binary image. Is it possible to stitch binary image with overlapping in OpenCV?

Upvotes: 3

Views: 612

Answers (1)

suji
suji

Reputation: 407

Stitching in OpenCV python is only for panorama images(camera images) where it finds and matches the features in the image as you refer to this link:https://docs.opencv.org/master/d1/d46/group__stitching.html

if you want to get merge those image you can use it simply with PIL in python:https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.paste

merge those image with :image.paste(im, (x, y),mask=im) Where the mask is 255, the given image is copied as is. Where the mask is 0, the current value is preserved.

Upvotes: 2

Related Questions