retina included in namespace bioinspired + followed suggestions made by Vadim
This commit is contained in:
parent
188f889949
commit
7fe78efda3
@ -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<Retina> myRetina;
|
||||
cv::Ptr<cv::bioinspired::Retina> 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*.
|
||||
|
||||
|
@ -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<cv::Retina> myRetina;
|
||||
cv::Ptr<Retina> 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*.
|
||||
|
||||
|
@ -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<Retina> createRetina (Size inputSize);
|
||||
cv::Ptr<Retina> 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
|
||||
+++++++++++
|
||||
|
@ -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
|
||||
|
@ -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 <valarray>
|
||||
|
||||
|
||||
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<Retina> createRetina(Size inputSize);
|
||||
CV_EXPORTS Ptr<Retina> 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<Retina> 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<float> &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<float> &outputValarrayMatrix);
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* __OPENCV_BIOINSPIRED_RETINA_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 <valarray>
|
||||
|
||||
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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<float> &ImageLogPolProjection::runProjection(const std::valarray<f
|
||||
return _sampledFrame;
|
||||
}
|
||||
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
|
@ -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.
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace hvstools
|
||||
namespace bioinspired
|
||||
{
|
||||
|
||||
class ImageLogPolProjection:public BasicRetinaFilter
|
||||
@ -238,6 +238,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
#endif /*IMAGELOGPOLPROJECTION_H_*/
|
||||
|
@ -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 and Desctructor of the OPL retina filter
|
||||
MagnoRetinaFilter::MagnoRetinaFilter(const unsigned int NBrows, const unsigned int NBcolumns)
|
||||
@ -208,5 +208,5 @@ const std::valarray<float> &MagnoRetinaFilter::runFilter(const std::valarray<flo
|
||||
|
||||
return (*_magnoYOutput);
|
||||
}
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
|
@ -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.
|
||||
@ -99,7 +99,7 @@
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace hvstools
|
||||
namespace bioinspired
|
||||
{
|
||||
class MagnoRetinaFilter: public BasicRetinaFilter
|
||||
{
|
||||
@ -239,7 +239,7 @@ namespace hvstools
|
||||
#endif
|
||||
};
|
||||
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
|
||||
#endif /*MagnoRetinaFilter_H_*/
|
||||
|
@ -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
|
||||
{
|
||||
//////////////////////////////////////////////////////////
|
||||
// OPL RETINA FILTER
|
||||
@ -229,5 +229,5 @@ void ParvoRetinaFilter::_OPL_OnOffWaysComputing() // WARNING : this method requi
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
|
@ -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.
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace hvstools
|
||||
namespace bioinspired
|
||||
{
|
||||
//retina classes that derivate from the Basic Retrina class
|
||||
class ParvoRetinaFilter: public BasicRetinaFilter
|
||||
@ -258,6 +258,6 @@ private:
|
||||
#endif
|
||||
|
||||
};
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
#endif
|
||||
|
@ -45,9 +45,9 @@
|
||||
|
||||
#include "opencv2/bioinspired.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
#include "opencv2/core/private.hpp"
|
||||
|
||||
#include <valarray>
|
||||
namespace cv
|
||||
{
|
||||
|
||||
|
@ -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 <cstdio>
|
||||
#include <sstream>
|
||||
#include <valarray>
|
||||
|
||||
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<float> &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<float> &outputValarrayMatrix);
|
||||
|
||||
|
||||
};
|
||||
|
||||
// smart pointers allocation :
|
||||
Ptr<Retina> createRetina(Size inputSize){ return new RetinaImpl(inputSize); }
|
||||
Ptr<Retina> 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<Retina> 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<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, OutputArray outBuffer)
|
||||
void RetinaImpl::_convertValarrayBuffer2cvMat(const std::valarray<float> &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<float> &grayMatrixToConver
|
||||
}
|
||||
}
|
||||
|
||||
bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray<float> &outputValarrayMatrix)
|
||||
bool RetinaImpl::_convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray<float> &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
|
||||
|
@ -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<float> &in
|
||||
}
|
||||
}
|
||||
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
|
@ -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_*/
|
||||
|
@ -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<float> _temp2;
|
||||
float _meanLuminanceModulatorK;
|
||||
|
||||
|
||||
void _convertValarrayBuffer2cvMat(const std::valarray<float> &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<nbRows;++i)
|
||||
{
|
||||
for (unsigned int j=0;j<nbColumns;++j)
|
||||
{
|
||||
cv::Point2d pixel(j,i);
|
||||
outMat.at<unsigned char>(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<nbRows;++i)
|
||||
{
|
||||
for (unsigned int j=0;j<nbColumns;++j,++valarrayPTR)
|
||||
{
|
||||
cv::Point2d pixel(j,i);
|
||||
cv::Vec3b pixelValues;
|
||||
pixelValues[2]=(unsigned char)*(valarrayPTR);
|
||||
pixelValues[1]=(unsigned char)*(valarrayPTR+nbPixels);
|
||||
pixelValues[0]=(unsigned char)*(valarrayPTR+doubleNBpixels);
|
||||
|
||||
outMat.at<cv::Vec3b>(pixel)=pixelValues;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray<float> &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<T>::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_<Vec<T, 4> >(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_<Vec<T, 3> >(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<float> &grayImageInput, std::valarray<float> &grayImageOutput)
|
||||
{
|
||||
@ -218,5 +312,5 @@ CV_EXPORTS Ptr<RetinaFastToneMapping> createRetinaFastToneMapping(Size inputSize
|
||||
return new RetinaFastToneMappingImpl(inputSize);
|
||||
}
|
||||
|
||||
}// end of namespace hvstools
|
||||
}// end of namespace bioinspired
|
||||
}// end of namespace cv
|
||||
|
@ -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
|
||||
|
@ -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_*/
|
||||
|
@ -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
|
||||
|
@ -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> retina;
|
||||
cv::Ptr<cv::bioinspired::Retina> 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..."<<std::endl;
|
||||
|
@ -161,7 +161,7 @@ static void rescaleGrayLevelMat(const cv::Mat &inputMat, cv::Mat &outputMat, con
|
||||
|
||||
}
|
||||
|
||||
cv::Ptr<Retina> retina;
|
||||
cv::Ptr<cv::bioinspired::Retina> 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");
|
||||
|
@ -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<Retina> myRetina;
|
||||
cv::Ptr<cv::bioinspired::Retina> 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");
|
||||
|
@ -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<Retina> myRetina;
|
||||
cv::Ptr<cv::bioinspired::Retina> 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"
|
||||
|
Loading…
Reference in New Issue
Block a user