基础镜像

我的Python 3源代码:
from wand.image import Image
from wand.display import display
with Image(filename='edited.png') as img:
with Image(img) as negate:
negate.alpha_channel = False
negate.transform_colorspace('gray')
negate.resize(width=negate.width*2, height=negate.height*2, filter='lanczos', blur=0.5)
negate.negate()
negate.contrast_stretch(black_point=0.00, white_point=0.8, channel=None)
negate.sharpen(radius=0, sigma=1)
display(negate)准备好的图像到tesseract

我们需要识别数字和一些文本。我的解决方案很好,但80%有效。如何做得更好,有什么选择吗?
发布于 2021-09-23 18:34:46
我不确定为什么你的解决方案80%有效,但如果你使用pytesseract 4.1.1版,结果将如下所示:
Horsepower 1,675 HPA Pen Value at 100m §92/654/600 Nm Soft Terrain Resistance 2.20
Top Forward Speed 67 KM/H Pen Value at 500m 584/645/600 wm Medium Terrain Resista 130
Top Reverse Speed 20 KM/H Pen Value at 1000m 575/635/600 Nw Firm Terrain Resistance 1.10
Hull Rotation Speed 26 DEG/S Pen Value at 2000m 552/610/600 Nw
Weight to Horsepower F 26.56 Detectability Range: Sti 407.08 a
Fire Chance 10.00% Armor Damage 5§35/535/535 He Detectability Range: Mo 426.04 _
Module Damage 190/190/190 He
Accuracy at 100m 0.26" Blast Radius 0/0/0m View Range 515 M
Aiming Time 2.10 sec Turret Rotation Speed a0 oes =f
Max Elevation 20 0&6 = Ammo Max Speed 1,700/1,575/1,140 mys Accuracy During Rotatic 0.83 :
Max Depression 9 DEG AmmoMax Range 3,500/3,500/2,800 Signal Range 690
Ammo Capacity 50 Hit Points 4,000 He
Reload Time 7.90 sec Yaw Limit -180 180 oes
Rate of Fire 7.59 RPM Shell Type 1 APFSDS
Shots Per Clip 1 Shell Type 2 APFSDS
Intra-clip reload N/A Shell Type 3 HEAT我检查了几个单词,它与原始输入图像相匹配。
我使用的是opencv而不是wand
代码:
import cv2
import pytesseract
# Load the img
img = cv2.imread("XX2ry.png")
# Cvt to gry
gry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# OCR detection
txt = pytesseract.image_to_string(gry, config="--psm 6")
print(txt)也许你应该检查一下page segmentation methods
https://stackoverflow.com/questions/69291488
复制相似问题