Updated retina access methods and OpenEXR image tone mapping demo cleaned
authorAlexandre Benoit <no@email>
Sun, 4 Sep 2011 08:00:28 +0000 (08:00 +0000)
committerAlexandre Benoit <no@email>
Sun, 4 Sep 2011 08:00:28 +0000 (08:00 +0000)
modules/contrib/include/opencv2/contrib/retina.hpp
modules/contrib/src/retina.cpp

index 32eb44e..b7f3fe1 100644 (file)
@@ -189,17 +189,29 @@ public:
 
        /**
         * accessor of the details channel of the retina (models foveal vision)
-        * @param retinaOutput_parvo : the output buffer (reallocated if necessary)
+        * @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 : the output buffer (reallocated if necessary), this output is the original retina filter model output, without any quantification or rescaling
+        */
+       void getParvo(std::valarray<float> &retinaOutput_parvo);
+
+       /**
         * accessor of the motion channel of the retina (models peripheral vision)
-        * @param retinaOutput_magno : the output buffer (reallocated if necessary)
+        * @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 : the output buffer (reallocated if necessary), this output is the original retina filter model output, without any quantification or rescaling
+        */
+       void getMagno(std::valarray<float> &retinaOutput_magno);
+
+       /**
         * 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)
@@ -212,6 +224,18 @@ public:
         */
        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);
+
 protected:
        // Parameteres setup members
        FileStorage _parametersSaveFile; //!< parameters file ... saved on instance delete
index f4aeb6e..954afd0 100644 (file)
@@ -297,6 +297,9 @@ void Retina::getMagno(cv::Mat &retinaOutput_magno)
        //retinaOutput_magno/=255.0;
 }
 
+// original API level data accessors
+void Retina::getMagno(std::valarray<float> &retinaOutput_magno){_retinaFilter->getMovingContours();}
+void Retina::getParvo(std::valarray<float> &retinaOutput_parvo){_retinaFilter->getContours();}
 
 // private method called by constructirs
 void Retina::_init(const std::string parametersSaveFile, const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght)
@@ -312,7 +315,8 @@ void Retina::_init(const std::string parametersSaveFile, const cv::Size inputSiz
        _inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...)
 
        // allocate the retina model
-    delete _retinaFilter;
+        if (_retinaFilter)
+           delete _retinaFilter;
        _retinaFilter = new RetinaFilter(inputSize.height, inputSize.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
 
        // prepare the parameter XML tree
@@ -424,5 +428,9 @@ const bool Retina::_convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert,
 
 void Retina::clearBuffers() {_retinaFilter->clearAllBuffers();}
 
+void Retina::activateMovingContoursProcessing(const bool activate){_retinaFilter->activateMovingContoursProcessing(activate);}
+
+void Retina::activateContoursProcessing(const bool activate){_retinaFilter->activateMovingContoursProcessing(activate);}
+
 } // end of namespace cv