@ -179,9 +179,9 @@ void BasicRetinaFilter::setLPfilterParameters(const float beta, const float tau,
_alpha = 0.0001f ;
}
float _temp = ( 1 + _beta ) / ( 2 * _mu * _alpha ) ;
float _a = _filteringCoeficientsTable [ tableOffset ] = 1 + _temp - ( float ) sqrt ( ( 1.0 + _temp ) * ( 1.0 + _temp ) - 1.0 ) ;
_filteringCoeficientsTable [ 1 + tableOffset ] = ( 1 - _a ) * ( 1 - _a ) * ( 1 - _a ) * ( 1 - _a ) / ( 1 + _beta ) ;
float _temp = ( 1.0f + _beta ) / ( 2.0f * _mu * _alpha ) ;
float _a = _filteringCoeficientsTable [ tableOffset ] = 1.0f + _temp - ( float ) sqrt ( ( 1.0f + _temp ) * ( 1.0f + _temp ) - 1.0f ) ;
_filteringCoeficientsTable [ 1 + tableOffset ] = ( 1.0f - _a ) * ( 1.0f - _a ) * ( 1.0f - _a ) * ( 1.0f - _a ) / ( 1.0f + _beta ) ;
_filteringCoeficientsTable [ 2 + tableOffset ] = tau ;
//std::cout<<"BasicRetinaFilter::normal:"<<(1.0-_a)*(1.0-_a)*(1.0-_a)*(1.0-_a)/(1.0+_beta)<<" -> old:"<<(1-_a)*(1-_a)*(1-_a)*(1-_a)/(1+_beta)<<std::endl;
@ -209,20 +209,20 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CentredAccuracy(const floa
unsigned int tableOffset = filterIndex * 3 ;
float _alpha = 0.8f ;
float _temp = ( 1 + _beta ) / ( 2 * _mu * _alpha ) ;
float _a = _filteringCoeficientsTable [ tableOffset ] = 1 + _temp - ( float ) sqrt ( ( 1.0 + _temp ) * ( 1.0 + _temp ) - 1.0 ) ;
_filteringCoeficientsTable [ tableOffset + 1 ] = ( 1 - _a ) * ( 1 - _a ) * ( 1 - _a ) * ( 1 - _a ) / ( 1 + _beta ) ;
float _temp = ( 1.0f + _beta ) / ( 2.0f * _mu * _alpha ) ;
float _a = _filteringCoeficientsTable [ tableOffset ] = 1.0f + _temp - ( float ) sqrt ( ( 1.0f + _temp ) * ( 1.0f + _temp ) - 1.0f ) ;
_filteringCoeficientsTable [ tableOffset + 1 ] = ( 1.0f - _a ) * ( 1.0f - _a ) * ( 1.0f - _a ) * ( 1.0f - _a ) / ( 1.0f + _beta ) ;
_filteringCoeficientsTable [ tableOffset + 2 ] = tau ;
float commonFactor = alpha0 / ( float ) sqrt ( _halfNBcolumns * _halfNBcolumns + _halfNBrows * _halfNBrows + 1.0 ) ;
float commonFactor = alpha0 / ( float ) sqrt ( _halfNBcolumns * _halfNBcolumns + _halfNBrows * _halfNBrows + 1.0f ) ;
//memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels());
for ( unsigned int idColumn = 0 ; idColumn < _halfNBcolumns ; + + idColumn )
for ( unsigned int idRow = 0 ; idRow < _halfNBrows ; + + idRow )
{
// computing local spatial constant
float localSpatialConstantValue = commonFactor * sqrt ( ( float ) ( idColumn * idColumn ) + ( float ) ( idRow * idRow ) ) ;
if ( localSpatialConstantValue > 1 )
localSpatialConstantValue = 1 ;
if ( localSpatialConstantValue > 1.0f )
localSpatialConstantValue = 1.0f ;
_progressiveSpatialConstant [ _halfNBcolumns - 1 + idColumn + _filterOutput . getNBcolumns ( ) * ( _halfNBrows - 1 + idRow ) ] = localSpatialConstantValue ;
_progressiveSpatialConstant [ _halfNBcolumns - 1 - idColumn + _filterOutput . getNBcolumns ( ) * ( _halfNBrows - 1 + idRow ) ] = localSpatialConstantValue ;
@ -265,9 +265,9 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CustomAccuracy(const float
//alpha0=0.0001;
}
unsigned int tableOffset = filterIndex * 3 ;
float _temp = ( 1 + _beta ) / ( 2 * _mu * _alpha ) ;
float _a = _filteringCoeficientsTable [ tableOffset ] = 1 + _temp - ( float ) sqrt ( ( 1.0 + _temp ) * ( 1.0 + _temp ) - 1.0 ) ;
_filteringCoeficientsTable [ tableOffset + 1 ] = ( 1 - _a ) * ( 1 - _a ) * ( 1 - _a ) * ( 1 - _a ) / ( 1 + _beta ) ;
float _temp = ( 1.0f + _beta ) / ( 2.0f * _mu * _alpha ) ;
float _a = _filteringCoeficientsTable [ tableOffset ] = 1.0f + _temp - ( float ) sqrt ( ( 1.0f + _temp ) * ( 1.0f + _temp ) - 1.0f ) ;
_filteringCoeficientsTable [ tableOffset + 1 ] = ( 1.0f - _a ) * ( 1.0f - _a ) * ( 1.0f - _a ) * ( 1.0f - _a ) / ( 1.0f + _beta ) ;
_filteringCoeficientsTable [ tableOffset + 2 ] = tau ;
//memset(_progressiveSpatialConstant, 255, _filterOutput.getNBpixels());
@ -283,7 +283,7 @@ void BasicRetinaFilter::setProgressiveFilterConstants_CustomAccuracy(const float
_progressiveSpatialConstant [ index ] = localSpatialConstantValue ;
// computing local gain
float localGain = ( 1 - localSpatialConstantValue ) * ( 1 - localSpatialConstantValue ) * ( 1 - localSpatialConstantValue ) * ( 1 - localSpatialConstantValue ) / ( 1 + _beta ) ;
float localGain = ( 1.0f - localSpatialConstantValue ) * ( 1.0f - localSpatialConstantValue ) * ( 1.0f - localSpatialConstantValue ) * ( 1.0f - localSpatialConstantValue ) / ( 1.0f + _beta ) ;
_progressiveGain [ index ] = localGain ;
//std::cout<<commonFactor<<", "<<sqrt((_halfNBcolumns-1-idColumn)+(_halfNBrows-idRow-1))<<", "<<(_halfNBcolumns-1-idColumn)<<", "<<(_halfNBrows-idRow-1)<<", "<<localSpatialConstantValue<<std::endl;
@ -345,7 +345,7 @@ void BasicRetinaFilter::_localLuminanceAdaptationPosNegValues(const float *input
const float * localLuminancePTR = localLuminance ;
const float * inputFramePTR = inputFrame ;
float * outputFramePTR = outputFrame ;
float factor = _maxInputValue * 2 / ( float ) CV_PI ;
float factor = _maxInputValue * 2.0f / ( float ) CV_PI ;
for ( register unsigned int IDpixel = 0 ; IDpixel < _filterOutput . getNBpixels ( ) ; + + IDpixel , + + inputFramePTR )
{
float X0 = * ( localLuminancePTR + + ) * _localLuminanceFactor + _localLuminanceAddon ;