This device is not compatible.


Pedestrian Detection Using Histograms of Oriented Gradients (HOG)

Learn how to implement a machine learning pedestrian detection for video analysis. Pedestrian detection is fundamental in any intelligent video surveillance system because it's the foundation for more advanced semantic analysis of video streams.

Pedestrian Detection Using Histograms of Oriented Gradients (HOG)

You will learn to:

Plot graphs using Python

Extract and process frames from a video using OpenCV

Understand the HOG pedestrian detector

Identify which frames have pedestrians using matplotlib


Data Visualization

Data Manipulation

Machine Learning Fundamentals


Basic understanding of Python

Basic understanding of image manipulation

Basic understanding of data visualization




Project Description

Pedestrian detection is one of the most fundamental aspects of computer vision.

To understand how a Histogram of Oriented Gradients (HOG) works, we must first know what a gradient and a histogram are.

The gradient measures how rapidly and in which direction the level varies in a black and white image. The grayscale level is similar to height in a black and white image. A substantial gradient from white to black perpendicular to a picture edge (a black to white transition) results from a strong gradient perpendicular to the edge.

For each pixel, the system computes a gradient, and the gradients are used to fill a histogram: the value is the gradient’s angle, and the weight is the gradient’s magnitude. To determine whether the cells in the current detection window match a person or not, the system combines the histograms of all cells and sends them to a machine learning discriminator.

This technique has been designed to identify pedestrians who are completely visible and standing up. As a result, we should not expect it to function in other situations.

Project Tasks


Histograms of Oriented Gradients

Task 1: Import Necessary Libraries

Task 2: Plot the Histograms

Task 3: Plot Weighted Histograms

Task 4: Preparing an Array to Demonstrate HOG

Task 5: Calculate Histograms of Oriented Gradients (HOG)

Task 6: Plot the Norm and Show the Magnitude

Task 7: Plot HOG Using pyplot


Working With Single Frame of Video

Task 8: Load Detector

Task 9: Load the Video and Read the Frame

Task 10: Detect a Pedestrian

Task 11: Label and Visualize the Image with Detected Boxes


Working With the Whole Video

Task 12: Loop Over Previous Steps