Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build file update #33

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Build file update #33

wants to merge 4 commits into from

Conversation

watbulb
Copy link
Collaborator

@watbulb watbulb commented Aug 23, 2016

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 called tbbvars.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 it source /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 and libjpeg-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.

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 🐯

Added new dependencies in package()
More dependency checking
Made status's more appealing and informative
Reintroduced "-c make"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants