简体   繁体   English

我应该怎么做才能识别七段显示器中的数字?

[英]What should I do to recognize digits from an seven segment display?

I'am working on a project to take pictures of the electricity meter reading and process the image to recognize the numbers and upload it to the cloud.我正在做一个项目,拍摄电表读数并处理图像以识别数字并将其上传到云端。

   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()

This is the code I have written so far which converts RGB image to grayscale and then used adaptive thresholding这是我到目前为止编写的代码,它将 RGB 图像转换为灰度,然后使用自适应阈值

This the image I used这是我使用的图像

What should I do next?接下来我该怎么办? Should I use tesseract OCR?我应该使用 tesseract OCR 吗? What are the ways to extract these digits or numbers提取这些数字或数字的方法有哪些

This is the image I got after running the code这是我运行代码后得到的图像

Please help on how to proceed from this stage请帮助了解如何从这个阶段继续

Just check a point (or mean of a small ROI inside a segment) in each segment to recognize which digit is displayed.只需检查每个段中的一个点(或段内小 ROI 的平均值)即可识别显示的是哪个数字。

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

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