Executing custom opencv c++ code

  • Hello,

    I would like to write my custom opencv c++ code and deploy in voxl but not sure how to go about doing it, such as how/where to change the code, and how to compile, and deploy?
    Possible to guide me or direct me to any reference materials to follow along?

    Thanks in advance.

  • Hi,

    You'll want to make your own project that builds a package that can be deployed to a voxl. Our projects generally follow a four-script system.

    1. install_build_deps.sh The script that install the build dependencies of a project. If you're writing an opencv process for voxl you'll probably need voxl-opencv and libmodal-pipe at the very least to get your code to work. (If you haven't already, check out our docs on our pipe architecture to see how to grab camera frames in userspace).

    2. build.sh The script that actually builds the codebase that you're using, will set up a cmake toolchain to make sure that you're building with the right architecture/gcc version and put all of the build files in a build directory for packaging.

    3. make_package.sh The script that bundles all of the built files, as well as any config/other files that your project will use into a standard debian or opkg package (opkg for voxl1 or debian for voxl2/rb5)

    All three of those scripts should be run inside of the voxl-cross docker image that we've built as our primary build environment; it has all of the toolchains that you may need baked in, as well as the correct gcc versions for our different platforms.

    1. deploy.sh This script deploys the package that you've built to voxl and installs it, oputting any binaries that you've generated in the correct location where you can run them from the command line. This script is usually run outside of the docker image since the image does not have adb installed by default, but can be run inside of the image if you're deploying over ssh instead of adb.

    Finally, Since you're building an opencv project, I'd strongly recommend that you look at our voxl-camera-calibration package. This is a very good example of how to use libmodal-pipe to get camera images, and then pass them off to opencv (in this case the calibration routines) for processing. The project also have fully flushed out versions of all of the aforementioned scripts that you can copy into your project as a good starting point.

Log in to reply