简体   繁体   English

Pyzbar 不识别 CODE-128 条码

[英]Pyzbar does not recognize CODE-128 barcode

I am trying to read text encoded in barcode - I am using pyzbar like this:我正在尝试读取以条形码编码的文本——我正在使用pyzbar ,如下所示:

from pyzbar import pyzbar
import cv2

img = cv2.imread("example/path")
barcodes = pyzbar.decode(img, symbols=[pyzbar.ZBarSymbol.CODE128])

print(barcodes)

It normally works, but in the last batch of barcodes that I have received, pyzbar cannot read them - output of pyzbar.decode is [] .它正常工作,但在我收到的最后一批条形码中, pyzbar无法读取它们 - pyzbar.decode 的pyzbar.decode[] There is one example:有一个例子:

在此处输入图像描述

I have tried to put it into online decoder and it decodes it just fine (it also says the barcode type is CODE-128).我试着把它放到在线解码器中,它解码得很好(它还说条形码类型是 CODE-128)。 Anybody knows, how can I read it in Python, please?有谁知道,请问Python怎么读?

This picture shows a lot of ringing (contours reinforced in black).这张照片显示了很多振铃(黑色加强的轮廓)。 That could be the reason for the failure.这可能是失败的原因。 Try blurring the image before a read.在阅读之前尝试模糊图像。 Binarization also works seamlessly.二值化也可以无缝工作。

在此处输入图像描述

在此处输入图像描述

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

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