How to spearate the output of vl_hog() into 6*6*31 blocks, and use reshape() to convert every block to a row vector?
2 views (last 30 days)
Show older comments
How to spearate the output of vl_hog() into 6*6*31 blocks,
and use reshape() to convert every block to a row vector,
then save each vector to features_neg, and increase idx by 1
idx=0;
for i=1:num_images
im=imread([non_face_scn_path '/' image_files(i).name]);
%%%%% JZ: please follow the steps below to compute HOG features for each image.
%%%%% 1. use single() function to convert input image to SINGLE class;
%%%%% 2. call vl_hog() function, two parameters: one is the image, the
%%%%% other is the feature_parames.hog_cell_size;
%%%%% JZ: Your code here!
im=single(im);
hog = vl_hog(im, feature_params.hog_cell_size, 'verbose');
for m=1:step:size(im,1)
for n=1:step:size(im,2)
%%%%% JZ: spearate the output of vl_hog() into 6*6*31 blocks,
%%%%% use reshape() to convert every block to a row vector,
%%%%% save each vector to features_neg, and increase idx by 1
%%%%% JZ: Your code here!
idx=idx+1
feature_neg(idx,:)=reshape(hog,1,[]);
%feature_neg(idx,:) = reshape(hog(m:m+step-1, n:n+step-1, :), [], 1);
idx=idx+1
end
end
disp(['idex is: ' num2str(idx)]);
disp(['case is: ' num2str(i)]);
end
idx
3 Comments
Walter Roberson
on 28 Nov 2020
Reread what I posted before!!!
feature_neg(idx,:) = reshape(hog(m:m+step-1, n:n+step-1, :), [], 1);
^^ ^^
Answers (0)
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!