JeVois Tutorials
1.22
JeVois Smart Embedded Machine Vision Tutorials
|
|
By connecting to the serial command-line interface of JeVois, you can issue commands (either interactively, or through a program) to modify how the machine vision algorithm currently running inside JeVois works.
Here we will take the simple example of looking for different kinds of barcodes in the field of view of JeVois.
This tutorial requires a JeVois v1.1 or later microSD card.
You need to know how to stream video from JeVois, how to change video mode, and how to communicate with the serial command-line interface of JeVois.
The DemoQRcode module exposes several parameters that are described in its documentation page, see the table of parameters below the screenshots on that page.
Once the module is loaded and running (by selecting the appropriate video resolution in the host video capture software), you can also see the parameters by typing, in the serial terminal connected to JeVois:
help
which lists all available parameters and commands; here, in particular, we find 3 parameters that are specific to the QR code decoding module:
QRcode/Barcode Options: --ydensity (int) default=[1] Scanner horizontal scan density (pixel stride), or 0 to disable Exported By: DemoQRcode:qrcode --xdensity (int) default=[1] Scanner vertical scan density (pixel stride), or 0 to disable Exported By: DemoQRcode:qrcode --symbol (string) default=[ALL] Type(s) of QR code / barcode symbols searched for, multiple entries are possible and should be separated by / characters. Selecting many symbol types or ALL will slow down processing. Supported symbols are: QRCODE, EAN2, EAN5, EAN8, EAN13, UPCE, UPCA, ISBN10, ISBN13, COMPOSITE, I25, DATABAR, DATABAREXP, CODABAR, CODE39, PDF417, CODE93, and CODE128 Exported By: DemoQRcode:qrcode value=[QRCODE]
Looking at the last line of the entry for symbol above, we see that the symbol
parameter was set to value QRCODE; that is, the module is looking for 2-dimensional Quick-Response codes of the type shown in the module's documentation page.
Let's change that to ALL to decode all kinds of 1D barcodes as well, for example the ISBN barcode on a book:
setpar symbol ALL
which should simply return
OK
We can verify that the change took place in three ways:
help
again and check the symbol
parameter as it is listed there. At the bottom of the description of the parameter, note: Exported By: DemoQRcode:qrcode value=[ALL]The value shown is the one we selected. This extra information about the parameter's value is only shown when the currently selected value differs from the default value.
getpar symbolwhich should return
engine:DemoQRcode:qrcode:symbol ALL OKThe reason why the returned parameter name is longer in the reply is because JeVois supports complex machine vision modules which may include several instances of a same component algorithm. In such case, the longer name allows unambiguous access to each parameter instance. For example, a new module might include two instances of the QRcode algorithm component, one set for 2D QR codes and another trying, in parallel, to find 1D ISBN10 barcodes. For more information about parameter names and descriptors, see the programmer documentation for Model components, parameters, manager, and associated classes.
Once you have played with parameters interactively, you may want to set some default values each time a given module is loaded. This is possible in JeVois through two configuration files, which are located in the directory of the module of interest (if the files are absent, then no action is taken by the module):
For example, the default params.cfg for the DemoQRcode module is located in JEVOIS:/modules/JeVois/DemoQRcode/params.cfg on the MicroSD card and contains:
# Default parameters that are set upon loading the module # Only look for QR codes by default, faster than looking for any kind of barcode and qr-code: qrcode:symbol = QRCODE
The effect is that, by default, we only scan for 2D QR-codes.
The equivalent script.cfg would be in JEVOIS:/modules/JeVois/DemoQRcode/script.cfg and would contain:
setpar qrcode:symbol QRCODE
For more information about params.cfg and script.cfg, see Programmer SDK and writing new modules.