Fix crash when contrast threshold < 0 #43

This commit is contained in:
Henri Rebecq 2019-09-16 10:04:26 +02:00
parent 980f97e392
commit dc8a94f2b0

View File

@ -58,6 +58,8 @@ Events EventSimulator::imageCallback(const Image& img, Time time)
if(sigma_C > 0)
{
C += ze::sampleNormalDistribution<ImageFloatType>(false, 0, sigma_C);
constexpr ImageFloatType minimum_contrast_threshold = 0.01;
C = std::max(minimum_contrast_threshold, C);
}
ImageFloatType curr_cross = prev_cross;
bool all_crossings = false;