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 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2020-11-28
Reread what I posted before!!!
feature_neg(idx,:) = reshape(hog(m:m+step-1, n:n+step-1, :), [], 1);
^^ ^^
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!