Apr-26-2018, 07:38 AM
I am trying to create a watermark remover in python using opencv. I have 10000 different images of 10 types of watermark in it, i have created an opencv that can remove watermark from 1 image when i create the mask of it. Right now i am creating mask using paint, how can i create mask of each watermarked image? Please consider the position of the watermark is same at each location. Below is my code and attached are the samples of watermark
import cv2 import matplotlib.pyplot as plt import numpy as np import random def main(): path = "D:\\imageRestoration\\" imgpath = path + "IndiaProperty.jpg" maskpath = path + "mask_India.jpg" img = cv2.imread(imgpath, 1) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) mask = cv2.imread(maskpath, 0) output1 = cv2.inpaint(img, mask, 5, cv2.INPAINT_TELEA) output2 = cv2.inpaint(img, mask, 5, cv2.INPAINT_NS) output = [img, mask, output1, output2 ] titles = ["Damaged Image","Mask", "TELEA", "NS"] cv2.imwrite("Damaged.jpg", cv2.cvtColor(output1, cv2.COLOR_RGB2BGR)) for i in range(4): plt.subplot(2, 2, i+1) plt.imshow(output[i], cmap="gray") plt.title(titles[i]) plt.xticks([]) plt.yticks([]) plt.show() if __name__ == "__main__": main()enter image description here