"HoG Object Detection"

Published on: Oct 15, 2024

HOG detector in C++

Histogram of Oriented Gradients (HOG) is a computer vision and image processing technique used for object detection. It is based on the idea that the local appearance and shape of an object can be described by the distribution of intensity gradients or edge directions in an image. In the HOG descriptor, an image is divided into small cells and for each cell, the gradient orientations are calculated and grouped into a histogram. These histograms form a feature vector for each cell and for the whole image, which can be used as input to a classifier for object detection. The HOG detector has been widely used in various applications such as pedestrian detection, face detection, and others due to its robustness and efficiency in detecting objects with arbitrary shapes.

Getting the program

Download the pretrained cascade detector for opencv git repo. The opencv repo has many pretrained haar detector and I am using one of those in the example below.

Compiling HOG C++ program

Go into the hog folder and type:

1mkdir build && cd build
2conan install ..
3cmake ..
4cmake --build .
5

Runing the program

That will build hog and you can run from build folder it using

1bin\hog
2