fixed a dicide by zero potential problem

pull/2/head
Alexandre Benoit 13 years ago
parent 18fdc6bf1c
commit 9dfb1f77a0
  1. 3
      modules/contrib/src/basicretinafilter.cpp

@ -334,7 +334,8 @@ void BasicRetinaFilter::_localLuminanceAdaptation(const float *inputFrame, const
for (register unsigned int IDpixel=0 ; IDpixel<_filterOutput.getNBpixels() ; ++IDpixel, ++inputFramePTR)
{
float X0=*(localLuminancePTR++)*_localLuminanceFactor+_localLuminanceAddon;
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0);
// TODO : the following line can lead to a divide by zero ! A small offset is added, take care if the offset is too large in case of High Dynamic Range images which can use very small values...
*(outputFramePTR++) = (_maxInputValue+X0)**inputFramePTR/(*inputFramePTR +X0+0.00000000001);
//std::cout<<"BasicRetinaFilter::inputFrame[IDpixel]=%f, X0=%f, outputFrame[IDpixel]=%f\n", inputFrame[IDpixel], X0, outputFrame[IDpixel]);
}
}

Loading…
Cancel
Save