0% found this document useful (0 votes)
14 views4 pages

20 CS 48

The document is an assignment submission for a computer science course, submitted by Zain Ali Abidi with their roll number to their professor Sir. Adnan, dated January 7, 2023.

Uploaded by

Faizan Butt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

20 CS 48

The document is an assignment submission for a computer science course, submitted by Zain Ali Abidi with their roll number to their professor Sir. Adnan, dated January 7, 2023.

Uploaded by

Faizan Butt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment #2

SUBMITTED TO
Sir. Adnan
SUBMITTED BY
Zain Ali Abidi
Roll No
20-CS-48
DEPARTMENT OF CS
UET TAXILA
Date:7-1-23
Input image:

Output:
HoG
HOG, or Histogram of Oriented Gradients, is a feature descriptor that is often used to extract
features from image data. It is widely used in computer vision tasks for object detection. The
technique counts occurrences of gradient orientation in localized portions of an image.
The HOG descriptor focuses on the structure or the shape of an object. In the case of edge
features, we only identify if the pixel is an edge or not. HOG is able to provide the edge
direction as well. This is done by extracting the gradient and orientation (or you can say
magnitude and direction) of the edges.

Why are gradient direction and magnitude used in HoG?


HOG utilizes gradient direction and magnitude to build a histogram of gradient orientations
for each cell in an image. This histogram captures the shape and appearance of the object in
the image and can be used as a feature descriptor to identify and classify objects in the image.
Here is the process in more detail:
1. The image is divided into small cells, typically of size 8x8 or 16x16 pixels.
2. For each pixel within each cell, the gradient direction and magnitude are calculated. The
gradient direction is typically quantized into a set of predefined orientations, such as 0, 45,
90, and 135 degrees.
3. A histogram of gradient orientations is created for each cell by counting the number of
pixels within the cell that have a gradient direction that falls within each of the predefined
orientation bins. For example, if there are 8 orientations (0, 45, 90, 135, 180, 225, 270, and
315 degrees), then each histogram will have 8 bins.
4. The histograms for all of the cells in the image are concatenated to form a feature vector
for the entire image.
This feature vector can then be used as input to a machine learning model, such as a support
vector machine (SVM), for tasks such as object detection or classification. The idea behind
HOG is that the distribution of gradient orientations in an image will be different for different
object classes, and so the histogram of gradient orientations can be used to distinguish
between different object classes.

You might also like