I am getting Subscripted assignment dimension mismatch in the following code.
1 回表示 (過去 30 日間)
古いコメントを表示
fprintf('Extracting features... ');
tic;
n1=145;%set n1 value
dim=120;%set Dimension
temp=0;
for a=1:n1
s = strcat('C:\Users\om\Desktop\abhinav\a (', int2str(a), ').jpg');
%I = imresize(imread(s),[512 NaN]);
I=imread(s);
faceDetector = vision.CascadeObjectDetector();
bbox = step(faceDetector, I);
fprintf('Total %d faces found. Beginning comparison.. \n', size(bbox,1));
for b=1:size(bbox,1);
fprintf('Face %d -> ', b);
X = imcrop(I,bbox(b,:));
temp=temp+1;
I1 = imresize(X,[dim dim]);
J = rgb2gray(I1);
T(temp,:) = hog_feature_vector(J);
fprintf('Yo');
end
end
The error is in "T(temp,:) = hog_feature_vector(J);" I have hog_feature_vecture(IMG) already made and its working perfect. Please help. Edit 1. Attached hog_feature_vector.m . Sorry for not attaching earlier.
0 件のコメント
回答 (1 件)
J. Webster
2016 年 4 月 22 日
Gonna be hard to troubleshoot this without seeing what hog_features_vector() returns, or what the dimensions of T are.
my guess is that you are trying to insert a row where you should be inserting a column, of vice versa.
for example,
x = rand(5,10);
y = rand(10,1);
x(1,:) = y; %No error, all is ok since the second dimension of x matches the length 0f y
x(:,1) = y; %Error, subscripted assignment mismatch... because the 1st dimension of x is ony 5
3 件のコメント
J. Webster
2016 年 4 月 22 日
yep, hog returns a row, it may be as simple as transposing the return value from hog...
T(temp,:) = transpose(hog_feature_vector(J));
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!