フィルターのクリア

Can someone explain why I am getting the following error in my code?

1 回表示 (過去 30 日間)
Pritha
Pritha 2013 年 4 月 29 日
function [g]=EdgeDetector_procedure(f)
[M,N]=size(f);
g=f;
m = 3;
n = 3;
a0 = (m-1)/2;
b0 = (n-1)/2;
for y = b0+1 : N-b0;
for x = a0+1 : M-a0;
sum1 = 0;
for k=-b0:b0;
for j=-a0:a0;
if ( f(x,y) == f (x+j,y+k) )
sum1=sum1+1;
end;
end;
end;
p=sum1/9;
H=-plog(p);
d=log(1/9);
if(H<-d/9)
g(x,y)=0;
else
g(x,y)=1;
end;
end;
end;
?? Undefined function or method 'plog' for input arguments of type 'double'.
Error in ==> EdgeDetector_procedure at 20 H=-plog(p);
  1 件のコメント
Daniel Shub
Daniel Shub 2013 年 4 月 29 日
You get the error because MATLAB you use plog, but MATLAB doesn't know what it is.

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

回答 (1 件)

Image Analyst
Image Analyst 2013 年 4 月 29 日
編集済み: Image Analyst 2013 年 4 月 29 日
Try
H = -p .* log(p); % Calculate entropy.
By the way, there is an entropyfilt() entropy filter that you may want to check out.
  1 件のコメント
Daniel Shub
Daniel Shub 2013 年 4 月 29 日
I thought plog(p) was a typo of plot at first, but now I see that it is p.*log(p). Nice catch.

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

Community Treasure Hunt

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

Start Hunting!

Translated by