pratt index out of bounds

2 ビュー (過去 30 日間)
Harry Levick
Harry Levick 2018 年 12 月 12 日
コメント済み: Harry Levick 2018 年 12 月 12 日
I am trying to use pratt's figure of merit analysis in order to analyse different edge detectors. I am using this function that I found online, although It is throwing an error that I don't understand:
function F = pratt(Ea,Ed)
% Function EDPM : Edge detector performance measure function.
% Calculates for a given edge image the false alarm
% count, miss count and figure of merit (F) values.
%
%
% Input(s)... Ea : Actual edge image
% Ed : Detected edge image.
%
% Output(s).. fac: False alarm count
% msc: miss count
% F : Figure of merit
Ea=double(Ea);
Ed=double(Ed);
[N,M]=size(Ea);
if [N,M]~=size(Ed)
error('Actual and detected edge image sizes must be same');
end;
a=0.1; % edge shift penalty constant;
fac=length(find((Ea-Ed)==-1)); % False Alarm Count
msc=length(find((Ea-Ed)==1)); % Miss Count
Na=sum(sum(Ea));Nd=sum(sum(Ed));
c=1/max(Na,Nd);
[ia,ja]=find(Ea==1);
for l=1:Na
Aes(l)=Ed(ia(l),ja(l));
end;
mi=ia(find(Aes==0));
mj=ja(find(Aes==0));
F=c*sum(Aes);
for k=1:length(mi)
n1=0;n2=0;m1=0;m2=0;
while sum(sum(Ed(mi(k)-n1:mi(k)+n2,mj(k)-m1:mj(k)+m2)))<1
if mi(k)-n1>1 n1=n1+1;end;
if mi(k)+n2<N n2=n2+1;end;
if mj(k)-m1>1 m1=m1+1;end;
if mj(k)+m2<M m2=m2+1;end;
end;
di=max([n1 n2 m1 m2]);
F=F+c/(1+a*di^2);
end;
F = F*100;
this gives the error:
Index exceeds matrix dimensions.
Error in pratt (line 28)
Aes(l)=Ed(ia(l),ja(l));
I dont fully understand the part of the code where the error is occuring, if anybody could explain why the error is occuring, and what this part of the code is doing, that would be much appreciated.
  3 件のコメント
KSSV
KSSV 2018 年 12 月 12 日
What is the input you have used?
Harry Levick
Harry Levick 2018 年 12 月 12 日
It was the un-thresholded images, this was causing the error because the line
[ia,ja]=find(Ea==1);
was returning 0, 0 because the image was not binarised.

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

回答 (0 件)

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by