In my quest to read DATA MATRIX barcodes with JeVois, I realised it would be much simpler to do it with libdtmtx
I basically want to achieve the following. Here's a demo on my win10 64bits laptop
C:\Users\user\Desktop\2018-11 marker indoor test python>python -m pip search pylibdmtx
pylibdmtx (0.1.7) - A ctypes-based wrapper around the libdmtx datamatrix barcode reader.
C:\Users\user\Desktop\2018-11 marker indoor test python>python -m pip install pylibdmtx
Collecting pylibdmtx
Downloading https://files.pythonhosted.org/packages/3c/7f/d625413ea41162de05374249765e1df67aa97b89d83bb89be6ed578a0566/pylibdmtx-0.1.7-py2.py3-none-win_amd64.whl (94kB)
100% |████████████████████████████████| 102kB 181kB/s
Installing collected packages: pylibdmtx
The script read_datamatrix.exe is installed in 'C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pylibdmtx-0.1.7
C:\Users\user\Desktop\2018-11 marker indoor test python>python -i
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylibdmtx.pylibdmtx import decode
>>> import cv2
>>> decode(cv2.imread('DM_small.png'))
[Decoded(data=b'0123456789', rect=Rect(left=6, top=107, width=59, height=59))]
>>>
It basically just decoded the following image
Now when i use the following python code in a new vision module:
import libjevois as jevois
import cv2
import numpy as np
from pylibdmtx.pylibdmtx import decode
class MyDataMatrix:
def __init__(self):
self.timer = jevois.Timer("processing timer", 100, jevois.LOG_INFO)
def process(self, inframe, outframe):
inimg = inframe.getCvBGR()
outimg = inimg
# Write a title:
cv2.putText(outimg, "JeVois MyDataMatrix", (3, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,0,255))
outframe.sendCv(outimg)
I have a runtime error because pylibdmtx is not installed on JeVois.
How do I make a python -m pip install pylibdmtx on JeVois ?