error in attached program
显示 更早的评论
Index exceeds matrix dimensions.
Error in ext_vein (line 381) dist_m = dist2(minutiae(:,1:2), minutiae(:,1:2));
Error in build_db (line 22) traindata{id_train}=ext_vein(X,1);
采纳的回答
Walter Roberson
2018-4-15
When minu_count is 0 then t_minuae will be left as [] and so will not have columns 1:2 to index into.
6 个评论
second error is
Error using knnclassify (line 96)
The length of GROUP must be equal to the number of rows in TRAINING.
Error in maintotaldemo (line 65)
predictlabel = knnclassify(P_test, P_train, train_label,1,'euclidean','nearest');
I have 20 classes 9 images for P_train class and 3 images for P_test classe. four minutie with 6 columns having x,y,Crossing Number,theta(orientation,flag and permissible minutie extracted from each image so I get P_train i.e 720 X 6 and my train label is 180 X 1, when I use knnclassify group length error occurred, sir is that possible to make group of rows and use index of that group in knnclassify ?
Those four minutiae for any one image: for the purpose of recognition do they need to all be matched, or is it enough to match any one of them?
If they all need to be matched then you should be using 180 x (6*4) rather than 720 x 6.
Sir,is it possible 180 X (6*4) because I have used cell array e.g.
for folder_idx = 1 : 20 % no of classes
for i = 1 : 9 % no of images per class
thisfile = fullfile('train', num2str(folder_idx), [num2str(i) '.bmp ']);
B = imread(thisfile );
X = double(B);
X = imresize(X,[120 120],'bilinear'); %300 250
id_train = id_train+1;
traindata{id_train}=ext_vein(X,1);
end
end
%%size of cell array is 1 X 180 like following
4x6 double 4x6 double....... 4x6 double
is it possible to provide cell array in knnclassify ? if possible then tain_label should be cell array or not
No you cannot give knn cell array. You should reshape it to a row vector, and the 180 samples would become a 180 x 24 array. The label would be 180 long and would be class number associated with the image.
Error using reshape
To RESHAPE the number of elements must not change.
Error in build_db (line 57)
reduced_testdata = reshape(reduced_testdata, 24, 60)
%%Training images
id_test = 0;
id_train = 0;
for folder_idx = 1 : 20 % no of classes
for i = 1 : 9 % no of images per class
thisfile = fullfile('train', num2str(folder_idx), [num2str(i) '.bmp ']);
B = imread(thisfile );
X = double(B);
X = imresize(X,[120 120],'bilinear'); %300 250
id_train = id_train+1;
traindata{id_train}=ext_vein(X,1);
end
end
%%Testing images
d=[];
for folder_idx = 1 : 20 %no of classes
for i = 1 : 3 % no of images per class
thisfile = fullfile('test', num2str(folder_idx), [num2str(i) '.bmp ']);
B = imread(thisfile );
X = double(B);
X = imresize(X,[120 120],'bilinear'); %300 250
id_test = id_test+1;
testdata{id_test}=ext_vein(X,1);
end
end
%%Reduced dimension of rows ( fixed to only 20 rows)
reduced_testdata = cellfun(@(M) M(1:min(end,4), :), testdata, 'uniform', 0);
reduced_traindata = cellfun(@(M) M(1:min(end,4), :), traindata, 'uniform', 0);
%%reshape
% reduced_testdata = reshape(reduced_testdata,1,[]);
reduced_testdata = reshape(reduced_testdata, 60,24);
reduced_traindata = reshape(reduced_traindata, 180,24);
%reduced_traindata = reshape(reduced_traindata,1,[]);
save('db1.mat','reduced_testdata');
save('db2.mat','reduced_traindata');
Sir, I tried a lot but am not able to reshape my cell array into 180 X 24, please help..
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Images 的更多信息
标签
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
