ocr - Eliminating Interferential Curve of Text in Images? -
as can see,i have image of formulas
but has interferential curve,so how can remove it?
i tried erode , dilate failed.
you can remove lines using image inpainting. need make mask first. take @ this- http://docs.opencv.org/trunk/df/d3d/tutorial_py_inpainting.html
this code (python) helps make mask:
import cv2 import numpy np imgg=cv2.imread("your_image.png") flag = false def draw(event,x,y,flags,param): global flag if event == cv2.event_lbuttondown: flag = true elif event == cv2.event_mousemove: if flag == true: cv2.circle(img,(x,y),2,(255,255,255),-1) elif event == cv2.event_lbuttonup: flag = false img = np.zeros(imgg.shape[:2], np.uint8) cv2.namedwindow('image') cv2.setmousecallback('image',draw) while(1): cv2.imshow('image',imgg) cv2.imshow("mask",img) if(cv2.waitkey(1))==27: break cv2.imwrite("mask.png",img) cv2.destroyallwindows()
Comments
Post a Comment