Filter löschen
Filter löschen

How to spearate the output of vl_hog() into 6*6*31 blocks, and use reshape() to convert every block to a row vector?

1 Ansicht (letzte 30 Tage)
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 Kommentare
Pooyan Mobtahej
Pooyan Mobtahej am 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);
Walter Roberson
Walter Roberson am 28 Nov. 2020
Reread what I posted before!!!
feature_neg(idx,:) = reshape(hog(m:m+step-1, n:n+step-1, :), [], 1);
^^ ^^

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by