Direct Graphical Models  v.1.6.0

DGM is a cross-platform C++ library. The description here was tested on Windows 10 / Visual Studio 2017 and MacOS High Sierra 10.13.6 / Xcode 9.4.1. If you encounter errors after following the steps described below, feel free to contact us via our User Q&A forum. We'll do our best to help you out.

DGM has only one dependency: it is based on OpenCV library. In order to use the DGM library, the OpenCV library should be also installed.

Installing OpenCV

Installing DGM

  • Download either the latest stable DGM version from Project X Research or fork the latest snapshot from our GitHub repository
  • Unpack it to your local folder (for example to disk C:\ for Windows or to /Users/username/ for MacOS, so the library path will be C:\DGM\ or /Users/username/DGM/)

Building DGM from Source Using CMake

In case you want to build the library (recommended), follow these instructions, otherwise - skip this step and proceed to Using the Pre-built Libraries. This step also assumes that you have downloaded the sources of the DGM library.

  • Download and install CMake for your operating system
  • Run cmake-gui.exe in Windows or in MacOS
  • In the “Where is the source code” field choose the DGM source directory: DGM
    In the “Where to build the binaries” field choose directory where Visual Studio or Xcode project files will be generated: e.g. DGM/build
  • Press Configure button and choose Visual Studio for using 32-bit compiler, Visual Studio Win64 for using 64-bit compiler or Xcode as building environment
  • Be sure that the OpenCV_DIR is pointing to the OpenCV installation directory (e.g. OpenCV/build/install or /usr/local/share/OpenCV), where OpenCVConfig.cmake file is located
  • (Optioanlly) you can change CMAKE_INSTALL_PREFIX to the directory where the DGM binaries will be installed (e.g. to DGM/build/install)
  • Press one more time Configure and then Generate, so the IDE project files will be generated in the DGM/build
  • Open the generated projectd by pressing the Open Project button or directly by opening file DGM/build/DGM.sln or DGM/build/DGM.xcodeproj
  • Build ALL_BUILD and INSTALL projects first for Debug and then for Release configuration. That will copy DGM headers, binaries and demonstration applications to the install folder DGM/build/install
  • Windows users may copy the OpenCV binaries into the install folder by executing script /DGM/build/install/bin/copyOpenCVDLL.bat
  • (Optionally) you can copy the install folder with the ready-to-use DGM library (e.g. DGM/build/install) to any other folder

Using the Pre-built Libraries

This step assumes that you have downloaded DGM-package with the pre-build binaries. In such case the type and version of the downloaded binaries should correspond to your C++ compiler. If it is not, please return to the Building DGM from Source Using CMake section and generate the binaries with your compiler. The content of the install folder (e.g. DGM/build/install) will correspond to the downloaded pre-build DGM package.

After Installation

As soosn as the DGM library is installed, you can launch the demo applications from the /bin folder. If you have built the binaries from the sources, you can also start the demo projects directly from your IDE. The corresponding description may be found in Tutorials. Do not hesitate to modify these demo projects for your needs or start your own project based on our demo code.

If you wish to generate a new projects, which will use DGM, or add DGM to an existing project we highly recomend you to use CMake and follow the Using DGM library with CMake guidances, where template CMakeLists.txt file is provided.
Alternatively, you can specify the following paths and library in your IDE manually:

  • Add to Configuration Properties -> C/C++ -> General -> Additional Include Directories the path install_folder/include
  • Add to Configuration Properties -> Linker -> General -> Additional Library Directories the path install_folder/lib for both Release and Debug configurations
  • Add to Configuration Properties -> Linker -> Input -> Additional Dependencies the libraries dgm160.lib, fex160.lib, vis160.lib and dgm160d.lib, fex160d.lib, vis160d.lib for Release and Debug configurations accordingly