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 visualizzazioni (ultimi 30 giorni)
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 Commenti
Pooyan Mobtahej
Pooyan Mobtahej il 28 Nov 2020
Here is the error that I want your help to resolve:
Unable to perform assignment because the size of the left side is 1-by-775 and the size of the right side
is 0-by-1.
Error in get_random_negative_features (line 66)
feature_neg(idx,:) = reshape(hog(m:step-1, n:step-1, :),[],1);
Error in project (line 71)
features_neg = get_random_negative_features( non_face_scn_path, feature_params, num_negative_examples);

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by