Displaying HOG features of each image
Mostrar comentarios más antiguos
So, I'm trying to display the extracted HOG features of each image from a folder by the following code:
for i=1:2
img = imread(['/Users/Bishwo/Downloads/101_ObjectCategories/starfish2/image' num2str(i) '.jpg']);
if size(img, 3)==3
img = rgb2gray(img);
end
img = im2single(img);
cellSize = 8;
hog = vl_hog(img, cellSize, 'verbose');
%following two commands visualize the features
imhog = vl_hog('render', hog, 'verbose') ;
clf ; imagesc(imhog) ; colormap gray ;
end
I'm using a for loop to go through the image files which are labeled, image1.jpg, image2.jpg...etc. To make it simpler, I've only added two images in the folder and i'm working through 2 images. When I run the program, I want it to display the visual representation of the HOG features of each image. Right now, it only shows the HOG features of the last image(image2.jpg). So, how do I change my code, so it will show and work for every image?
2 comentarios
Gautam Mohan
el 29 de Mzo. de 2016
Do you want your code to show the HOG features of each image in a new figure? Currently it looks like you are clearing the figure and redrawing the new image, which would mean that image2 overwrites image1.
Consider making a new figure for each image. Something along the lines of
figure(i)
imagesc(imhog)
% no clf, each image printed to a different figure
If you want to display all the images in the same figure, you might consider using the subplot command.
Matthew Eicholtz
el 29 de Mzo. de 2016
Gautam, you should make your comment an answer.
Respuestas (0)
Categorías
Más información sobre Semantic Segmentation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!