Skip to main content
 首页 » 编程设计

python之如何在 Python 中读取数据矩阵代码

2025年05月04日15sky-heaven

我想知道如何在 python 中使用 openCV 读取数据矩阵条码

我找到了 How to locate and read Data Matrix code with python但这对我来说还不清楚。我想显示读取条码的结果输出。

请您参考如下方法:

好的,几天后我找到了解决方案:

import cv2 
from pylibdmtx.pylibdmtx import decode 
import ctypes   
 
def Mbox(title, text, style): 
    return ctypes.windll.user32.MessageBoxW(0, text, title, style) 
 
# Read file using OpenCV 
Mbox('Data Matrix', str(decode(cv2.imread('C:/Users/User/Desktop/Zdjecia_QrCode/again2.png'))), 1) 

但我想知道如何提高阅读能力,因为我无法阅读每个数据矩阵。你有什么想法吗?