Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

histogram of oriented gradients (HOG) features matlab

So Im trying to figure out how many features are belong to each block, in other words, if I get it right each feature is a bin of a histogram for specific orientation. So when I run the following code in matlab: as you can see it shows 16 different hog features, but the feature vector is 1x324. So how many of features belong to each block /cell? Thanks

clear
clc
close all
img = imread('cameraman.tif');
[hog1, visualization] = extractHOGFeatures(img,'CellSize',[64 64]);
subplot(1,2,1);
imshow(img);
subplot(1,2,2);
plot(visualization);

enter image description here

like image 445
Alex Avatar asked Oct 25 '25 06:10

Alex


1 Answers

The reason your HOG vector size 324 is that you have 9 overlapping blocks in the image, each of size 2x2 cells, where each cell is 64x64 pixels. Each block gives you 4 histograms of oriented gradients, each containing 9 bins. So the number of HOG features is 9 * 4 * 9 = 324.

The visualization, evidently, displays a sampling of the cells, to give you the idea of the distribution of orientations in your image. You have 4x4 cells in your image. What you see in the visualization plot is the rose plot of the gradient orientation histogram for each cell.

like image 171
Dima Avatar answered Oct 27 '25 00:10

Dima