FireSight
FireSight copied to clipboard
Build file update
The following changes are part of this file:
OpenCV
- Reintroduced ability to build bleeding edge OpenCV 2.4.13 via
./build -c make
. OpenCV 2.4 is in LTS and only being maintained instead of active development, so this should be safe.- Nearly any *nix based system can now build OpenCV and FireSight, as well as retained support for Solaris. The build script now only checks for the availability of either apt-get or pkgin (Solaris), so any system with these package managers should be able to build OpeCV and FireSight without any issues. In the case of a system having a unknown package manager a dialog will come up notifying the user of packages they need to install manually or using their package manager in order to complete the build. Once these packages have been installed the build can continue. The dialog can be accessed by appending
-p
to./build
. This has been tested on vanilla Arch Linux and Ubuntu. - Removed non-required packages such as libav and others, since we are not encoding or decoding video streams. Required packages:
- GCC
- G++ (some systems package this seperately)
- git
- cmake
- zlib
- autotools
- pkg-config
- When building bleeding edge OpenCV 2.4, depending on the platform there are new heavy optimizations. For all Raspberry Pi's, NEON SIMD optimization has been enabled. This allows special registers to handle complex math functions that are used by OpenCV. For undefined systems we tell OpenCV to compile it with the highest GCC optimizations. To put NEON optimizations in perspective, on a Pi2 I've obtained a increase of 32x in video compression and decompression with custom compiled video codecs enabled with NEON support.
- Another optimization facility that has been added is the choice for compiling OpenCV with Intel TBB support on the Raspberry Pi 2 and 3 by appending
WITH_TBB=ON
to./build -c make
. What this does in OpenCV is allows common functions to be compiled with full parallelization support against TBB, so instead of running a OpenCV function on one single core as we were doing before, we can run it on all available cores paired with our NEON optimizations! This has netted a average of 30% decrease in execution time versus the previous non optimized OpenCV 2.4.8. Intel TBB requires a file calledtbbvars.sh
to be sourced before it can be used with OpenCV. A new file in the users home directory called.firesight
will be created and within itsource /opt/intel/tbb/build/tbb_release/tbbvars.sh
is added. Sourcing the file before the use of FireSight and OpenCV is mandatory, and support will be needed in firenodejs build to source this file before it's vision processing is initialized. Intel TBB is fully open source under GPL. - On the Raspberry Pi 2 and 3, libjpeg-turbo will be used as the default libjpeg library. Two files have been added to the root of the repository,
libjpeg-turbo_1.5.0_armhf-pi2.deb
andlibjpeg-turbo_1.5.0_armhf-pi3.deb
. Each have been compiled to the highest performance compilation settings available and also use NEON SIMD support. If dpkg is available on the host OS of the Raspberry Pi 2 or 3 then it will be automatically installed into/opt/libjpeg-turbo
- Overall, with full optimizations ( NEON + TBB + libjpeg-turbo ) on a Pi 2, a decrease in execution time by 50% was observed versus previous non-optimized OpenCV 2.4.8.
-
firesight -p json/pipeline0.json -i img/cam.jpg
netted a average execution time of 0.33 seconds with OpenCV 2.4.8, and 0.18 seconds with full optimizations on 2.4.13.
-
- Removed a number of non required OpenCV compilation options bringing us down to the bare essentials needed on a given system. This decreases build time on a stock clock Pi 2 by over 30 minutes and most likely a large amount on undefined systems.
- I have most likely missed a thing or two, so it is recommended you read through the new build file for yourself.
- Nearly any *nix based system can now build OpenCV and FireSight, as well as retained support for Solaris. The build script now only checks for the availability of either apt-get or pkgin (Solaris), so any system with these package managers should be able to build OpeCV and FireSight without any issues. In the case of a system having a unknown package manager a dialog will come up notifying the user of packages they need to install manually or using their package manager in order to complete the build. Once these packages have been installed the build can continue. The dialog can be accessed by appending
General
- Added a number of color coresponding status, error mitigation, variable checking, warning messages and ways you can solve them if they cannot be solved conventionally. Nearly every possible error scenario has a defined message, if not defined the process in error usually will throw it's warnings for you.
- libzbar no longer needs to install 50+ dependencies for one single library (ridiculous, I know) instead it downloads the package separately and forcefully installs it with
dpkg
- Jansson no longer builds with docs which was mostly useless
-D WITH_BUILD_DOCS=OFF
- If
apt-get
is available update package lists - A lot of refactoring. Sorry Karl, I know you spent some time on this build script. 😿
Todo
- Add precompiled OpenCV 2.4.13 packages for Raspberry Pi 2 and 3
- Advanced system detection parameters
- Need testers with Pi 3, @firepick1
Pull request requires discussion of sourcing tbbvars.sh
and acceptance response from: @firepick1
Cheers,
-Dayton 🐯