필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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월 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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by