필터 지우기
필터 지우기

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
Pooyan Mobtahej
Pooyan Mobtahej 2020년 11월 28일
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 2020년 11월 28일
Reread what I posted before!!!
feature_neg(idx,:) = reshape(hog(m:m+step-1, n:n+step-1, :), [], 1);
^^ ^^

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by