フィルターのクリア

how to rectify the error that is index in position 1 exceeds array bonds

2 ビュー (過去 30 日間)
Shan Sha
Shan Sha 2018 年 12 月 3 日
コメント済み: Shan Sha 2018 年 12 月 6 日
my error
Index in position 1 exceeds array bounds (must not exceed 66).
Error in cal_AP (line 5)
trains = CLBP_SMCH(trainIDs,:);
Error in approx_subband (line 63)
Accuracy_in_Percent = cal_AP(Hist,trainIDs, trainClassIDs,testIDs, testClassIDs)
i have attached my program with this? help me to overcome this error
  4 件のコメント
Walter Roberson
Walter Roberson 2018 年 12 月 3 日
Hist = [Hist; NewData]
Shan Sha
Shan Sha 2018 年 12 月 4 日
sorry I cant get you

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 12 月 4 日
close all;
clear all;
clc
rootpic = 'Outex_TC_00014\';
datadir = 'results';
if exist(datadir,'dir');
else
mkdir(datadir);
end
sigmaSet = [1];
F = makeGDfilters(sigmaSet);
snr = 0; % here "0" only denotes "No noise"
K = 2;
C = 1;
Ls = 3;
Lr = 5;
%%
picNum = 4080;
tic
Hist=[];
for i=1:picNum
filename = sprintf('%s\\images\\%06d.bmp', rootpic, i-1);
display(['.... ' num2str(i) ])
Gray = imread(filename);
% figure,imshow(Gray),title('Input Image');
Gray = im2double(Gray); % rescaling
if snr~=0 % here "0" only denotes "No noise"
Gray = awgn(Gray,10*log10(snr),'measured'); % measures the Gray and add white gaussian noise
end
I= rgb2gray(Gray);
%I = (Gray-mean(Gray(:)))/std(Gray(:));% normalized to have zero mean and standard deviation
%I = imnoise(I,'gaussian');
% image_resize=imresize(I, [160 160]);
%apply im2double
% image_resize=im2double(image_resize);
% F = makegaborfilters(sigmaSet,image_resize);
% I=rgb2gray(I);
[cA,cH,cV,cD] = dwt2(I,'coif1');
I=cA;
% f1 = extractLBPFeatures(cA);
% f2 = extractLBPFeatures(cH);
% f3 = extractLBPFeatures(cV);
% f4 = extractLBPFeatures(cD);
% % me=str2num(cA);
% % H1= zeros(cA,me);
% n1= hist(f1);
% n2= hist(f2);
% n3= hist(f3);
% n4= hist(f4);
% m= [n1 n2 n3 n4];
% % I= imnoise(I,'gaussian');
newHist = getFeatsCodes(F,sigmaSet, I, Ls, Lr, K, C); %4380*384
Hist = [Hist; newHist]; % <------ CHANGED
end
% reading data
trainTxt = sprintf('%s000\\train.txt', rootpic); %format tha data in array into string
testTxt = sprintf('%s000\\test.txt', rootpic);
[trainIDs, trainClassIDs] = ReadOutexTxt(trainTxt);
[testIDs, testClassIDs] = ReadOutexTxt(testTxt);
Accuracy_in_Percent = cal_AP(Hist,trainIDs, trainClassIDs,testIDs, testClassIDs)
display(['Time consuming ' num2str(toc/60) ' mins'])
save(['./results/TC10_LETRIST.mat'], 'Accuracy_in_Percent');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by