// run local adaptation filter and save result in _filterOutput
const std::valarray<double> &BasicRetinaFilter::runFilter_LocalAdapdation(const std::valarray<double> &inputFrame, const std::valarray<double> &localLuminance)
{
- _localLuminanceAdaptation(&inputFrame[0], &localLuminance[0], &_filterOutput[0]);
+ _localLuminanceAdaptation(get_data(inputFrame), get_data(localLuminance), &_filterOutput[0]);
return _filterOutput;
}
// run local adaptation filter at a specific output adress
void BasicRetinaFilter::runFilter_LocalAdapdation(const std::valarray<double> &inputFrame, const std::valarray<double> &localLuminance, std::valarray<double> &outputFrame)
{
- _localLuminanceAdaptation(&inputFrame[0], &localLuminance[0], &outputFrame[0]);
+ _localLuminanceAdaptation(get_data(inputFrame), get_data(localLuminance), &outputFrame[0]);
}
// run local adaptation filter and save result in _filterOutput with autonomous low pass filtering before adaptation
const std::valarray<double> &BasicRetinaFilter::runFilter_LocalAdapdation_autonomous(const std::valarray<double> &inputFrame)
{
- _spatiotemporalLPfilter(&inputFrame[0], &_filterOutput[0]);
- _localLuminanceAdaptation(&inputFrame[0], &_filterOutput[0], &_filterOutput[0]);
+ _spatiotemporalLPfilter(get_data(inputFrame), &_filterOutput[0]);
+ _localLuminanceAdaptation(get_data(inputFrame), &_filterOutput[0], &_filterOutput[0]);
return _filterOutput;
}
// run local adaptation filter at a specific output adress with autonomous low pass filtering before adaptation
void BasicRetinaFilter::runFilter_LocalAdapdation_autonomous(const std::valarray<double> &inputFrame, std::valarray<double> &outputFrame)
{
- _spatiotemporalLPfilter(&inputFrame[0], &_filterOutput[0]);
- _localLuminanceAdaptation(&inputFrame[0], &_filterOutput[0], &outputFrame[0]);
+ _spatiotemporalLPfilter(get_data(inputFrame), &_filterOutput[0]);
+ _localLuminanceAdaptation(get_data(inputFrame), &_filterOutput[0], &outputFrame[0]);
}
// local luminance adaptation of the input in regard of localLuminance buffer
void BasicRetinaFilter::_localLuminanceAdaptation(const double *inputFrame, const double *localLuminance, double *outputFrame)
// run LP filter and save result in the basic retina element buffer
const std::valarray<double> &BasicRetinaFilter::runFilter_LPfilter(const std::valarray<double> &inputFrame, const unsigned int filterIndex)
{
- _spatiotemporalLPfilter(&inputFrame[0], &_filterOutput[0], filterIndex);
+ _spatiotemporalLPfilter(get_data(inputFrame), &_filterOutput[0], filterIndex);
return _filterOutput;
}
// run LP filter for a new frame input and save result at a specific output adress
void BasicRetinaFilter::runFilter_LPfilter(const std::valarray<double> &inputFrame, std::valarray<double> &outputFrame, const unsigned int filterIndex)
{
- _spatiotemporalLPfilter(&inputFrame[0], &outputFrame[0], filterIndex);
+ _spatiotemporalLPfilter(get_data(inputFrame), &outputFrame[0], filterIndex);
}
// run LP filter on the input data and rewrite it
* forbiden method inherited from parent std::valarray
* prefer not to use this method since the filter matrix become vectors
*/
- void resize(const unsigned int NBpixels){std::cerr<<"error, not accessible method"<<std::endl;};
+ void resize(const unsigned int){std::cerr<<"error, not accessible method"<<std::endl;};
/**
* low pass filter call and run (models the homogeneous cells network at the retina level, for example horizontal cells or photoreceptors)
* @param outputFrame: the output buffer in which the result is writen
* @param filterIndex: the index which specifies the parameter set that should be used for the filtering
*/
- inline void runProgressiveFilter(const std::valarray<double> &inputFrame, std::valarray<double> &outputFrame, const unsigned int filterIndex=0){_spatiotemporalLPfilter_Irregular(&inputFrame[0], &outputFrame[0], filterIndex);};
+ inline void runProgressiveFilter(const std::valarray<double> &inputFrame,
+ std::valarray<double> &outputFrame,
+ const unsigned int filterIndex=0)
+ {_spatiotemporalLPfilter_Irregular(get_data(inputFrame), &outputFrame[0], filterIndex);};
/**
* first order spatio-temporal low pass filter setup function
* @param maxInputValue: the maximum amplitude value measured after local adaptation processing (c.f. function runFilter_LocalAdapdation & runFilter_LocalAdapdation_autonomous)
* @param meanLuminance: the a priori meann luminance of the input data (should be 128 for 8bits images but can vary greatly in case of High Dynamic Range Images (HDRI)
*/
- void setV0CompressionParameter(const double v0, const double maxInputValue, const double meanLuminance){ _v0=v0*maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=maxInputValue*(1.0-v0); _maxInputValue=maxInputValue;};
+ void setV0CompressionParameter(const double v0, const double maxInputValue, const double){ _v0=v0*maxInputValue; _localLuminanceFactor=v0; _localLuminanceAddon=maxInputValue*(1.0-v0); _maxInputValue=maxInputValue;};
/**
* update local luminance adaptation setup, initial maxInputValue is kept. This function should be applied for normal local adaptation (not for tone mapping operation)
return _initOK;
}
-bool ImageLogPolProjection::_initLogPolarCortexSampling(const double reductionFactor, const double samplingStrenght)
+bool ImageLogPolProjection::_initLogPolarCortexSampling(const double reductionFactor, const double)
{
_initOK=false;
if (_colorModeCapable&&colorMode)
{
// progressive filtering and storage of the result in _tempBuffer
- _spatiotemporalLPfilter_Irregular(&inputFrame[0], &_irregularLPfilteredFrame[0]);
+ _spatiotemporalLPfilter_Irregular(get_data(inputFrame), &_irregularLPfilteredFrame[0]);
_spatiotemporalLPfilter_Irregular(&_irregularLPfilteredFrame[0], &_tempBuffer[0]); // warning, temporal issue may occur, if the temporal constant is not NULL !!!
- _spatiotemporalLPfilter_Irregular(&inputFrame[0]+_filterOutput.getNBpixels(), &_irregularLPfilteredFrame[0]);
+ _spatiotemporalLPfilter_Irregular(get_data(inputFrame)+_filterOutput.getNBpixels(), &_irregularLPfilteredFrame[0]);
_spatiotemporalLPfilter_Irregular(&_irregularLPfilteredFrame[0], &_tempBuffer[0]+_filterOutput.getNBpixels());
- _spatiotemporalLPfilter_Irregular(&inputFrame[0]+_filterOutput.getNBpixels()*2, &_irregularLPfilteredFrame[0]);
+ _spatiotemporalLPfilter_Irregular(get_data(inputFrame)+_filterOutput.getNBpixels()*2, &_irregularLPfilteredFrame[0]);
_spatiotemporalLPfilter_Irregular(&_irregularLPfilteredFrame[0], &_tempBuffer[0]+_filterOutput.getNBpixels()*2);
// applying image projection/resampling
//normalizeGrayOutput_0_maxOutputValue(_sampledFrame, _outputNBpixels);
}else
{
- _spatiotemporalLPfilter_Irregular(&inputFrame[0], &_irregularLPfilteredFrame[0]);
+ _spatiotemporalLPfilter_Irregular(get_data(inputFrame), &_irregularLPfilteredFrame[0]);
_spatiotemporalLPfilter_Irregular(&_irregularLPfilteredFrame[0], &_irregularLPfilteredFrame[0]);
// applying image projection/resampling
register unsigned int *transformTablePTR=&_transformTable[0];
const std::valarray<double> &MagnoRetinaFilter::runFilter(const std::valarray<double> &OPL_ON, const std::valarray<double> &OPL_OFF)
{
// Compute the high pass temporal filter
- _amacrineCellsComputing(&OPL_ON[0], &OPL_OFF[0]);
+ _amacrineCellsComputing(get_data(OPL_ON), get_data(OPL_OFF));
// apply low pass filtering on ON and OFF ways after temporal high pass filtering
_spatiotemporalLPfilter(&_amacrinCellsTempOutput_ON[0], &_magnoXOutputON[0], 0);
// output return is (*_parvocellularOutputONminusOFF)
const std::valarray<double> &ParvoRetinaFilter::runFilter(const std::valarray<double> &inputFrame, const bool useParvoOutput)
{
- _spatiotemporalLPfilter(&inputFrame[0], &_photoreceptorsOutput[0]);
+ _spatiotemporalLPfilter(get_data(inputFrame), &_photoreceptorsOutput[0]);
_spatiotemporalLPfilter(&_photoreceptorsOutput[0], &_horizontalCellsOutput[0], 1);
_OPL_OnOffWaysComputing();
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/internal.hpp"
+namespace cv
+{
+
+// special function to get pointer to constant valarray elements, since
+// simple &arr[0] does not compile on VS2005/VS2008.
+template<typename T> inline const T* get_data(const std::valarray<T>& arr)
+{ return &((std::valarray<T>&)arr)[0]; }
+
+}
+
#endif
void Retina::_convertValarrayGrayBuffer2cvMat(const std::valarray<double> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)
{
// fill output buffer with the valarray buffer
- const double *valarrayPTR=&grayMatrixToConvert[0];
+ const double *valarrayPTR=get_data(grayMatrixToConvert);
if (!colorMode)
{
outBuffer.create(cv::Size(nbColumns, nbRows), CV_8U);
_demultiplexedTempBuffer=0;
// -> demultiplex process
register unsigned int *colorSamplingPRT=&_colorSampling[0];
- register const double *multiplexedColorFramePTR=&multiplexedColorFrame[0];
+ register const double *multiplexedColorFramePTR=get_data(multiplexedColorFrame);
for (unsigned int indexa=0; indexa<_filterOutput.getNBpixels() ; ++indexa)
_demultiplexedTempBuffer[*(colorSamplingPRT++)]=*(multiplexedColorFramePTR++);
}else
{
- register const double *multiplexedColorFramePTR= &multiplexedColorFrame[0];
+ register const double *multiplexedColorFramePTR= get_data(multiplexedColorFrame);
for (unsigned int indexc=0; indexc<_filterOutput.getNBpixels() ; ++indexc, ++chrominancePTR, ++colorLocalDensityPTR, ++luminance, ++multiplexedColorFramePTR)
{
// normalize by photoreceptors density
void RetinaColor::_applyImageColorSpaceConversion(const std::valarray<double> &inputFrameBuffer, std::valarray<double> &outputFrameBuffer, const double *transformTable)
{
// two step methods in order to allow inputFrame and outputFrame to be the same
- unsigned int nbPixels=inputFrameBuffer.size()/3, dbpixels=2*inputFrameBuffer.size()/3;
+ unsigned int nbPixels=(unsigned int)(inputFrameBuffer.size()/3), dbpixels=(unsigned int)(2*inputFrameBuffer.size()/3);
- const double *inputFrame=&inputFrameBuffer[0];
+ const double *inputFrame=get_data(inputFrameBuffer);
double *outputFrame= &outputFrameBuffer[0];
for (unsigned int dataIndex=0; dataIndex<nbPixels;++dataIndex, ++outputFrame, ++inputFrame)
_setInitPeriodCount();
}
-const bool RetinaFilter::checkInput(const std::valarray<double> &input, const bool colorMode)
+const bool RetinaFilter::checkInput(const std::valarray<double> &input, const bool)
{
BasicRetinaFilter *inputTarget=&_photoreceptorsPrefilter;
RGBimageOutput=_colorEngine.getDemultiplexedColorFrame();
}
-void RetinaFilter::runLMSToneMapping(const std::valarray<double> &LMSimageInput, std::valarray<double> &imageOuput, const bool useAdaptiveFiltering, const double PhotoreceptorsCompression, const double ganglionCellsCompression)
+void RetinaFilter::runLMSToneMapping(const std::valarray<double> &, std::valarray<double> &, const bool, const double, const double)
{
std::cerr<<"not working, sorry"<<std::endl;
void RetinaFilter::_processRetinaParvoMagnoMapping()
{
register double *hybridParvoMagnoPTR= &_retinaParvoMagnoMappedFrame[0];
- register const double *parvoOutputPTR= &(_ParvoRetinaFilter.getOutput()[0]);
- register const double *magnoXOutputPTR= &(_MagnoRetinaFilter.getOutput()[0]);
+ register const double *parvoOutputPTR= get_data(_ParvoRetinaFilter.getOutput());
+ register const double *magnoXOutputPTR= get_data(_MagnoRetinaFilter.getOutput());
register double *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
for (unsigned int i=0 ; i<_photoreceptorsPrefilter.getNBpixels() ; ++i, hybridParvoMagnoCoefTablePTR+=2)
if (parvoFovealResponse.size() != _ParvoRetinaFilter.getNBpixels())
return false;
- register const double *parvoOutputPTR= &(_ParvoRetinaFilter.getOutput()[0]);
+ register const double *parvoOutputPTR= get_data(_ParvoRetinaFilter.getOutput());
register double *fovealParvoResponsePTR= &parvoFovealResponse[0];
register double *hybridParvoMagnoCoefTablePTR= &_retinaParvoMagnoMapCoefTable[0];
if (magnoParafovealResponse.size() != _MagnoRetinaFilter.getNBpixels())
return false;
- register const double *magnoXOutputPTR= &(_MagnoRetinaFilter.getOutput()[0]);
+ register const double *magnoXOutputPTR= get_data(_MagnoRetinaFilter.getOutput());
register double *parafovealMagnoResponsePTR=&magnoParafovealResponse[0];
register double *hybridParvoMagnoCoefTablePTR=&_retinaParvoMagnoMapCoefTable[0]+1;
/**
* @return the numbers of rows (height) of the images used by the object
*/
- inline unsigned int getNBrows(){return _NBrows;};
+ inline unsigned int getNBrows(){return (unsigned int)_NBrows;};
/**
* @return the numbers of columns (width) of the images used by the object
*/
- inline unsigned int getNBcolumns(){return _NBcolumns;};
+ inline unsigned int getNBcolumns(){return (unsigned int)_NBcolumns;};
/**
* @return the numbers of pixels (width*height) of the images used by the object
*/
- inline unsigned int getNBpixels(){return _NBpixels;};
+ inline unsigned int getNBpixels(){return (unsigned int)_NBpixels;};
/**
* @return the numbers of pixels (width*height) of the images used by the object
*/
- inline unsigned int getDoubleNBpixels(){return _doubleNBpixels;};
+ inline unsigned int getDoubleNBpixels(){return (unsigned int)_doubleNBpixels;};
/**
* @return the numbers of depths (3rd dimension: 1 for gray images, 3 for rgb images) of the images used by the object
*/
- inline unsigned int getDepthSize(){return _NBdepths;};
+ inline unsigned int getDepthSize(){return (unsigned int)_NBdepths;};
/**
* resize the buffer and recompute table index etc.
* @param sensitivity: strenght of the sigmoide
* @param maxOutputValue: the maximum output value
*/
- inline void normalizeGrayOutputCentredSigmoide(const type meanValue=(type)0.0, const type sensitivity=(type)2.0, const type maxOutputValue=(type)255.0){normalizeGrayOutputCentredSigmoide(meanValue, sensitivity, 255.0, this->Buffer(), this->Buffer(), this->getNBpixels());};
+ inline void normalizeGrayOutputCentredSigmoide(const type meanValue=(type)0.0, const type sensitivity=(type)2.0, const type maxOutputValue=(type)255.0){normalizeGrayOutputCentredSigmoide(meanValue, sensitivity, 255.0, this->Buffer(), this->Buffer(), this->getNBpixels()), maxOutputValue;};
/**
* sigmoide image normalization function (saturates min and max values), in this function, the sigmoide is centered on low values (high saturation of the medium and high values