JeVois Tutorials  1.22
JeVois Smart Embedded Machine Vision Tutorials
 
Share this page:
Loading...
Searching...
No Matches
Changing machine vision parameters

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.

Note
Note that since June 2018 it may be easier to use JeVois-A33: JeVois Inventor graphical user interface. The instructions below do not require JeVois Inventor are are provided in case you do not want to use the Inventor.

Pre-requisites

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.

Getting started

  • Connect JeVois to a host computer.
  • Start video capture software and select YUYV 320x286 @ 30.0 fps which should launch the DemoQRcode module.
  • Start a serial terminal and connect to the serial-over-USB port of JeVois.

Listing the available parameters

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]

Changing a parameter

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:

  • type 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.
  • Get the current value of the parameter, by typing:
      getpar symbol
    which should return
      engine:DemoQRcode:qrcode:symbol ALL
      OK
    The 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.
  • Check in the video feed that the algorithm is now indeed detecting 1D barcodes as well: show it the barcode of a book you have (or just search the web for 'ISBN barcode' and display some pictures of barcodes on your screen, then point JEVOIS to them; make sure they are large enough), JeVois should now detect and report those.

Setting default parameters

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):

  • params.cfg - list of parameters settings that should be applied each time a module is loaded. Only parameters of the module or its component algorithms can be set here. The parameters are set each time the module is loaded (e.g., the corresponding video resolution is selected by video capture software on the host computer).
  • script.cfg - this is a more general script that is run after the module is loaded and initialized. The script is in the same form as you would type commands interactively in the command-line interface.

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.