JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
|
|
The JeVois programmer software development kit (SDK) allows you to create your own machine vision modules for JeVois. The SDK is a complex beast as it not only comprises the JeVois core software, but also a custom Linux kernel for your JeVois camera, and the full Linux operating system and set of utilities that run inside the JeVois camera.
To get started with the programmer SDK, either install a pre-compiled deb package for it, or build it from source, as detailed in JeVois Ubuntu packages and source code repositories
A script jevois-create-module
has been created in /usr/bin (source in ~/jevois/scripts/) to automate the process of creating a new module. It basically clones https://github.com/jevois/samplemodule and changes some names in there to new names you provide:
# USAGE: jevois-create-module <VendorName> <ModuleName> # Creates a project directory with name tolower(ModuleName) and populates it: jevois-create-module MyVendor MyAlgo # Module is setup in myalgo/
Now edit your module to actually do something interesting, and update all the custom doxygen tags in the inline doc of the module, such as @videomapping, and so on (see below for more info on custom doxygen tags).
Also check out icon.png and other files in the directory where the source code is, and update them as appropriate.
You can then compile using
./rebuild-host.sh ./rebuild-platform.sh ./rebuild-pro-host.sh ./rebuild-pro-platform-pdeb.sh
as you did with jevois and jevoisbase.
rebuild-platform.sh
in your jevois repository. See Compiling JeVois core software from sourceAfter running ./rebuild-pro-platform-pdeb.sh
a .deb file is created in ppdbuild/
shell dpkg -i /path/to/your-module-package.deb
. If you already had a previous version installed, run shell dpkg -r your-module-package
first to remove it.Insert a properly installed JeVois MicroSD (follow the steps at JeVois Start to make one from a disk image) into your computer, either physically inserted into your host computer using a microSD-to-USB adapter, or exported live by JeVois using the usbsd
command in the JeVois command-line interface). The microSD card must be be available under /media/username/JEVOIS/ where username is your Linux user name.
Run:
./rebuild-platform.sh --microsd
Modules, config files, etc will be installed to the live microSD card at /media/username/JEVOIS/ where username is your Linux user name.
rebuild-platform.sh
(none, staging, or microsd), that will remain for subsequent make install
commands, until you change it by re-running rebuild-platform.sh
with another destination.Here is a simple command to export the microSD of a live JeVois camera without having to start a terminal program, etc (make sure JeVois is not streaming video):
sudo sh -c 'echo usbsd > /dev/ttyACM0'
With JeVois v1.2 and later, you can just instead type jevois-usbsd start
to start exporting the microSD, and jevois-usbsd stop
to eject it and restart JeVois.
With JeVois v1.3 and later, you do not need to manually take out or even manually export the microSD inside JeVois anymore. A new build option --live
can do it automatically. Just connect JeVois and allow it to start, then type:
./rebuild-platform.sh --live
which will:
jevois-usbsd start
to instruct JeVois to export its microSD as a virtual flash drivejevois-usbsd stop
to eject the virtual flash drive and restart JeVois.This approach is useful if you also want to share your module with friends. You can just send them your jvpkg file.
Once you have all the compiled and auxiliary files (icon.png, etc) in myalgo/jvpkg, you are ready to pack it:
cd pbuild make jvpkg
This creates a file
myalgo/MyVendor_MyAlgo.jvpkg
Insert a properly installed JeVois MicroSD (follow the steps at JeVois Start to make one from a disk image) into your computer, and copy the .jvpkg file into the JEVOIS:/packages/ directory of your microSD.
Your smart camera will unpack, configure, and delete the .jvpkg file next time it starts up.
Make sure you allow enough time for it to do that work. It may take several minutes (depending on your module's file size, microSD card speed, etc).
Remember to also edit config/videomappings.cfg in the JEVOIS partition of your microSD to add a new mapping that will use your module.
For more information:
/usr/bin/jevois-jvpkg
(source in ~/jevois/scripts/jevois-jvpkg)
, which is invoked by make jvpkg
/usr/bin/jevois.sh
(source ~/jevois/bin/jevois.sh
) running on the platform when it boots up.A really nasty perl script, /usr/bin/jevois-modinfo
(source in ~/jevois/scripts/jevois-modinfo
), will parse your module to generate a single-page documentation for it. This script is a mess and its operation is quite brittle. It is invoked automatically when you compile your module (see rules in ~/jevois/CMakeModules/JeVois.cmake).
The script creates modinfo.html (and modinfo.yaml, currently not used) by parsing your modules and other files in its directory.
Special doxygen tags in your module's doc will be parsed, here are some examples:
Specially named files will also be used if present:
ls
lists them.ls
lists them.jevois-add-videomapping
(installed in /usr/bin/, source in ~/jevois/src/Apps/) in this script to add to the videomappings.cfg file any videomappings that should be installed when your module is installed. This usually is a subset of all the mappings listed in the doc using the doxygen tags.tar --exclude-from
The scripts rebuild-host.sh
and rebuild-platform.sh
clear and recompile everything.
You should run them at least once.
Then, if you are just changing a few files, you can only recompile what is needed, as follows:
cd hbuild make -j sudo make install
cd pbuild make -j make install make jvpkg
cd phbuild make -j sudo make install make doc # optional; if desired
cd ppdbuild make -j sudo make install sudo cpack # will re-generate the deb package into ppdbuild/
In this more complex scenario, you wish to create a collection of modules, and some component algorithms will be shared by several modules.
The preferred approach is then to write the shared algorithms as jevois Component objects, and to compile them all into a shared library (.so). Each module that uses some of the components will then automatically trigger the loading of the shared library. This is the approach taken in jevoisbase
For guidance on this, inspect the CMakeLists.txt in jevoisbase.
Note how several CMake macros have been defined to assist you; those are in jevois/CMakeModules/JeVois.cmake
In jevoisbase, we compile everything that is under src/Components into libjevoisbase.so
Then, we compile each module under src/Modules into one .so file each, which is marked as depending upon libjevoisbase.so
To create your own, roughly the first 50 lines of the jevoisbase CMakeLists.txt should be preserved and modified for your project. The rest of the jevoisbase CMakeLists.txt is basically to add required dependencies, such as on the ZBar library, the OpenCV library, etc and those will vary with your specific project.
Make sure you keep the call to jevois_project_finalize()
at the end of your CMakeLists.txt file.