【发布时间】:2021-01-25 08:45:08
【问题描述】:
我正在做一个项目,拍摄电表读数并处理图像以识别数字并将其上传到云端。
import cv2
import numpy as np
from matplotlib import pyplot as plt
from PIL import Image
image = cv2.imread('meter1.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('Original image',image)
cv2.imshow('Gray image', gray)
threshold = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY, 83, 5)
cv2.imshow('Adaptive Gaussian', threshold)
cv2.imwrite('Binary.png',threshold)
cv2.waitKey(0)
cv2.destroyAllWindows()
这是我到目前为止编写的代码,它将 RGB 图像转换为灰度,然后使用自适应阈值处理
接下来我该怎么做?我应该使用 tesseract OCR 吗?提取这些数字或数字的方法是什么
This is the image I got after running the code
请帮助了解如何从这个阶段开始
【问题讨论】:
-
如果始终是同一个7段显示,"font"非常有限,你应该可以使用"template matching" 非常准确。
标签: python-3.x opencv matplotlib image-processing