optimised input image management

This commit is contained in:
Alexandre Benoit 2011-08-13 14:13:41 +00:00
parent bdfc0201de
commit 1a749c5141

View File

@ -78,16 +78,16 @@
namespace cv namespace cv
{ {
enum RETINA_COLORSAMPLINGMETHOD enum RETINA_COLORSAMPLINGMETHOD
{ {
RETINA_COLOR_RANDOM, /// each pixel position is either R, G or B in a random choice 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_DIAGONAL,/// color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
RETINA_COLOR_BAYER/// standard bayer sampling RETINA_COLOR_BAYER/// standard bayer sampling
}; };
class RetinaFilter; class RetinaFilter;
/** /**
* @brief a wrapper class which allows the use of the Gipsa/Listic Labs retina model * @brief a wrapper class which allows the use of the Gipsa/Listic Labs retina model
* @class Retina object is a wrapper class which allows the Gipsa/Listic Labs model to be used. * @class Retina object is a wrapper class which allows the Gipsa/Listic Labs model to be used.
* This retina model allows spatio-temporal image processing (applied on still images, video sequences). * This retina model allows spatio-temporal image processing (applied on still images, video sequences).
@ -101,9 +101,9 @@ namespace cv
* Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011 * Benoit A., Caplier A., Durette B., Herault, J., "USING HUMAN VISUAL SYSTEM MODELING FOR BIO-INSPIRED LOW LEVEL IMAGE PROCESSING", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773, DOI: http://dx.doi.org/10.1016/j.cviu.2010.01.011
* Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891. * Vision: Images, Signals and Neural Networks: Models of Neural Processing in Visual Perception (Progress in Neural Processing),By: Jeanny Herault, ISBN: 9814273686. WAPI (Tower ID): 113266891.
*/ */
class CV_EXPORTS Retina { class CV_EXPORTS Retina {
public: public:
/** /**
* Main constructor with most commun use setup : create an instance of color ready retina model * Main constructor with most commun use setup : create an instance of color ready retina model
@ -168,6 +168,7 @@ namespace cv
* @param localAdaptintegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation * @param localAdaptintegration_k: specifies the spatial constant of the low pas filter involved in the computation of the local "motion mean" for the local adaptation computation
*/ */
void setupIPLMagnoChannel(const bool normaliseOutput = true, const double parasolCells_beta=0, const double parasolCells_tau=0, const double parasolCells_k=7, const double amacrinCellsTemporalCutFrequency=1.2, const double V0CompressionParameter=0.95, const double localAdaptintegration_tau=0, const double localAdaptintegration_k=7); void setupIPLMagnoChannel(const bool normaliseOutput = true, const double parasolCells_beta=0, const double parasolCells_tau=0, const double parasolCells_k=7, const double amacrinCellsTemporalCutFrequency=1.2, const double V0CompressionParameter=0.95, const double localAdaptintegration_tau=0, const double localAdaptintegration_k=7);
/** /**
* method which allows retina to be applied on an input image * method which allows retina to be applied on an input image
* @param * @param
@ -175,6 +176,7 @@ namespace cv
* *
*/ */
void run(const Mat &inputImage); void run(const Mat &inputImage);
/** /**
* accessor of the details channel of the retina (models foveal vision) * accessor of the details channel of the retina (models foveal vision)
* @param retinaOutput_parvo : the output buffer (reallocated if necessary) * @param retinaOutput_parvo : the output buffer (reallocated if necessary)
@ -187,9 +189,20 @@ namespace cv
*/ */
void getMagno(Mat &retinaOutput_magno); void getMagno(Mat &retinaOutput_magno);
/**
* activate color saturation as the final step of the color demultiplexing process
* -> this saturation is a sigmoide function applied to each channel of the demultiplexed image.
* @param saturateColors: boolean that activates color saturation (if true) or desactivate (if false)
* @param colorSaturationValue: the saturation factor
*/
void setColorSaturation(const bool saturateColors=true, const double colorSaturationValue=4.0);
/**
* clear all retina buffers (equivalent to opening the eyes after a long period of eye close ;o)
*/
void clearBuffers(); void clearBuffers();
protected: protected:
//// Parameteres setup members //// Parameteres setup members
// parameters file ... saved on instance delete // parameters file ... saved on instance delete
FileStorage _parametersSaveFile; FileStorage _parametersSaveFile;
@ -209,13 +222,21 @@ namespace cv
* @param colorMode : a flag which mentions if matrix is color (true) or graylevel (false) * @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 * @param outBuffer : the output matrix which is reallocated to satisfy Retina output buffer dimensions
*/ */
void _convertValarrayGrayBuffer2cvMat(const std::valarray<double> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, Mat &outBuffer); void _convertValarrayBuffer2cvMat(const std::valarray<double> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, Mat &outBuffer);
/**
*
* @param inputMatToConvert : the OpenCV cv::Mat that has to be converted to gray or RGB valarray buffer that will be processed by the retina model
* @param outputValarrayMatrix : the output valarray
* @return the input image color mode (color=true, gray levels=false)
*/
const bool _convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert, std::valarray<double> &outputValarrayMatrix);
// private method called by constructirs // private method called by constructirs
void _init(const std::string parametersSaveFile, 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 std::string parametersSaveFile, 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);
}; };
} }
#endif /* __OPENCV_CONTRIB_RETINA_HPP__ */ #endif /* __OPENCV_CONTRIB_RETINA_HPP__ */