An efficient implementation of HoG feature extractor in CUDA
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


An effieient implementation of Dalal & Triggs Histogram of Oriented Gradients [1] feature extractor in CUDA. The library is extensible, uses CImg and is written in C++11. This library also provides MATLAB bindings via MEX functions (Linux version only).


Clone the git repository on your local machine using

git clone -b master

This will create the CudaHoG directory on your machine. Follow the instructions below to compile the library depending on your machine. (Note that only 64-bin machines are supported).


This project uses CImg for handling image I/O. CImg does not internally support reading *.png and *.jpg files. Therefore, if you are planning to use the image I/O capabilities of this library, you need to install ImageMagick. Be sure to install the 64-bit Q8 version of the library (Q16 will produece garbage images with the current version of CudaHoG). Installation on Windows is straightforward due to the availability of installers. On Debian (eg. Ubuntu, Linux Mint), only the Q16 version is available through major software repositories. Follow the guide here to obtain and install the Q8 version.


After cloning the repository, import the CudaHoG folder it as a project in Eclipse (or Nsight Eclipse Edition) using (File -> Import -> Existing Project into Workspace). The makefiles will be automatically generated by Eclipse.

Four configurations are provided inside the Eclipse project file:

  • Debug: Executable binary file with debugging information
  • Release: Executable and optimized binary file without debugging information
  • Mex: Required library (*.so) file with debugging information. The generated file is automatically copied under matlab subfolder.
  • Mex (Release): Required library (*.so) file with optimizations and without the debugging information. The generated file is automatically copied under matlab subfolder.

** NOTE: The include paths of the library headers for ImageMagick must be set manually in "Build Settings" under "Project Properties" in Eclipse! **


The Visual Studio 2013 project files are located under the prj-vstudio directory. Simply open the project file, select the desired build configuration and hit F6 to build (parallel compilations are enabled by default). Note that at this point, the Mex interface does not support Windows.

** NOTE: The environment variable "MAGICK_HOME" for ImageMagick must be set after installation! Follow the instructions here to set the variables. **

##Usage The executable usage is straightforward (example provided in the Main function).

Mex interfaces can be created by first building with "Mex" or Mex (Release)" configuration. Then simply start MATLAB in the matlab directory, run compile.m to create the mex files. Two examples are provided: testHOG.m and testBoxFilter.m.


This library uses CImg for handling image I/O.


[1] Dalal, Navneet, and Bill Triggs. "Histograms of oriented gradients for human detection." Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on. Vol. 1. IEEE, 2005.