如何使用 OpenCV 识别低质量图像中的数字?

问题描述

我需要使用 Python 帮助和 OpenCV 将第一张图像转换为第二张图像。请帮我做到这一点!

样本输入

Sample Input

样本输出

Sample Output

解决方法

使用此代码 -

import cv2  
img  = cv2.imread(r'image.png',1)  
retval,threshold = cv2.threshold(img,20,255,cv2.THRESH_BINARY)  
cv2.imshow("Threshold",threshold)  
cv2.waitKey(0)  

输出 -

enter image description here