How to run fastHOG on Windows? Follow these steps.
Working with fastHOG on Windows
The fastHOG library has a parallel implementation of the Histogram of Oriented Gradients(HOG) algorithm for object detection. It is published in the paper fastHOG-a realtime GPUimplementation of HOG in 2012. The implementation is based on NVIDIA CUDA framework and the library is open-source. However, what is difficult is that there is little documentation for the code and we do not know how to use it. Fortunately, some people have compiled the library on Ubuntu and publish their detailed steps. See this link. As a windows user, I decide to run it on windows and I found it not difficult.
Environment preparation
My operating system is Windows 7 64 bit. I have installed visual studio 2010. My Graphic card is NVIDIA Geforce GTX 650 and I have updated its driver to newest version.
Library dependency
Resolving library dependency is always a trouble thing both on Linux and Windows. This program depends on four libraries: CUDA, fltk, FreeImage and boost. Let us solve them one by one.
CUDA
First download CUDA install package from NVIDIA website . After selecting Operating System, Architecture, Version and Installer Type, the download link appears below. So download and install it. It is easy.
FreeImage
FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications. It can be downloaded from here . There are 3 files in the zip file: FreeImage.dll, FreeImage.h, FreeImage.lib.
FLTK
The most tough thing is fltk library. Its official website is here. But I don't know why the author used fltk2 in the program. I can't find fltk2 even on its official website. Then, I googled several times and finally found the SVN address in this blog. "FLTK 2.0 is an experimental new version of the library that was later abandoned." All right... But we have to go on.
Check out the codes using tortoiseSVN. We need to compile the library ourselves. So open the fltk_static.sln in the ide/vcnet folder, it will upgrade to Visual Studio 2010 solution. Build the solution under Debug and Release then we will got static libraried in the lib folder. We will use it later.
boost
Boost C++ libraries are famous and widely used. The built binaries can be downloaded from its website. The newest version 1.60.0 works well in this program.
Build fastHOG
The original source code of fastHOG was developed using CUDA 4.5 or 5.0 maybe. So a few changes have to be made if we use CUDA 7.5. I follewed this blog to make it compatible with CUDA 7.5. Replace the header files and replace all cutilSafeCall() with checkCudaErrors().
Open the "Build Customization" option in the project context menu and check "CUDA 7.5(.targets, .props)". This will tell the compiler how to deal with .cu files. Add your CUDA include path and samples include path into "VC++ Directories/Include Directories", also add your CUDA library path to "VC++ Directories/Library Directories". For example, my include directories are:
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v7.5\common\inc;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include;$(IncludePath)
and library directories:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\lib\Win32;$(LibraryPath)
Then add the header file folder and library folder to "Additional Include Directories" and "Additional Library Directories" as we usually do in C++ development. Do not forget to add the compiled lib files to "Additional Dependencies", especially, cuda.lib and cudart.lib.
For now, we have finished the procedures of configuration the fastHOG project. Then we could build, run, substitute with our own test images and do whatever your want to do.
At last, there are some images of run effect: