From: alexandre benoit Date: Mon, 29 Apr 2013 17:06:35 +0000 (+0200) Subject: resolved conflicts, updated retina class interface and optimized a heavy retinacolor... X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~1066^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72742f53162cd6aa485f5de43123aed84dc1c702;p=profile%2Fivi%2Fopencv.git resolved conflicts, updated retina class interface and optimized a heavy retinacolor process --- 72742f53162cd6aa485f5de43123aed84dc1c702 diff --cc doc/tutorials/contrib/retina_model/retina_model.rst index 6e54877,184bb34..79376a4 --- a/doc/tutorials/contrib/retina_model/retina_model.rst +++ b/doc/tutorials/contrib/retina_model/retina_model.rst @@@ -228,19 -228,19 +228,18 @@@ Once all input parameters are processed Now, everything is ready to run the retina model. I propose here to allocate a retina instance and to manage the eventual log sampling option. The Retina constructor expects at least a cv::Size object that shows the input data size that will have to be managed. One can activate other options such as color and its related color multiplexing strategy (here Bayer multiplexing is chosen using enum cv::RETINA_COLOR_BAYER). If using log sampling, the image reduction factor (smaller output images) and log sampling strengh can be adjusted. .. code-block:: cpp - + - // pointer to a retina object + // pointer to a retina object cv::Ptr myRetina; // if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision) if (useLogSampling) { - myRetina = new cv::Retina(inputFrame.size(), true, cv::RETINA_COLOR_BAYER, true, 2.0, 10.0); + myRetina = cv::createRetina(inputFrame.size(), true, cv::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - myRetina = new cv::Retina(inputFrame.size()); - + myRetina = cv::createRetina(inputFrame.size()); - Once done, the proposed code writes a default xml file that contains the default parameters of the retina. This is useful to make your own config using this template. Here generated template xml file is called *RetinaDefaultParameters.xml*. .. code-block:: cpp @@@ -323,30 -323,30 +322,29 @@@ Once done open the configuration file * .. code-block:: cpp - - - - 1 - 1 - 7.0e-01 - 5.0e-01 - 5.3e-01 - 0. - 1. - 7. - 7.0e-01 - - 1 - 0. - 0. - 7. - 1.2e+00 - 9.5e-01 - 0. - 7. - - + + + + 1 + 1 + 7.5e-01 + 9.0e-01 + 5.7e-01 + 0.01 + 0.5 + 7. + 7.5e-01 + + 1 + 0. + 0. + 7. + 2.0e+00 + 9.5e-01 + 0. + 7. + - Here are some hints but actually, the best parameter setup depends more on what you want to do with the retina rather than the images input that you give to retina. Apart from the more specific case of High Dynamic Range images (HDR) that require more specific setup for specific luminance compression objective, the retina behaviors should be rather stable from content to content. Note that OpenCV is able to manage such HDR format thanks to the OpenEXR images compatibility. Then, if the application target requires details enhancement prior to specific image processing, you need to know if mean luminance information is required or not. If not, the the retina can cancel or significantly reduce its energy thus giving more visibility to higher spatial frequency details. @@@ -381,7 -381,7 +379,7 @@@ This parameter set tunes the neural net * **horizontalCellsGain** here is a critical parameter ! If you are not interested by the mean luminance and focus on details enhancement, then, set to zero. But if you want to keep some environment luminance data, let some low spatial frequencies pass into the system and set a higher value (<1). - * **hcellsTemporalConstant** similar to photo-receptors, this acts on the temporal constant of a low pass temporal filter that smooths input data. Here, a high value generates a high retina after effect while a lower value makes the retina more reactive. this value should be lower than **photoreceptorsTemporalConstant** to limit strong retina after effects. -* **hcellsTemporalConstant** similar to photo-receptors, this acts on the temporal constant of a low pass temporal filter that smooths input data. Here, a high value generates a high retina after effect while a lower value makes the retina more reactive. ++* **hcellsTemporalConstant** similar to photo-receptors, this acts on the temporal constant of a low pass temporal filter that smooths input data. Here, a high value generates a high retina after effect while a lower value makes the retina more reactive. This value should be lower than **photoreceptorsTemporalConstant** to limit strong retina after effects. * **hcellsSpatialConstant** is the spatial constant of the low pass filter of these cells filter. It specifies the lowest spatial frequency allowed in the following. Visually, a high value leads to very low spatial frequencies processing and leads to salient halo effects. Lower values reduce this effect but the limit is : do not go lower than the value of **photoreceptorsSpatialConstant**. Those 2 parameters actually specify the spatial band-pass of the retina. @@@ -405,12 -405,10 +403,11 @@@ Once image information is cleaned, thi * **parasolCells_k** the spatial constant of the spatial filtering effect, set it at a high value to favor low spatial frequency signals that are lower subject to residual noise. - * **amacrinCellsTemporalCutFrequency** specifies the temporal constant of the high pass filter. High values let slow transient events to be selected. -* **amacrinCellsTemporalCutFrequency** specifies the temporal constant of the high pass filter. High values let slow transient events to be selected. ++* **amacrinCellsTemporalCutFrequency** specifies the temporal constant of the high pass filter. High values let slow transient events to be selected. * **V0CompressionParameter** specifies the strength of the log compression. Similar behaviors to previous description but here it enforces sensitivity of transient events. * **localAdaptintegration_tau** generally set to 0, no real use here actually * **localAdaptintegration_k** specifies the size of the area on which local adaptation is performed. Low values lead to short range local adaptation (higher sensitivity to noise), high values secure log compression. + - diff --cc modules/contrib/doc/retina/index.rst index cacc384,0cd8752..a7f2244 --- a/modules/contrib/doc/retina/index.rst +++ b/modules/contrib/doc/retina/index.rst @@@ -45,11 -45,11 +45,11 @@@ The retina can be settled up with vario void clearBuffers (); // retreive input and output buffers sizes - Size inputSize (); - Size outputSize (); + Size getInputSize (); + Size getOutputSize (); // setup methods with specific parameters specification of global xml config file loading/write - void setup (std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); + void setup (String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true); void setup (RetinaParameters newParameters); struct Retina::RetinaParameters getParameters (); diff --cc modules/contrib/include/opencv2/contrib/retina.hpp index 4dd9075,32ba1cf..75d4eff --- a/modules/contrib/include/opencv2/contrib/retina.hpp +++ b/modules/contrib/include/opencv2/contrib/retina.hpp @@@ -85,10 -85,10 +85,8 @@@ enum RETINA_COLORSAMPLINGMETHO RETINA_COLOR_BAYER//!< standard bayer sampling }; --class RetinaFilter; -- /** -- * @class Retina a wrapper class which allows the Gipsa/Listic Labs model to be used. ++ * @class Retina a wrapper class which allows the Gipsa/Listic Labs model to be used with OpenCV. * This retina model allows spatio-temporal image processing (applied on still images, video sequences). * As a summary, these are the retina model properties: * => It applies a spectral whithening (mid-frequency details enhancement) @@@ -163,17 -182,17 +161,16 @@@ public * @param retinaParameterFile : the parameters filename * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error */ - virtual void setup(std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true)=0; - void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); -- ++ virtual void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true)=0; /** * try to open an XML retina parameters file to adjust current retina instance setup * => if the xml file does not exist, then default setup is applied * => warning, Exceptions are thrown if read XML file is not valid * @param fs : the open Filestorage which contains retina parameters - * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error + * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error */ - void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true); + virtual void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true)=0; /** * try to open an XML retina parameters file to adjust current retina instance setup @@@ -193,14 -212,14 +190,13 @@@ * parameters setup display method * @return a string which contains formatted parameters information */ - virtual const std::string printSetup()=0; - const String printSetup(); ++ virtual const String printSetup()=0; /** * write xml/yml formated parameters information * @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information */ - virtual void write( std::string fs ) const=0; - virtual void write( String fs ) const; -- ++ virtual void write( String fs ) const=0; /** * write xml/yml formated parameters information diff --cc modules/contrib/src/retina.cpp index 7a5f6df,5175480..b0af7d7 --- a/modules/contrib/src/retina.cpp +++ b/modules/contrib/src/retina.cpp @@@ -75,219 -76,7 +76,219 @@@ namespace cv { -Retina::Retina(const cv::Size inputSz) +class RetinaImpl : public Retina +{ +public: + /** + * Main constructor with most commun use setup : create an instance of color ready retina model + * @param inputSize : the input frame size + */ + RetinaImpl(Size inputSize); + + /** + * Complete Retina filter constructor which allows all basic structural parameters definition + * @param inputSize : the input frame size + * @param colorMode : the chosen processing mode : with or without color processing + * @param colorSamplingMethod: specifies which kind of color sampling will be used + * @param useRetinaLogSampling: activate retina log sampling, if true, the 2 following parameters can be used + * @param reductionFactor: only usefull if param useRetinaLogSampling=true, specifies the reduction factor of the output frame (as the center (fovea) is high resolution and corners can be underscaled, then a reduction of the output is allowed without precision leak + * @param samplingStrenght: only usefull if param useRetinaLogSampling=true, specifies the strenght of the log scale that is applied + */ + RetinaImpl(Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); + + virtual ~RetinaImpl(); + /** + * retreive retina input buffer size + */ + Size getInputSize(); + + /** + * retreive retina output buffer size + */ + Size getOutputSize(); + + /** + * try to open an XML retina parameters file to adjust current retina instance setup + * => if the xml file does not exist, then default setup is applied + * => warning, Exceptions are thrown if read XML file is not valid + * @param retinaParameterFile : the parameters filename + * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error + */ - void setup(std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); ++ void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); + + + /** + * try to open an XML retina parameters file to adjust current retina instance setup + * => if the xml file does not exist, then default setup is applied + * => warning, Exceptions are thrown if read XML file is not valid + * @param fs : the open Filestorage which contains retina parameters + * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error + */ + void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true); + + /** + * try to open an XML retina parameters file to adjust current retina instance setup + * => if the xml file does not exist, then default setup is applied + * => warning, Exceptions are thrown if read XML file is not valid + * @param newParameters : a parameters structures updated with the new target configuration + * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error + */ + void setup(Retina::RetinaParameters newParameters); + + /** + * @return the current parameters setup + */ + struct Retina::RetinaParameters getParameters(); + + /** + * parameters setup display method + * @return a string which contains formatted parameters information + */ - const std::string printSetup(); ++ const String printSetup(); + + /** + * write xml/yml formated parameters information + * @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information + */ - virtual void write( std::string fs ) const; ++ virtual void write( String fs ) const; + + + /** + * write xml/yml formated parameters information + * @param fs : a cv::Filestorage object ready to be filled + */ + virtual void write( FileStorage& fs ) const; + + /** + * setup the OPL and IPL parvo channels (see biologocal model) + * OPL is referred as Outer Plexiform Layer of the retina, it allows the spatio-temporal filtering which withens the spectrum and reduces spatio-temporal noise while attenuating global luminance (low frequency energy) + * IPL parvo is the OPL next processing stage, it refers to Inner Plexiform layer of the retina, it allows high contours sensitivity in foveal vision. + * for more informations, please have a look at the paper Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011 + * @param colorMode : specifies if (true) color is processed of not (false) to then processing gray level image + * @param normaliseOutput : specifies if (true) output is rescaled between 0 and 255 of not (false) + * @param photoreceptorsLocalAdaptationSensitivity: the photoreceptors sensitivity renage is 0-1 (more log compression effect when value increases) + * @param photoreceptorsTemporalConstant: the time constant of the first order low pass filter of the photoreceptors, use it to cut high temporal frequencies (noise or fast motion), unit is frames, typical value is 1 frame + * @param photoreceptorsSpatialConstant: the spatial constant of the first order low pass filter of the photoreceptors, use it to cut high spatial frequencies (noise or thick contours), unit is pixels, typical value is 1 pixel + * @param horizontalCellsGain: gain of the horizontal cells network, if 0, then the mean value of the output is zero, if the parameter is near 1, then, the luminance is not filtered and is still reachable at the output, typicall value is 0 + * @param HcellsTemporalConstant: the time constant of the first order low pass filter of the horizontal cells, use it to cut low temporal frequencies (local luminance variations), unit is frames, typical value is 1 frame, as the photoreceptors + * @param HcellsSpatialConstant: the spatial constant of the first order low pass filter of the horizontal cells, use it to cut low spatial frequencies (local luminance), unit is pixels, typical value is 5 pixel, this value is also used for local contrast computing when computing the local contrast adaptation at the ganglion cells level (Inner Plexiform Layer parvocellular channel model) + * @param ganglionCellsSensitivity: the compression strengh of the ganglion cells local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 230 + */ + void setupOPLandIPLParvoChannel(const bool colorMode=true, const bool normaliseOutput = true, const float photoreceptorsLocalAdaptationSensitivity=0.7, const float photoreceptorsTemporalConstant=0.5, const float photoreceptorsSpatialConstant=0.53, const float horizontalCellsGain=0, const float HcellsTemporalConstant=1, const float HcellsSpatialConstant=7, const float ganglionCellsSensitivity=0.7); + + /** + * set parameters values for the Inner Plexiform Layer (IPL) magnocellular channel + * this channel processes signals outpint from OPL processing stage in peripheral vision, it allows motion information enhancement. It is decorrelated from the details channel. See reference paper for more details. + * @param normaliseOutput : specifies if (true) output is rescaled between 0 and 255 of not (false) + * @param parasolCells_beta: the low pass filter gain used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), typical value is 0 + * @param parasolCells_tau: the low pass filter time constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is frame, typical value is 0 (immediate response) + * @param parasolCells_k: the low pass filter spatial constant used for local contrast adaptation at the IPL level of the retina (for ganglion cells local adaptation), unit is pixels, typical value is 5 + * @param amacrinCellsTemporalCutFrequency: the time constant of the first order high pass fiter of the magnocellular way (motion information channel), unit is frames, tipicall value is 5 + * @param V0CompressionParameter: the compression strengh of the ganglion cells local adaptation output, set a value between 160 and 250 for best results, a high value increases more the low value sensitivity... and the output saturates faster, recommended value: 200 + * @param localAdaptintegration_tau: specifies the temporal constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation + * @param localAdaptintegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation + */ + void setupIPLMagnoChannel(const bool normaliseOutput = true, const float parasolCells_beta=0, const float parasolCells_tau=0, const float parasolCells_k=7, const float amacrinCellsTemporalCutFrequency=1.2, const float V0CompressionParameter=0.95, const float localAdaptintegration_tau=0, const float localAdaptintegration_k=7); + + /** + * method which allows retina to be applied on an input image, after run, encapsulated retina module is ready to deliver its outputs using dedicated acccessors, see getParvo and getMagno methods + * @param inputImage : the input cv::Mat image to be processed, can be gray level or BGR coded in any format (from 8bit to 16bits) + */ + void run(const Mat &inputImage); + + /** + * accessor of the details channel of the retina (models foveal vision) + * @param retinaOutput_parvo : the output buffer (reallocated if necessary), this output is rescaled for standard 8bits image processing use in OpenCV + */ + void getParvo(Mat &retinaOutput_parvo); + + /** + * accessor of the details channel of the retina (models foveal vision) + * @param retinaOutput_parvo : a cv::Mat header filled with the internal parvo buffer of the retina module. This output is the original retina filter model output, without any quantification or rescaling + */ + void getParvoRAW(Mat &retinaOutput_parvo); + + /** + * accessor of the motion channel of the retina (models peripheral vision) + * @param retinaOutput_magno : the output buffer (reallocated if necessary), this output is rescaled for standard 8bits image processing use in OpenCV + */ + void getMagno(Mat &retinaOutput_magno); + + /** + * accessor of the motion channel of the retina (models peripheral vision) + * @param retinaOutput_magno : a cv::Mat header filled with the internal retina magno buffer of the retina module. This output is the original retina filter model output, without any quantification or rescaling + */ + void getMagnoRAW(Mat &retinaOutput_magno); + + // original API level data accessors : get buffers addresses from a Mat header, similar to getParvoRAW and getMagnoRAW... + const Mat getMagnoRAW() const; + const Mat getParvoRAW() const; + + /** + * activate color saturation as the final step of the color demultiplexing process + * -> this saturation is a sigmoide function applied to each channel of the demultiplexed image. + * @param saturateColors: boolean that activates color saturation (if true) or desactivate (if false) + * @param colorSaturationValue: the saturation factor + */ + void setColorSaturation(const bool saturateColors=true, const float colorSaturationValue=4.0); + + /** + * clear all retina buffers (equivalent to opening the eyes after a long period of eye close ;o) + */ + void clearBuffers(); + + /** + * Activate/desactivate the Magnocellular pathway processing (motion information extraction), by default, it is activated + * @param activate: true if Magnocellular output should be activated, false if not + */ + void activateMovingContoursProcessing(const bool activate); + + /** + * Activate/desactivate the Parvocellular pathway processing (contours information extraction), by default, it is activated + * @param activate: true if Parvocellular (contours information extraction) output should be activated, false if not + */ + void activateContoursProcessing(const bool activate); +private: + + // Parameteres setup members + RetinaParameters _retinaParameters; // structure of parameters + + // Retina model related modules + std::valarray _inputBuffer; //!< buffer used to convert input cv::Mat to internal retina buffers format (valarrays) + + // pointer to retina model + RetinaFilter* _retinaFilter; //!< the pointer to the retina module, allocated with instance construction + + /** + * exports a valarray buffer outing from HVStools objects to a cv::Mat in CV_8UC1 (gray level picture) or CV_8UC3 (color) format + * @param grayMatrixToConvert the valarray to export to OpenCV + * @param nbRows : the number of rows of the valarray flatten matrix + * @param nbColumns : the number of rows of the valarray flatten matrix + * @param colorMode : a flag which mentions if matrix is color (true) or graylevel (false) + * @param outBuffer : the output matrix which is reallocated to satisfy Retina output buffer dimensions + */ + void _convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, Mat &outBuffer); + + /** + * + * @param inputMatToConvert : the OpenCV cv::Mat that has to be converted to gray or RGB valarray buffer that will be processed by the retina model + * @param outputValarrayMatrix : the output valarray + * @return the input image color mode (color=true, gray levels=false) + */ + bool _convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert, std::valarray &outputValarrayMatrix); + + //! private method called by constructors, gathers their parameters and use them in a unified way + void _init(const Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); + + +}; + +// smart pointers allocation : +Ptr createRetina(Size inputSize){ return new RetinaImpl(inputSize); } +Ptr createRetina(Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght){return new RetinaImpl(inputSize, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);} + +// RetinaImpl code +RetinaImpl::RetinaImpl(const cv::Size inputSz) { _retinaFilter = 0; _init(inputSz, true, RETINA_COLOR_BAYER, false); @@@ -321,10 -110,10 +322,9 @@@ void RetinaImpl::setColorSaturation(con _retinaFilter->setColorSaturation(saturateColors, colorSaturationValue); } -struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;} - +struct Retina::RetinaParameters RetinaImpl::getParameters(){return _retinaParameters;} - - void RetinaImpl::setup(std::string retinaParameterFile, const bool applyDefaultSetupOnFailure) -void Retina::setup(String retinaParameterFile, const bool applyDefaultSetupOnFailure) ++void RetinaImpl::setup(String retinaParameterFile, const bool applyDefaultSetupOnFailure) { try { @@@ -386,7 -176,7 +387,7 @@@ void RetinaImpl::setup(cv::FileStorage }catch(Exception &e) { - std::cout<<"RetinaImpl::setup: resetting retina with default parameters"< normaliseOutput : " << _retinaParameters.IplMagno.normaliseOutput - << "\n==> parasolCells_beta : " << _retinaParameters.IplMagno.parasolCells_beta - << "\n==> parasolCells_tau : " << _retinaParameters.IplMagno.parasolCells_tau - << "\n==> parasolCells_k : " << _retinaParameters.IplMagno.parasolCells_k - << "\n==> amacrinCellsTemporalCutFrequency : " << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency - << "\n==> V0CompressionParameter : " << _retinaParameters.IplMagno.V0CompressionParameter - << "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau - << "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k + << "\n\t normaliseOutput : " << _retinaParameters.IplMagno.normaliseOutput + << "\n\t parasolCells_beta : " << _retinaParameters.IplMagno.parasolCells_beta + << "\n\t parasolCells_tau : " << _retinaParameters.IplMagno.parasolCells_tau + << "\n\t parasolCells_k : " << _retinaParameters.IplMagno.parasolCells_k + << "\n\t amacrinCellsTemporalCutFrequency : " << _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency + << "\n\t V0CompressionParameter : " << _retinaParameters.IplMagno.V0CompressionParameter + << "\n\t localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau + << "\n\t localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k <<"}"; - return outmessage.str(); + return outmessage.str().c_str(); } - void RetinaImpl::write( std::string fs ) const -void Retina::write( String fs ) const ++void RetinaImpl::write( String fs ) const { FileStorage parametersSaveFile(fs, cv::FileStorage::WRITE ); write(parametersSaveFile); @@@ -602,10 -366,10 +603,10 @@@ void RetinaImpl::_init(const cv::Size i _retinaFilter->clearAllBuffers(); // report current configuration - std::cout< &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer) +void RetinaImpl::_convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer) { // fill output buffer with the valarray buffer const float *valarrayPTR=get_data(grayMatrixToConvert); diff --cc samples/cpp/tutorial_code/contrib/retina_tutorial.cpp index 2447a16,4d06eb5..3621f18 --- a/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp +++ b/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp @@@ -99,10 -100,10 +100,12 @@@ int main(int argc, char* argv[]) // if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision) if (useLogSampling) { - myRetina = cv::createRetina(inputFrame.size(), true, cv::RETINA_COLOR_BAYER, true, 2.0, 10.0); - myRetina = new cv::Retina(inputFrame.size(), true, cv::RETINA_COLOR_BAYER, true, 2.0, 10.0); ++ myRetina = cv::createRetina(inputFrame.size(), true, cv::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - myRetina = new cv::Retina(inputFrame.size()); ++ { + myRetina = cv::createRetina(inputFrame.size()); ++ } // save default retina parameters file in order to let you see this and maybe modify it and reload using method "setup" myRetina->write("RetinaDefaultParameters.xml");