From 7fe78efda341319cca7204383e43999f57b30a60 Mon Sep 17 00:00:00 2001 From: alexandre benoit Date: Sun, 14 Jul 2013 19:28:37 +0200 Subject: [PATCH] retina included in namespace bioinspired + followed suggestions made by Vadim --- .../bioinspired/retina_model/retina_model.rst | 12 ++- .../retina_model/retina_model.rst~ | 18 ++-- modules/bioinspired/doc/retina/index.rst | 6 +- .../include/opencv2/bioinspired.hpp | 1 - .../include/opencv2/bioinspired/retina.hpp | 31 ++---- .../bioinspired/retinafasttonemapping.hpp | 7 +- modules/bioinspired/src/basicretinafilter.cpp | 8 +- modules/bioinspired/src/basicretinafilter.hpp | 8 +- .../bioinspired/src/imagelogpolprojection.cpp | 8 +- .../bioinspired/src/imagelogpolprojection.hpp | 8 +- modules/bioinspired/src/magnoretinafilter.cpp | 8 +- modules/bioinspired/src/magnoretinafilter.hpp | 8 +- modules/bioinspired/src/parvoretinafilter.cpp | 8 +- modules/bioinspired/src/parvoretinafilter.hpp | 8 +- modules/bioinspired/src/precomp.hpp | 2 +- modules/bioinspired/src/retina.cpp | 41 +++++-- modules/bioinspired/src/retinacolor.cpp | 10 +- modules/bioinspired/src/retinacolor.hpp | 12 +-- .../bioinspired/src/retinafasttonemapping.cpp | 102 +++++++++++++++++- modules/bioinspired/src/retinafilter.cpp | 10 +- modules/bioinspired/src/retinafilter.hpp | 10 +- modules/bioinspired/src/templatebuffer.hpp | 8 +- ...es_HighDynamicRange_Retina_toneMapping.cpp | 6 +- ...hDynamicRange_Retina_toneMapping_video.cpp | 6 +- samples/cpp/retinaDemo.cpp | 6 +- .../bioinspired/retina_tutorial.cpp | 6 +- 26 files changed, 229 insertions(+), 129 deletions(-) diff --git a/doc/tutorials/bioinspired/retina_model/retina_model.rst b/doc/tutorials/bioinspired/retina_model/retina_model.rst index 4f96a9ae1..32081dfd2 100644 --- a/doc/tutorials/bioinspired/retina_model/retina_model.rst +++ b/doc/tutorials/bioinspired/retina_model/retina_model.rst @@ -109,6 +109,8 @@ Code tutorial Please refer to the original tutorial source code in file *opencv_folder/samples/cpp/tutorial_code/bioinspired/retina_tutorial.cpp*. +**Note :** do not forget that the retina model is included in the following namespace : *cv::bioinspired*. + To compile it, assuming OpenCV is correctly installed, use the following command. It requires the opencv_core *(cv::Mat and friends objects management)*, opencv_highgui *(display and image/video read)* and opencv_bioinspired *(Retina description)* libraries to compile. .. code-block:: cpp @@ -128,7 +130,7 @@ To compile it, assuming OpenCV is correctly installed, use the following command Here is a code explanation : -Retina definition is present in the bioinspired package and a simple include allows to use it +Retina definition is present in the bioinspired package and a simple include allows to use it. You can rather use the specific header : *opencv2/bioinspired.hpp* if you prefer but then include the other required openv modules : *opencv2/core.hpp* and *opencv2/highgui.hpp* .. code-block:: cpp @@ -229,20 +231,20 @@ Once all input parameters are processed, a first image should have been loaded, return -1; } -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. +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::bioinspired::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 - cv::Ptr myRetina; + cv::Ptr myRetina; // if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision) if (useLogSampling) { - myRetina = createRetina(inputFrame.size(), true, RETINA_COLOR_BAYER, true, 2.0, 10.0); + myRetina = cv::bioinspired::createRetina(inputFrame.size(), true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - myRetina = createRetina(inputFrame.size()); + myRetina = cv::bioinspired::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*. diff --git a/doc/tutorials/bioinspired/retina_model/retina_model.rst~ b/doc/tutorials/bioinspired/retina_model/retina_model.rst~ index 86e13e732..50bdcbb62 100644 --- a/doc/tutorials/bioinspired/retina_model/retina_model.rst~ +++ b/doc/tutorials/bioinspired/retina_model/retina_model.rst~ @@ -107,14 +107,16 @@ This retina filter code includes the research contributions of phd/research coll Code tutorial ============= -Please refer to the original tutorial source code in file *opencv_folder/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp*. +Please refer to the original tutorial source code in file *opencv_folder/samples/cpp/tutorial_code/bioinspired/retina_tutorial.cpp*. -To compile it, assuming OpenCV is correctly installed, use the following command. It requires the opencv_core *(cv::Mat and friends objects management)*, opencv_highgui *(display and image/video read)* and opencv_contrib *(Retina description)* libraries to compile. +**Note :** do not forget that the retina model is included in the following namespace : *cv::bioinspired*. + +To compile it, assuming OpenCV is correctly installed, use the following command. It requires the opencv_core *(cv::Mat and friends objects management)*, opencv_highgui *(display and image/video read)* and opencv_bioinspired *(Retina description)* libraries to compile. .. code-block:: cpp // compile - gcc retina_tutorial.cpp -o Retina_tuto -lopencv_core -lopencv_highgui -lopencv_contrib + gcc retina_tutorial.cpp -o Retina_tuto -lopencv_core -lopencv_highgui -lopencv_bioinspired // Run commands : add 'log' as a last parameter to apply a spatial log sampling (simulates retina sampling) // run on webcam @@ -128,7 +130,7 @@ To compile it, assuming OpenCV is correctly installed, use the following command Here is a code explanation : -Retina definition is present in the contrib package and a simple include allows to use it +Retina definition is present in the bioinspired package and a simple include allows to use it. You can rather use the specific header : *opencv2/bioinspired.hpp* if you prefer but then include the other required openv modules : *opencv2/core.hpp* and *opencv2/highgui.hpp* .. code-block:: cpp @@ -229,20 +231,20 @@ Once all input parameters are processed, a first image should have been loaded, return -1; } -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. +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::bioinspired::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 - cv::Ptr myRetina; + cv::Ptr myRetina; // 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 = cv::bioinspired::createRetina(inputFrame.size(), true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - myRetina = cv::createRetina(inputFrame.size()); + myRetina = cv::bioinspired::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*. diff --git a/modules/bioinspired/doc/retina/index.rst b/modules/bioinspired/doc/retina/index.rst index d81afc6bc..fb36d5a73 100644 --- a/modules/bioinspired/doc/retina/index.rst +++ b/modules/bioinspired/doc/retina/index.rst @@ -7,6 +7,8 @@ Retina ====== .. ocv:class:: Retina : public Algorithm +**Note** : do not forget that the retina model is included in the following namespace : *cv::bioinspired*. + Introduction ++++++++++++ @@ -55,6 +57,8 @@ As observed in this preliminary demo, the retina can be settled up with various Here is an overview of the abstract Retina interface, allocate one instance with the *createRetina* functions.:: + namespace cv{namespace bioinspired{ + class Retina : public Algorithm { public: @@ -102,7 +106,7 @@ Here is an overview of the abstract Retina interface, allocate one instance with // Allocators cv::Ptr createRetina (Size inputSize); cv::Ptr createRetina (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); - + }} // cv and bioinspired namespaces end Description +++++++++++ diff --git a/modules/bioinspired/include/opencv2/bioinspired.hpp b/modules/bioinspired/include/opencv2/bioinspired.hpp index 882331b3f..5f2f8644d 100644 --- a/modules/bioinspired/include/opencv2/bioinspired.hpp +++ b/modules/bioinspired/include/opencv2/bioinspired.hpp @@ -47,5 +47,4 @@ #include "opencv2/bioinspired/retina.hpp" #include "opencv2/bioinspired/retinafasttonemapping.hpp" -using namespace cv::hvstools; // used to avoid complex namespace inclusions cv::hvstools::Retina => cv::Retina preferred #endif diff --git a/modules/bioinspired/include/opencv2/bioinspired/retina.hpp b/modules/bioinspired/include/opencv2/bioinspired/retina.hpp index e0620efc3..4b4c19f90 100644 --- a/modules/bioinspired/include/opencv2/bioinspired/retina.hpp +++ b/modules/bioinspired/include/opencv2/bioinspired/retina.hpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** - ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. + ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** - ** For Human Visual System tools (hvstools) + ** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -73,13 +73,12 @@ */ #include "opencv2/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support -#include + namespace cv{ -namespace hvstools{ +namespace bioinspired{ -enum RETINA_COLORSAMPLINGMETHOD -{ +enum { RETINA_COLOR_RANDOM, //!< each pixel position is either R, G or B in a random choice RETINA_COLOR_DIAGONAL,//!< color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR... RETINA_COLOR_BAYER//!< standard bayer sampling @@ -303,27 +302,9 @@ public: virtual void activateContoursProcessing(const bool activate)=0; }; CV_EXPORTS Ptr createRetina(Size inputSize); -CV_EXPORTS Ptr createRetina(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); +CV_EXPORTS Ptr createRetina(Size inputSize, const bool colorMode, int colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); - /** - * 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, OutputArray outBuffer); - - /** - * convert a cv::Mat to a valarray buffer in float format - * @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(InputArray inputMatToConvert, std::valarray &outputValarrayMatrix); - } } #endif /* __OPENCV_BIOINSPIRED_RETINA_HPP__ */ diff --git a/modules/bioinspired/include/opencv2/bioinspired/retinafasttonemapping.hpp b/modules/bioinspired/include/opencv2/bioinspired/retinafasttonemapping.hpp index 62c88bd6e..6c83f885c 100644 --- a/modules/bioinspired/include/opencv2/bioinspired/retinafasttonemapping.hpp +++ b/modules/bioinspired/include/opencv2/bioinspired/retinafasttonemapping.hpp @@ -7,7 +7,7 @@ ** copy or use the software. ** ** - ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. + ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) ** @@ -34,7 +34,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** - ** For Human Visual System tools (hvstools) + ** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -75,10 +75,9 @@ */ #include "opencv2/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support -#include namespace cv{ -namespace hvstools{ +namespace bioinspired{ /** * @class RetinaFastToneMappingImpl a wrapper class which allows the tone mapping algorithm of Meylan&al(2007) to be used with OpenCV. diff --git a/modules/bioinspired/src/basicretinafilter.cpp b/modules/bioinspired/src/basicretinafilter.cpp index 57f5c439e..7e7b467fa 100644 --- a/modules/bioinspired/src/basicretinafilter.cpp +++ b/modules/bioinspired/src/basicretinafilter.cpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -72,7 +72,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { // @author Alexandre BENOIT, benoit.alexandre.vision@gmail.com, LISTIC : www.listic.univ-savoie.fr Gipsa-Lab, France: www.gipsa-lab.inpg.fr/ @@ -884,5 +884,5 @@ void BasicRetinaFilter::_verticalAnticausalFilter_Irregular_multGain(float *outp } } -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv diff --git a/modules/bioinspired/src/basicretinafilter.hpp b/modules/bioinspired/src/basicretinafilter.hpp index ac779cf2d..323bff940 100644 --- a/modules/bioinspired/src/basicretinafilter.hpp +++ b/modules/bioinspired/src/basicretinafilter.hpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -114,7 +114,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { class BasicRetinaFilter { @@ -652,6 +652,6 @@ namespace hvstools }; -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv #endif diff --git a/modules/bioinspired/src/imagelogpolprojection.cpp b/modules/bioinspired/src/imagelogpolprojection.cpp index 4fa9802de..0a4c1ed0d 100644 --- a/modules/bioinspired/src/imagelogpolprojection.cpp +++ b/modules/bioinspired/src/imagelogpolprojection.cpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -72,7 +72,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { // constructor ImageLogPolProjection::ImageLogPolProjection(const unsigned int nbRows, const unsigned int nbColumns, const PROJECTIONTYPE projection, const bool colorModeCapable) @@ -447,5 +447,5 @@ std::valarray &ImageLogPolProjection::runProjection(const std::valarray &MagnoRetinaFilter::runFilter(const std::valarray namespace cv { diff --git a/modules/bioinspired/src/retina.cpp b/modules/bioinspired/src/retina.cpp index bb51e7567..2ec7286bc 100644 --- a/modules/bioinspired/src/retina.cpp +++ b/modules/bioinspired/src/retina.cpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** - ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. + ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** - ** For Human Visual System tools (hvstools) + ** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -72,10 +72,11 @@ #include "retinafilter.hpp" #include #include +#include namespace cv { -namespace hvstools +namespace bioinspired { class RetinaImpl : public Retina @@ -96,7 +97,7 @@ public: * @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); + RetinaImpl(Size inputSize, const bool colorMode, int colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); virtual ~RetinaImpl(); /** @@ -270,14 +271,32 @@ private: RetinaFilter* _retinaFilter; //!< the pointer to the retina module, allocated with instance construction //! 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); + void _init(const Size inputSize, const bool colorMode, int colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); + + /** + * exports a valarray buffer outing from bioinspired 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, OutputArray outBuffer); + + /** + * convert a cv::Mat to a valarray buffer in float format + * @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(InputArray inputMatToConvert, std::valarray &outputValarrayMatrix); }; // 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);} +Ptr createRetina(Size inputSize, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght){return new RetinaImpl(inputSize, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);} // RetinaImpl code @@ -287,7 +306,7 @@ RetinaImpl::RetinaImpl(const cv::Size inputSz) _init(inputSz, true, RETINA_COLOR_BAYER, false); } -RetinaImpl::RetinaImpl(const cv::Size inputSz, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) +RetinaImpl::RetinaImpl(const cv::Size inputSz, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) { _retinaFilter = 0; _init(inputSz, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght); @@ -594,7 +613,7 @@ const Mat RetinaImpl::getParvoRAW() const { } // private method called by constructirs -void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) +void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) { // basic error check if (inputSz.height*inputSz.width <= 0) @@ -619,7 +638,7 @@ void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, RETINA_COLO printf("%s\n", printSetup().c_str()); } -void _convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, OutputArray outBuffer) +void RetinaImpl::_convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, OutputArray outBuffer) { // fill output buffer with the valarray buffer const float *valarrayPTR=get_data(grayMatrixToConvert); @@ -657,7 +676,7 @@ void _convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConver } } -bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray &outputValarrayMatrix) +bool RetinaImpl::_convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray &outputValarrayMatrix) { const Mat inputMatToConvert=inputMat.getMat(); // first check input consistency @@ -717,5 +736,5 @@ void RetinaImpl::activateMovingContoursProcessing(const bool activate){_retinaFi void RetinaImpl::activateContoursProcessing(const bool activate){_retinaFilter->activateContoursProcessing(activate);} -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv diff --git a/modules/bioinspired/src/retinacolor.cpp b/modules/bioinspired/src/retinacolor.cpp index 1498e36ab..3fbc55385 100644 --- a/modules/bioinspired/src/retinacolor.cpp +++ b/modules/bioinspired/src/retinacolor.cpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -73,7 +73,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { // init static values static float _LMStoACr1Cr2[]={1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -0.5, -0.5, 1.0}; @@ -81,7 +81,7 @@ static float _LMStoACr1Cr2[]={1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -0.5, -0.5, 1.0} static float _LMStoLab[]={0.5774f, 0.5774f, 0.5774f, 0.4082f, 0.4082f, -0.8165f, 0.7071f, -0.7071f, 0.f}; // constructor/desctructor -RetinaColor::RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns, const RETINA_COLORSAMPLINGMETHOD samplingMethod) +RetinaColor::RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns, const int samplingMethod) :BasicRetinaFilter(NBrows, NBcolumns, 3), _colorSampling(NBrows*NBcolumns), _RGBmosaic(NBrows*NBcolumns*3), @@ -721,5 +721,5 @@ void RetinaColor::_applyImageColorSpaceConversion(const std::valarray &in } } -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv diff --git a/modules/bioinspired/src/retinacolor.hpp b/modules/bioinspired/src/retinacolor.hpp index 4e0139ade..3fb6be8f9 100644 --- a/modules/bioinspired/src/retinacolor.hpp +++ b/modules/bioinspired/src/retinacolor.hpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -85,7 +85,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { class RetinaColor: public BasicRetinaFilter { @@ -100,7 +100,7 @@ namespace hvstools * @param NBcolumns: number of columns of the input image * @param samplingMethod: the chosen color sampling method */ - RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns, const RETINA_COLORSAMPLINGMETHOD samplingMethod=RETINA_COLOR_BAYER); + RetinaColor(const unsigned int NBrows, const unsigned int NBcolumns, const int samplingMethod=RETINA_COLOR_BAYER); /** * standard destructor @@ -220,7 +220,7 @@ namespace hvstools protected: // private functions - RETINA_COLORSAMPLINGMETHOD _samplingMethod; + int _samplingMethod; bool _saturateColors; float _colorSaturationValue; // links to parent buffers (more convienient names @@ -383,7 +383,7 @@ namespace hvstools #endif }; -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv #endif /*RETINACOLOR_HPP_*/ diff --git a/modules/bioinspired/src/retinafasttonemapping.cpp b/modules/bioinspired/src/retinafasttonemapping.cpp index d72ae2fe7..468bedb9a 100644 --- a/modules/bioinspired/src/retinafasttonemapping.cpp +++ b/modules/bioinspired/src/retinafasttonemapping.cpp @@ -7,7 +7,7 @@ ** copy or use the software. ** ** - ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. + ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) ** @@ -31,7 +31,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** - ** For Human Visual System tools (hvstools) + ** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -77,7 +77,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { /** * @class RetinaFastToneMappingImpl a wrapper class which allows the tone mapping algorithm of Meylan&al(2007) to be used with OpenCV. @@ -176,6 +176,100 @@ private: std::valarray _temp2; float _meanLuminanceModulatorK; + +void _convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, OutputArray outBuffer) +{ + // fill output buffer with the valarray buffer + const float *valarrayPTR=get_data(grayMatrixToConvert); + if (!colorMode) + { + outBuffer.create(cv::Size(nbColumns, nbRows), CV_8U); + Mat outMat = outBuffer.getMat(); + for (unsigned int i=0;i(pixel)=(unsigned char)*(valarrayPTR++); + } + } + }else + { + const unsigned int nbPixels=nbColumns*nbRows; + const unsigned int doubleNBpixels=nbColumns*nbRows*2; + outBuffer.create(cv::Size(nbColumns, nbRows), CV_8UC3); + Mat outMat = outBuffer.getMat(); + for (unsigned int i=0;i(pixel)=pixelValues; + } + } + } +} + +bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray &outputValarrayMatrix) +{ + const Mat inputMatToConvert=inputMat.getMat(); + // first check input consistency + if (inputMatToConvert.empty()) + throw cv::Exception(-1, "RetinaImpl cannot be applied, input buffer is empty", "RetinaImpl::run", "RetinaImpl.h", 0); + + // retreive color mode from image input + int imageNumberOfChannels = inputMatToConvert.channels(); + + // convert to float AND fill the valarray buffer + typedef float T; // define here the target pixel format, here, float + const int dsttype = DataType::depth; // output buffer is float format + + const unsigned int nbPixels=inputMat.getMat().rows*inputMat.getMat().cols; + const unsigned int doubleNBpixels=inputMat.getMat().rows*inputMat.getMat().cols*2; + + if(imageNumberOfChannels==4) + { + // create a cv::Mat table (for RGBA planes) + cv::Mat planes[4] = + { + cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[doubleNBpixels]), + cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[nbPixels]), + cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]) + }; + planes[3] = cv::Mat(inputMatToConvert.size(), dsttype); // last channel (alpha) does not point on the valarray (not usefull in our case) + // split color cv::Mat in 4 planes... it fills valarray directely + cv::split(Mat_ >(inputMatToConvert), planes); + } + else if (imageNumberOfChannels==3) + { + // create a cv::Mat table (for RGB planes) + cv::Mat planes[] = + { + cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[doubleNBpixels]), + cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[nbPixels]), + cv::Mat(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]) + }; + // split color cv::Mat in 3 planes... it fills valarray directely + cv::split(cv::Mat_ >(inputMatToConvert), planes); + } + else if(imageNumberOfChannels==1) + { + // create a cv::Mat header for the valarray + cv::Mat dst(inputMatToConvert.size(), dsttype, &outputValarrayMatrix[0]); + inputMatToConvert.convertTo(dst, dsttype); + } + else + CV_Error(Error::StsUnsupportedFormat, "input image must be single channel (gray levels), bgr format (color) or bgra (color with transparency which won't be considered"); + + return imageNumberOfChannels>1; // return bool : false for gray level image processing, true for color mode +} + + // run the initilized retina filter in order to perform gray image tone mapping, after this call all retina outputs are updated void _runGrayToneMapping(const std::valarray &grayImageInput, std::valarray &grayImageOutput) { @@ -218,5 +312,5 @@ CV_EXPORTS Ptr createRetinaFastToneMapping(Size inputSize return new RetinaFastToneMappingImpl(inputSize); } -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv diff --git a/modules/bioinspired/src/retinafilter.cpp b/modules/bioinspired/src/retinafilter.cpp index a666b1fbf..e1e24c89b 100644 --- a/modules/bioinspired/src/retinafilter.cpp +++ b/modules/bioinspired/src/retinafilter.cpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -73,10 +73,10 @@ namespace cv { -namespace hvstools +namespace bioinspired { // standard constructor without any log sampling of the input frame - RetinaFilter::RetinaFilter(const unsigned int sizeRows, const unsigned int sizeColumns, const bool colorMode, const RETINA_COLORSAMPLINGMETHOD samplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) + RetinaFilter::RetinaFilter(const unsigned int sizeRows, const unsigned int sizeColumns, const bool colorMode, const int samplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) : _retinaParvoMagnoMappedFrame(0), _retinaParvoMagnoMapCoefTable(0), @@ -522,5 +522,5 @@ namespace hvstools return true; } -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv diff --git a/modules/bioinspired/src/retinafilter.hpp b/modules/bioinspired/src/retinafilter.hpp index 7c64942ec..3e204885f 100644 --- a/modules/bioinspired/src/retinafilter.hpp +++ b/modules/bioinspired/src/retinafilter.hpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -110,7 +110,7 @@ //#define __RETINADEBUG // define RETINADEBUG to display debug data namespace cv { -namespace hvstools +namespace bioinspired { // retina class that process the 3 outputs of the retina filtering stages class RetinaFilter//: public BasicRetinaFilter @@ -127,7 +127,7 @@ public: * @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 */ - RetinaFilter(const unsigned int sizeRows, const unsigned int sizeColumns, const bool colorMode=false, const RETINA_COLORSAMPLINGMETHOD samplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); + RetinaFilter(const unsigned int sizeRows, const unsigned int sizeColumns, const bool colorMode=false, const int samplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0); /** * standard destructor @@ -542,7 +542,7 @@ private: }; -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv #endif /*RETINACLASSES_H_*/ diff --git a/modules/bioinspired/src/templatebuffer.hpp b/modules/bioinspired/src/templatebuffer.hpp index 33593f044..827eb709f 100644 --- a/modules/bioinspired/src/templatebuffer.hpp +++ b/modules/bioinspired/src/templatebuffer.hpp @@ -6,7 +6,7 @@ ** copy or use the software. ** ** -** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. +** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab. ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping. ** ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications) @@ -32,7 +32,7 @@ ** Copyright (C) 2000-2008, Intel Corporation, all rights reserved. ** Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved. ** -** For Human Visual System tools (hvstools) +** For Human Visual System tools (bioinspired) ** Copyright (C) 2007-2011, LISTIC Lab, Annecy le Vieux and GIPSA Lab, Grenoble, France, all rights reserved. ** ** Third party copyrights are property of their respective owners. @@ -75,7 +75,7 @@ namespace cv { -namespace hvstools +namespace bioinspired { //// If a parallelization method is available then, you should define MAKE_PARALLEL, in the other case, the classical serial code will be used #define MAKE_PARALLEL @@ -550,6 +550,6 @@ public: return std::fabs(x); } -}// end of namespace hvstools +}// end of namespace bioinspired }// end of namespace cv #endif diff --git a/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp b/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp index 8080d5308..21de69cb9 100644 --- a/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp +++ b/samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp @@ -128,7 +128,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i normalize(imageInputRescaled, imageInputRescaled, 0.0, 255.0, cv::NORM_MINMAX); } - cv::Ptr retina; + cv::Ptr retina; int retinaHcellsGain; int localAdaptation_photoreceptors, localAdaptation_Gcells; static void callBack_updateRetinaParams(int, void*) @@ -218,10 +218,10 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i */ if (useLogSampling) { - retina = createRetina(inputImage.size(),true, RETINA_COLOR_BAYER, true, 2.0, 10.0); + retina = cv::bioinspired::createRetina(inputImage.size(),true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - retina = createRetina(inputImage.size()); + retina = cv::bioinspired::createRetina(inputImage.size()); // create a fast retina tone mapper (Meyla&al algorithm) std::cout<<"Allocating fast tone mapper..."< retina; + cv::Ptr retina; int retinaHcellsGain; int localAdaptation_photoreceptors, localAdaptation_Gcells; static void callBack_updateRetinaParams(int, void*) @@ -281,10 +281,10 @@ static void loadNewFrame(const std::string filenamePrototype, const int currentF */ if (useLogSampling) { - retina = createRetina(inputImage.size(),true, RETINA_COLOR_BAYER, true, 2.0, 10.0); + retina = cv::bioinspired::createRetina(inputImage.size(),true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - retina = createRetina(inputImage.size()); + retina = cv::bioinspired::createRetina(inputImage.size()); // save default retina parameters file in order to let you see this and maybe modify it and reload using method "setup" retina->write("RetinaDefaultParameters.xml"); diff --git a/samples/cpp/retinaDemo.cpp b/samples/cpp/retinaDemo.cpp index 3dbeb08b7..51e8408af 100644 --- a/samples/cpp/retinaDemo.cpp +++ b/samples/cpp/retinaDemo.cpp @@ -106,15 +106,15 @@ int main(int argc, char* argv[]) { try { // create a retina instance with default parameters setup, uncomment the initialisation you wanna test - cv::Ptr myRetina; + cv::Ptr myRetina; // if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision) if (useLogSampling) { - myRetina = createRetina(inputFrame.size(), true, RETINA_COLOR_BAYER, true, 2.0, 10.0); + myRetina = cv::bioinspired::createRetina(inputFrame.size(), true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : - myRetina = createRetina(inputFrame.size()); + myRetina = cv::bioinspired::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"); diff --git a/samples/cpp/tutorial_code/bioinspired/retina_tutorial.cpp b/samples/cpp/tutorial_code/bioinspired/retina_tutorial.cpp index 428f8f618..994d881de 100644 --- a/samples/cpp/tutorial_code/bioinspired/retina_tutorial.cpp +++ b/samples/cpp/tutorial_code/bioinspired/retina_tutorial.cpp @@ -95,16 +95,16 @@ int main(int argc, char* argv[]) { try { // create a retina instance with default parameters setup, uncomment the initialisation you wanna test - cv::Ptr myRetina; + cv::Ptr myRetina; // if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision) if (useLogSampling) { - myRetina = createRetina(inputFrame.size(), true, RETINA_COLOR_BAYER, true, 2.0, 10.0); + myRetina = cv::bioinspired::createRetina(inputFrame.size(), true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0); } else// -> else allocate "classical" retina : { - myRetina = createRetina(inputFrame.size()); + myRetina = cv::bioinspired::createRetina(inputFrame.size()); } // save default retina parameters file in order to let you see this and maybe modify it and reload using method "setup"