我正在学习图像处理,我正在尝试开始我的第一个项目,即图像中的简单数字识别。
到目前为止,我已经对图像应用了阈值处理。现在我想知道一些算法,我的系统可以通过这些算法识别图像中的数字。优选地,该算法必须简单,并且不必太鲁棒,因为我将使用相同的字体在绘画中生成图像。
我在这里查看了类似的问题,他们都指出使用库。记住我正在努力学习的人,所以请不要指出一些图书馆。
algorithm matlab image-processing image-recognition matlab-cvst
我使用 Tesseract 和 python 读取数字(从能量计)。除了数字“1”外,一切正常。Tesseract 无法读取“1”数字。
tesseract 读作“0000027”。
我如何告诉 Tesseract 垂直杆是“1”?
这是我的tesseract初始化:
import tesseract
TESSERACT_LIBRARY_PATH = "C:\\Program Files (x86)\\Tesseract-OCR"
LANGUAGE = "eng"
CHARACTERS = "0123456789"
FALSE = "0"
TRUE = "1"
def init_ocr():
"""
.. py:function:: init_ocr()
Utilize the Tesseract-OCR library to create an tesseract_ocr that
predicts the numbers to be read off of the meter.
:return: tesseract_ocr Tesseracts OCR API.
:rtype: Class
"""
# Initialize the tesseract_ocr with the english language package.
tesseract_ocr = tesseract.TessBaseAPI()
tesseract_ocr.Init(TESSERACT_LIBRARY_PATH, …Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个用于识别七段显示的OCR,如下所述
使用开放式CV的预处理工具我在这里得到它
现在我正在尝试按照本教程 - https://www.pyimagesearch.com/2017/02/13/recognizing-digits-with-opencv-and-python/
但就此而言
digitCnts = contours.sort_contours(digitCnts,
method="left-to-right")[0]
digits = []
Run Code Online (Sandbox Code Playgroud)
我收到错误 -
使用THRESH_BINARY_INV解决了错误,但仍然没有OCR工作任何修复都会很好
文件"/Users/ms/anaconda3/lib/python3.6/site-packages/imutils/contours.py",第25行,在sort_contours中key = lambda b:b 1 [i],reverse = reverse))
ValueError:没有足够的值来解包(预期2,得到0)
任何想法如何解决这个问题,让我的OCR成为一个有效的模型
我的整个代码是:
import numpy as np
import cv2
import imutils
# import the necessary packages
from imutils.perspective import four_point_transform
from imutils import contours
import imutils
import cv2
# define the dictionary of digit segments so we can identify
# each digit on the thermostat
DIGITS_LOOKUP = {
(1, 1, 1, 0, 1, 1, 1): 0, …Run Code Online (Sandbox Code Playgroud) 我们正在使用opencv for android实现OCR,一切顺利,直到使用Imgproc.findcontours()找到轮廓的部分,它返回的轮廓与输入图像中的轮廓不同,即:输入图像MNOP第一个轮廓得到来自findcontours()是P输入图像EFGH第一个轮廓来自findcontours()是E(这里是右边)输入图像IJKL第一个轮廓来自findcontours()是J所以它似乎随机提取轮廓我们如何修复这个?因为我们想要回复这个词,因为它完全写在图像中
我必须编写一个程序,从驱动程序前面的汽车内部屏幕上拍摄的视频中进行OCR,因此它只对数字进行OCR.我试图找到实现它的方法.我正在考虑使用openCV,但作为一种替代方案,我正在考虑使用OCR程序从视频中获取帧并找到数字.但是许多OCR程序无法正确识别数字(可能是OCR需要培训吗?).所以我想用计算机视觉库来完成工作.
您认为实施这个简单程序的最佳方式是什么?
我认为使用具有匹配模板的计算机视觉库会很好,但也许OCR可以帮助我.例如,有一些程序可以进行车牌识别.
所以欢迎任何建议.
我正在努力处理一个项目,该项目从标签中获取非常清晰的字体图像,例如读取“文本区域”并使用 OCR tesseract 将其输出为字符串。
现在我在这件事上取得了相当大的进展,因为我添加了 varios 全局过滤器以获得非常清晰的结果,但我正在努力寻找仅过滤文本的方法,然后您必须考虑将其旋转为尽可能水平,然后简单的部分应该是裁剪它。
我是否可以在不使用训练数据和使系统罪过复杂化的情况下如何做到这一点,我只使用 rasdpberry pi 进行计算?
感谢您的帮助,这是我目前想到的:
原始图像(从 PiCamera 捕获):
去除阴影后的自适应阈值:
[![https://i.imgur.com/rqWoUsI.jpg[2]](https://i.imgur.com/rqWoUsI.jpg)
去除阴影后的 Glocad 残渣:
这是代码:
# import the necessary packages
from PIL import Image
import pytesseract
import argparse
import cv2
import os
import picamera
import time
import numpy as np
#preprocess = "tresh"
#Remaining textcorping and rotating:
import math
import json
from collections import defaultdict
from scipy.ndimage.filters import rank_filter
def dilate(ary, N, iterations):
"""Dilate using an NxN '+' sign shape. ary is np.uint8."""
kernel …Run Code Online (Sandbox Code Playgroud) 有人知道python/ruby中的库可以分析图像并提取文本吗?
或者一本关于图像处理的书......
PS:文本采用varius字体和格式,但清晰,Tl; Dr:No captcha或类似.
我正在尝试使用opencv的Haar分类器创建一个OCR库.但它不能正常工作.所以你能告诉我制作OCR的步骤是什么吗?是否可以使用Haar分类器?
ocr ×6
opencv ×6
python ×3
algorithm ×2
matlab ×2
c++ ×1
matlab-cvst ×1
raspberry-pi ×1
tesseract ×1
text ×1