How to get visualization of HOGfeatures

1 view (last 30 days)
Vojtech Raska
Vojtech Raska on 24 Mar 2018
Answered: Gayathri on 10 Jan 2025
I used following code to extract HOG feature from an image in gui
if true
[HogFeature, visualization]= extractHOGFeatures(filepath,1);
axes(handles.axes3);
plot(visualization);
end
where filepath is my image, but when I start that part of code I get error "Error using extractHOGFeatures Expected POINTS to be of size Mx2 when it is actually size 1x1." What´s wrong?

Answers (1)

Gayathri
Gayathri on 10 Jan 2025
The error you are facing is because the second argument to the "extractHOGFeatures" function must be a center location point of a square neighbourhood. The function extracts descriptors from the neighborhoods that are fully contained within the image boundary.
Please refer to the below code on how to extract the HOG features.
img = imread('cameraman.tif');
[featureVector,hogVisualization] = extractHOGFeatures(img);
If you want to use extract the HOG features around a certain point, please refer to the below code.
I2 = imread('gantrycrane.png');
corners = detectFASTFeatures(im2gray(I2));
strongest = selectStrongest(corners,3);
[hog2,validPoints,ptVis] = extractHOGFeatures(I2,strongest);
For more information on "extractHOGFeatures", please refer to the below documentation link. It also contains different examples which you can refer regarding different input arguments.
Hope you find this information helpful!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!