[Insight-users] Otsu

Luca Antiga lucantiga at softhome . net
23 Aug 2002 15:47:39 +0200


Hi users,
I used in itkOtsuThresholdImageCalculator with an image which contains
negative valued pixels. I noticed that the following line (repeated in
lines 126 and 141) yield an error

double maxVarBetween = freqLeft * ( 1.0 - freqLeft ) *
vnl_math_sqr(meanLeft - meanRight );

because the argument of the sqrt can be negative. I think that it should
be replaced with something like

double maxVarBetween = freqLeft * ( 1.0 - freqLeft ) *
vnl_math_sqr(fabs(meanLeft - meanRight));

(but maybe I'm missing some drawbacks)
Cheers

Luca