我正在构建一个需要能够扫描二维码的 Windows Phone 应用程序(使用 Windows 运行时,它是一个通用应用程序)。为此,我正在使用 ZXing.NET。我遇到的问题如下:当相机开始捕捉时,ZXing 抛出一个 IndexOutOfRangeException:
A first chance exception of type 'System.IndexOutOfRangeException' occurred in ZXing.winmd
at ZXing.BitmapLuminanceSource..ctor(WriteableBitmap writeableBitmap)
at ZXing.BarcodeReader.<.cctor>b__4(WriteableBitmap bitmap)
at ZXing.BarcodeReader.Decode(WriteableBitmap barcodeBitmap)
at xxx.Views.Scanner2.ScanBitmap(WriteableBitmap writeableBmp)
at xxx.Views.Scanner2.<OnNavigatedTo>d__5.MoveNext()
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是:
while (_result == null)
{
using (var stream = new InMemoryRandomAccessStream())
{
await _mediaCapture.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), stream);
stream.Seek(0);
var writeableBitmap = new WriteableBitmap(1, 1);
await writeableBitmap.SetSourceAsync(stream);
_result = ScanBitmap(writeableBitmap);
}
}
Run Code Online (Sandbox Code Playgroud)
ScanBitmap 函数如下所示:
private Result ScanBitmap(WriteableBitmap writeableBmp)
{
var barcodeReader = new BarcodeReader
{
Options = new DecodingOptions …Run Code Online (Sandbox Code Playgroud) 我想设置tess4j为只识别数字和字母
Tesseract instance = new Tesseract();
instance.setDatapath("C:\\Users\\qyw\\Desktop\\tessdata");
String s = instance.doOCR(img);
System.out.println(s);
Run Code Online (Sandbox Code Playgroud) 我想知道如何使用 python 在 opencv 中绘制图像的垂直直方图,以便识别该图像的文本行
我想使用谷歌云视觉 API 的图像文本检测(OCR)。但我不知道如何获取订阅密钥以及如何在 C# 中进行身份验证和拨打电话。有人可以告诉我执行此操作的步骤吗?顺便说一句,我很新。
在尝试在 python 中安装 pypdfocr 包时出现以下错误。
ERROR: Command errored out with exit status 1:
command: 'c:\users\User\appdata\local\programs\python\python37-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GIBIN_~1\\AppData\\Local\\Temp\\pip-install-uansf_7f\\evernote\\setup.py'"'"'; __file__='"'"'C:\\U
sers\\GIBIN_~1\\AppData\\Local\\Temp\\pip-install-uansf_7f\\evernote\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base
pip-egg-info
cwd: C:\Users\GIBIN_~1\AppData\Local\Temp\pip-install-uansf_7f\evernote\
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\GIBIN_~1\AppData\Local\Temp\pip-install-uansf_7f\evernote\setup.py", line 6
exec x
^
SyntaxError: Missing parentheses in call to 'exec'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for …Run Code Online (Sandbox Code Playgroud) 亲爱的社区,我正在尝试做一些 ocr。
我已经对图像进行了很多预处理(去歪斜,裁剪......)
现在,我可以毫无问题地自己读取数字
但是我无法得到 tesseract 给我一个有意义的结果。
单击顶部的链接查看我正在尝试 OCR 的图像
我缺少更多的预处理吗?
或者我称 tesseract 很糟糕?
我根本没有选择,或者尝试:
config = ('--psm 13 -c tessedit_char_whitelist=0123456789')
Run Code Online (Sandbox Code Playgroud)
编辑 :
有趣的是,我尝试了多种方法:
所以这对我来说非常重要。我可能更喜欢使用 Tesseract,以免花大钱。当我的项目更先进时,我会知道我能做什么。
但我很想听听您对图像预处理的建议!!:-)
所以如果你有建议。
问候 !
如何在 AWS Linux 中安装 Tesseract?几个月前,我们的一名团队成员尝试了以下命令。
cd /opt
mkdir tesseract
chmod 0755 tesseract
cd tesseract
yum install libpng-devel
yum install libtiff-devel
yum install libjpeg-devel
wget http://www.leptonica.com/source/leptonica-1.71.tar.gz
tar xzf leptonica-1.71.tar.gz
cd leptonica-1.71
./configure
make
make install
export LIBLEPT_HEADERSDIR=/usr/local/include # Add to .profile
cd /opt/tesseract
yum install libtool
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
tar xzf tesseract-ocr-3.02.02.tar.gz # Makes tesseract-ocr directory, no version.
cd tesseract-ocr
./autogen.sh
./configure --with-extra-libraries=/opt/tesseract
make
sudo make install
sudo ldconfig
cd /opt/tesseract
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz
tar xzf tesseract-ocr-3.02.eng.tar.gz # Makes tesseract-ocr/tessdata directory.
sudo cp …Run Code Online (Sandbox Code Playgroud) 我收到错误 TesseractError: (2, 'Usage: pytesseract [-l lang] input_file')。使用 !sudo apt install 但仍然在colab中收到错误。它是我正在尝试阅读的 JPG。
- - - - - - - - - - - - - - -代码 - - - - - - - - - - -----------------
! apt install tesseract-ocr
! apt install libtesseract-dev
! sudo apt install tesseract-ocr
! pip install Pillow
! pip install pytesseract
import pytesseract
import shutil
import os
import cv2
import random
from google.colab import files
from io import BytesIO
from …Run Code Online (Sandbox Code Playgroud) 当我使用 Pytesseract 识别该图像中的文本时,Pytesseract 返回7A51k但该图像中的文本是7,451k。
如何使用代码解决此问题而不是提供更清晰的源图像?
我的代码
import pytesseract as pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = 'D:\\App\\Tesseract-OCR\\tesseract'
img = Image.open("captured\\amount.png")
string = pytesseract.image_to_string(image=img, config="--psm 10")
print(string)
Run Code Online (Sandbox Code Playgroud) 我的图像如下所示:
我的目标是检测并识别该数字31197394。我已经对文本识别的深度神经网络进行了微调。如果以以下格式提供,它可以成功识别正确的号码:
剩下的唯一任务是检测相应的边界框。为此,我尝试了darknet。不幸的是,它无法识别任何东西。有人知道在此类图像上表现更好的网络吗?我知道,亚马逊识别能够解决这个任务。但我需要一个可以离线工作的解决方案。因此,我仍然对存在有效的预训练网络抱有很高的希望。非常感谢你的帮助!