Remove background color in image processing for OCR

前端 未结 6 2120
借酒劲吻你
借酒劲吻你 2021-02-01 10:50

I am trying to remove background color so as to improve the accuracy of OCR against images. A sample would look like below:

6条回答
  •  我在风中等你
    2021-02-01 11:31

    Hope this helps someone

    Using one line code you can get is using OpenCV and python

    #Load image as Grayscale
    im = cv2.imread('....../Downloads/Gd3oN.jpg',0)
    #Use Adaptivethreshold with Gaussian
    th = cv2.adaptiveThreshold(im,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2)
    

    Here's the result

    Here's the link for Image Thresholding in OpenCV

提交回复
热议问题