exp function is returning zeros

조회 수: 6 (최근 30일)
sbei arafet
sbei arafet 2016년 4월 27일
댓글: sbei arafet 2016년 4월 27일
Hi,
i am trying to compute a normal function for all pixels on the image ,
m = mean(I(:));
segma = std (I(:));
fb1=(exp(-abs((I(i)-m).^2)./2.*segma.^2))% Feature based1
fb2=(exp(-abs((I(j)-m).^2)./2.*segma.^2))% Feature based 2
it returns zeros,am i clculating the mean and the std in wrong way !!
Thanks

답변 (3개)

Steven Lord
Steven Lord 2016년 4월 27일
Using Symbolic Math Toolbox, we can see what exp(-850) and exp(-950) would be, displayed to 20 digits.
>> vpa(exp(sym([-850; -950])), 20)
ans =
7.0744125465834323713e-370
2.6317352159005409842e-413
The smallest positive double precision number is not quite that small.
>> eps(0)
ans =
4.9407e-324
  댓글 수: 1
sbei arafet
sbei arafet 2016년 4월 27일
thanks for the precision

댓글을 달려면 로그인하십시오.


Star Strider
Star Strider 2016년 4월 27일
Assuming that ‘I’ is single or double, and not uint8 (that would throw an error for std), the most likely possibility is that the exp argument is very large.
  댓글 수: 2
sbei arafet
sbei arafet 2016년 4월 27일
I=double(dicomread('C:\Users\USER\Desktop\DDN250454 - 0815_002\Unnamed\WB MAC PSF ON - 8265\IM-0001-0001-0001.dcm'))./255;
yes it is, the arguments are in the range of -950 and -850
Star Strider
Star Strider 2016년 4월 27일
On my computer, the realmin function returns 2.225073858507201e-308, corresponding to exp(-708.396418532264). The exponential function of any value less than -708.396418532264 will return zero. (Even the Symbolic Math Toolbox with its extended resolution returns zero.)

댓글을 달려면 로그인하십시오.


Torsten
Torsten 2016년 4월 27일
편집: Torsten 2016년 4월 27일
fb1=exp(-(I(i)-m).^2./(2.*segma.^2))% Feature based1
fb2=exp(-(I(j)-m).^2./(2.*segma.^2))% Feature based 2
By the way: "segma" is "sigma".
Best wishes
Torsten.

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by