简体   繁体   English

处理图像以获得良好的OCR识别

[英]Process the image for good OCR recognition

I'm trying to proccess a picture. 我正在尝试处理图片。 Initially, there is a lot of noise, but I'm trying to make some improvements. 最初,会有很多噪音,但我正在尝试进行一些改进。 Unfortunately, this does not give much result. 不幸的是,这不会带来太多结果。 It may be possible to realize such a thing that somehow select the center of each black line of letters in the word and do something like their skeleton. 可能会实现这样的事情,即以某种方式选择单词中每条黑色字母的中心并执行类似其骨架的操作。 I have no idea how to do this, so please help here. 我不知道如何执行此操作,因此请在此提供帮助。 The code i'm using now: 我现在使用的代码:

word = cv2.resize(word, (word.shape[1]*2, word.shape[0]*2))
kernel = np.array([[-1,-1,-1], [-1,9,-1], [-1,-1,-1]])
word = cv2.filter2D(word, -1, kernel)
word[np.where((word >= [180,180,180]).all(axis=2))] = [255,255,255]
word[np.where((word <= [179,179,179]).all(axis=2))] = [0,0,0]
cv2.imshow(str(i), word)

it gives this result: 它给出以下结果: 在此处输入图片说明 from this: 由此: enter image description here

Try cv2.erode() . 尝试cv2.erode()

cv2.bitwise_not(img,img)
kernel = np.ones((3,3),np.uint8)
erosion = cv2.erode(img,kernel,iterations = 1)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM