Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

How to add a python lib in JeVois ? (pip install pylibdmtx)

0 votes

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 ?

asked Nov 28, 2018 in Programmer Questions by fourchette (580 points)

1 Answer

0 votes
Thanks for your patience, starting to look at this now. So that library is written in C++ which is great. Looks a bit old though so hopefully it still compiles on a modern compiler. Have you seen this one:

http://jevois.org/tutorials/ProgrammerDlib.html

We will use those same steps and give it a try for your library.
answered Dec 7, 2018 by JeVois (46,580 points)
any update? did it work?
i couldnt manage to get this to work. I really need data matrix barcode support for my JeVois project. I'm sure it shouldn't be hard for someone who is used to integrating libs in JeVois. I simply cant :/
darn... we started a tutorial a while back but we are now deep into IMU code and need to finish that first. The start of the tutorial is here:

http://jevois.org/tutorials/ProgrammerPythonLib.html

it explains the steps taken so far. Note that you may not be able to run it yet as some new CMake macro had to be created. We are at the point where we get the C library to compile both on host and platform. The next steps are 1) get the python bindings to work and 2) write a module. Maybe you can help with 2) if you have sample code that uses pylibdmtx to find the codes in an OpenCV image?
...