Direct Graphical Models  v.1.7.0

DGM is a cross-platform C++ library. The description here was tested on Windows 10 / Visual Studio 2017, macOS Mojave 10.14.3 / Xcode 10.1 and Ubuntu 18.04 / gcc 7.3.0. 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/)

Installation in Windows and macOS

Building DGM from Source Using CMake GUI

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
  • (Optionally) 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 project 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 GUI 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.

Installation in Linux

Building DGM from Source Using Terminal

For installing the DGM library for Ubuntu we assume that the OpenCV library was already installed (Installing OpenCV), thus GCC, CMake and Git are also installed. In order to download and install the latest version from master input the following commands in terminal:

cd ~/<my_working_directory>
git clone
cd DGM
mkdir build
cd build
make install
make clean

After Installation

As soon 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 project, which will use DGM, or add DGM to an existing project we highly recommend you to use CMake and follow the Using DGM library with CMake guidance, 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 dgm170.lib, fex170.lib, vis170.lib and dgm170d.lib, fex170d.lib, vis170d.lib for Release and Debug configurations accordingly.