VXL

De Pontão Nós Digitais
Ir para navegaçãoIr para pesquisar

VXL is a collection of C++ computer vision libraries (and python bindings) with contributions from Kitware, GE, Brown University, and others. This wiki page contains unofficial notes from some developers.

Git Repo

Folow the instructions at https://sourceforge.net/p/vxl/wiki/Git/ But bear in mind the current repository has been moved to Github: http://github.com/vxl

Hacking

General Tips

  • Look into .travis.yml, specially before_script: and script: sections for the build commands that are actually working. Look into the packages: sections for packages that might have to be installed in your system.


GNU/Linux

vgui:

  • GTK2 (nice feature: detachable menus)
  sudo apt-get install gtk2.0 libgtk2.0-dev libgtkglext1-dev
  • QT
  sudo apt-get install qt-sdk

For newer versions of ubuntu, do:

 sudo apt-get install qtcreator qtbase5-dev qt5-qmake libxmu-dev libxi-dev

An easier way is just to install everything listed in: Ubuntu - Configuring For Programming

If you are in a remote cluster and cannot install these dependencies

Coin3D:

 git clone git://git.code.sf.net/p/coin3d/code coin3d-code

Build Coin3D following https://sourceforge.net/p/coin3d/wiki/Coin3D_Build_Instructions_For_Linux and setting a local install folder. Then set the Coin3D variables in VXL cmake.

An alternative procedure can be found in github Coin3D repository https://github.com/coin3d/coin/tree/master by reading th INSTALL file. NOTE: before make step, do ccmake ../coin3D and enable CPack

Apple OSX

There are a few bugs affecting compilation, see [1]

You might want to install these libs from macpoorts:

 sudo port install tiff xorg-libsm xorg-libx11 xorg-libXext 

Something I like to do to make sure I have many of the xorg libs is simply:

 sudo port install xfig

vgui:

QT:

  • I used qt4 from macports:
 port install qt4-mac    
 # also put /opt/local/libexec/qt4/bin in your PATH, eg in ~/.bash_profile
  • I also had to symlink some libs as the config seems buggy (Nov'15)
 sudo ln -s /opt/local/libexec/qt4/Library/Frameworks/Qt* /opt/local/Library/Frameworks/

gtk2:

  • Homebrew:
 brew install gtk+ gtkglext
  • gtk3 won't work. Do not confuse this version with gtk2 v3 which is different.
  • You can also try macports:
 port install gtk2
  • The most important thing is that VGUI should never be linked to gtk*-x11*dylib files.

Make sure you use a recent CMake, and that you disable X and all other toolkits in case you are having problems, like the GUI is crashing.

Other issues:

  • For compiling LEMSVXL, you may need this for 3D GUI / visualizers, use:
 sudo port install Coin

then reconfigure VXL then LEMSVXL

  • make -j9 is having a non-deterministic behavior - try running it a few times, but make -j5 sometimes works better as far as errors go. A plain make is always safer.
  • If you find an error related to ffmpeg, then I just left all FFMPEG-related entries in CMAKE blank. That removes support for video loading but thats about it.
  • A compilation error related to X11 means the headers from the wrong place are being used. I had to modify the cmake flag for x11 includes to point to /opt/local/include
  • My current CMake settings to compile in OSX are available on-line [2]

Patches to compile VXL in OSX

In addition to the above measures, a number of source code changes had to be implemented to get VXL to compile.

  • All the source code changes I had to do in order to get VXL to compile are available in my Github copy of vxl, branch osx-compile-fixes [3]
  • A link time error related to OpenGL acceleration in vgui/tests means this test is outdated and should be ignored. Comment out that file or the offending lines. Alternatively, you could point the OpenGL CMake variables to /opt/... since those opengl libs contain the desired symbols, but they're older.
  • The above link mentions a OPENJPEG2 work around
  • See also: General OSX-related development instructions

Writing a program that uses VXL

A simple example using CMake is hello-vxl:

git clone ssh://SOURCEFORGE_LOGIN@labmacambira.git.sourceforge.net/gitroot/labmacambira/hello-vxl

Read the README.

Setting up VxL Programming environment at IPRJ

This is Ricardo Fabbri's recommended workflow for working with the official VXL plus an internal repo (here named LEMSVXL)

  • download vxl git
    • place it into folder vxlprg/vxl
  • we use LEMSVXL - an internal (closed) repo of vxl-based libs from Brown
    • download lemsvxl git
    • place it into folder vxlprg/lemsvxl
  • create build directories lemsvxl-bin and vxl-bin inside vxlprg
mkdir lemsvxl-bin vxlprg-bin

Compiling

  • on the commandline, enter vxl-bin
  • type
ccmake ../vxl
  • type 'c' for "configure"
BUILD_SHARED_LIBS = ON (faster link time)
BUILD_UNMAINTAINED_LIBRARIES = ON    # newer vxl: BUILD_NONDEPRECATED_ONLY = OFF
at first BUILD_VGUI = OFF
CMAKE_BUILD_TYPE = Debug (for now)
VNL_CONFIG_LEGACY_METHODS = on (needed for lemsvxl)
  • for OSX with the Clang compiler, I recommend using libstdc++ and other flags to aid using GNU extensions in my projects (the programming platform of reference is always GNU/LINUX for me)
ccmake -DCMAKE_CXX_FLAGS:STRING="-Wno-gnu-static-float-init -stdlib=libstdc++" ../vxl 
  • type 'c' once more
  • inspect any CMAKE variables that might have changed (they have a star * attached to them)
  • type 'c' again until no new variables show up and config is right
  • once 'g' appears, press 'g' (generate)
  • press 'q'
  • type 'make -j9'
  • if there is any error:
    • retry with simply 'make'
    • test your build
      • go inside 'core' and type 'make'. See if there are any errors. If not, good.
      • go inside contrib/brl and type 'make'. See if there are any errors. If so, you might not be able to build what you want from the internal lemsvxl repo. But keep going, at least core builds.
      • optionally if there are still errors just do 'make -j9 --keep-going' to

build as much as possible before moving on to your private lemsvxl repo

Compiling lemsvxl

  • enter lemsvxl-bin
  • ccmake ../lemsvxl
  • Fill in where your vxl-bin folder is as the VXL path, then press 'c', then
BUILD_SHARED_LIBS = ON (faster link time)
BUILD_UNMAINTAINED_LIBRARIES = ON   # newer vxl: BUILD_NONDEPRECATED_ONLY = OFF
CMAKE_BUILD_TYPE = Debug (for now)
BUILD_CONTRIB = on (for now)
BUILD_ALGO = off
can be useful to set USE_BOOST 
  • for OSX with the Clang compiler, I recommend using libstdc++ and other flags to aid using GNU extensions in my projects (the programming platform of reference is always GNU/LINUX for me)
ccmake -DCMAKE_CXX_FLAGS:STRING="-Wno-gnu-static-float-init -stdlib=libstdc++" ../lemsvxl
  • press 'c' and fill out info until you get a 'g'
  • try out a first make -j9 - it will likely have errors
  • if it does have errors, just make in your desired path:
    • For the symbolic edge linker, for instance, you just need to get 'brcv/seg/dbdet' to compile. All dependencies will be compiled.
      • cd brcv/seg/dbdet/tests
      • make
      • cd brcv/seg/dbdet/algo/tests
      • make
      • cd brcv/seg/dbdet
      • make
    • Once you compiled the key basic libs for your application, now move on to compile the GUI parts
    • In the case of edge detection:
      • cd contrib/edge_det/gui
      • make
      • backtrack and compile each lib separately to solve problems.
  • April 4 2014: I had to comment out anything related to bvis1_gl_codec, and vidl1, with no apparent harm to my research code
  • My current CMake settings to compile LEMSVxL in OSX are available on-line [4]
  • March 30 2015 hacking journal
    • lemsvxl has a Cmake config error: set no NOTFOUND ... MPEG2_vo_LIBRARY ... linked by target "vidl1"
    • tried port install libmpeg2, but newer libmpeg2 dont ship libvo.so
    • I then just entered a literal space ' ' blank into MPEG2_vo_LIBRARY and it rebuilds
    • I turned off BUILD_ALGO for now

Solutions to Known Errors

  • Error `usr/include/sys/resource.h:443:34: error: expected initializer before '__OSX_AVAILABLE_STARTING`
    • This is due to mixing up compilers or due to using GCC on apple computers. You can try forcing your compiler in the cmake step:
   CC=/usr/bin/cc CXX=/usr/bin/c++ PATH=/usr/bin:$PATH ccmake .


Links