## Building WiSAR C++ Project

#### Qt SDK

• We recommend using Qt Creator. Though you can compile Qt projects in Visual Studio, instructions on Qt's site.
• We've been using version 4.8, you're welcome to try with newer versions.

#### CUDA

• http://developer.nvidia.com/cuda/cuda-downloads (get both SDK and Toolkit 64-bit, we've been using 4.2)
• Make sure that you get a version of CUDA supported by the OpenCV version you plan on using
• This must be installed BEFORE OpenCV so that CUDA support is compiled into the OpenCV libraries when you build them

#### OpenCV

• http://opencv.willowgarage.com/wiki/ (we've been using 2.3.2-ish)
• Use CMAKE to generate project files for appropriate build platform (i.e. Visual Studio 10, MinGW)
• Be sure to build the 64 bit version – in Visual Studio you have to change the target build configuration to be x64, in Linux specify the appropriate 64-bit architecture when you configure (there may even be a spot to do this in CMAKE additionally)
• Point CUDA variables (in CMAKE) to installed CUDA libraries if not automatically done by CMAKE
• Build libs and/or dlls (in Linux, run make, then make install in build folder you specified to CMAKE. in Windows, open project files in Visual Studio 10 and compile them).

### Setup environment variables

 PATH        -- in Windows, add all folders that contain ".dll" files for OpenCV and ProtoBuf (usually found in a "bin" folder for each library).
OPENCVDIR   -- should point to a folder that contains an "include" folder with the OpenCV header files and a "lib" folder with all of the built lib files
PROTOBUFDIR -- same as OPENCVDIR only for Google Protobuf (points to root folder that contains lib and include folders).   

### Checkout WiSAR Project from SVN Repo


repo:        svn://wisar.cs.byu.edu/wisar/trunk
credentials: (see Dr. Morse)

### Build the Project

• Within the Qt file “WisarCommon.pri”, make sure that the OpenCV version (variable STUPID_CV_VERSION) matches what you have installed
• If you run into issues building, some common problems include:
• Cannot find appropriate libs or DLLs — Check that your environment variables are named correctly and are pointing to the correct library files
• Sub-projects may be built out of order despite having specified the dependency chain. Worse case you can manually build sub-projects (just build lower-level looking stuff first).
• It is not uncommon for newer versions of libraries to not be backwards compatible (Qt and OpenCV have this problem on occasion from what we've experienced). So check the feature-list for the version you are using for major modifications. If there are any, try using an older build of the library in question.
• If you are using QtCreator, make sure that you have the appropriate tool chain selected under the projects tab (sometimes, by default in Windows, QtCreator likes to choose the “Microsoft Windows SDK for Windows 7” tool chain. This has always given me issues, so choose “Microsoft Visual C++ Compiler 10.0 (x64)”. Granted, this is dependent on how you built everything else. Just make sure you are consistent)

## To Do

### GeoReference Library

This is mostly finished, just need to convert planar coordinates (lat / long) so they are in the same units as altitude (from degrees to meters) during projection. After projection, the coordinates will need to be converted back to degrees (for GPS coordinates).

## Bugs

• Occasional crashes when opening and closing video streams

## Misc

### Mingw and OpenMP

To get OpenMP to work on Windows with Mingw follow the instructions here