Given a series of photos that are watermarked, I want to isolate the watermark, and generate a mask.
I'm using Python and numpy.
I've added the pictures on top of each other:
def compare_n_img(array_of_img_paths):
img_float_array = []
for path in array_of_img_paths:
img_float_array.append(load_img_as_float(path))
additionF = sum(img_float_array)/len(img_float_array)
addition = additionF.astype('uint8')
return addition
This, convered to grayscale, gives me this composite image.
The watermark is distinctly visible in this composite. For a human, it would be easy to trace.
What I want as a result is a white image, with the shape of the watermark filled in black. So that, if I overlay one of my watermarked images with the mask, the watermark would be completely covered.
I've tried to use edge detection and thresholding on the composite image. But I've not been able to find a way to programmatically isolate the watermark content. Much less to create a clear mask.
I'd like to do this in pure numpy, or cv2, if possible.