Problem about the source codes of otsu-threshold
The codes from the files thresh.cpp, the function name is getThreshVal_Otsu_8u
if( std::min(q1,q2) < FLT_EPSILON ||
std::max(q1,q2) > 1. - FLT_EPSILON )
continue;
As far as I know,
q1 + q2 = 1--(1)
q1 = 1 - q2--(2)
q2 = 1 - q1--(3)
That means if
q1 < FLT_EPSILON
then 1 - q1 will satisfy
1 - q1 > 1 - FLT_EPSILON
In other words, if std::min(q1,q2) < FLT_EPSILON, then std::max(q1,q2) > 1. - FLT_EPSILON should satisfy too.So why do the codes need to do double check? Why don't just use
if( std::min(q1,q2) < FLT_EPSILON)
continue;