Commit af26ce3a authored by catree's avatar catree Committed by Vadim Pisarevsky

Bioinspired module: remove printSetup to avoid unnecessary printing in the…

Bioinspired module: remove printSetup to avoid unnecessary printing in the console, fix some typos. (#905)
parent 8a23411b
...@@ -226,8 +226,9 @@ public: ...@@ -226,8 +226,9 @@ public:
- warning, Exceptions are thrown if read XML file is not valid - warning, Exceptions are thrown if read XML file is not valid
@param retinaParameterFile the parameters filename @param retinaParameterFile the parameters filename
@param applyDefaultSetupOnFailure set to true if an error must be thrown on error @param applyDefaultSetupOnFailure set to true if an error must be thrown on error
You can retreive the current parameers structure using method Retina::getParameters and update
it before running method Retina::setup You can retrieve the current parameters structure using the method Retina::getParameters and update
it before running method Retina::setup.
*/ */
CV_WRAP virtual void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true)=0; CV_WRAP virtual void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true)=0;
......
...@@ -86,18 +86,18 @@ public: ...@@ -86,18 +86,18 @@ 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
* @param inputSize : the input frame size * @param inputSize : the input frame size
*/ */
RetinaImpl(Size inputSize); RetinaImpl(const Size inputSize);
/** /**
* Complete Retina filter constructor which allows all basic structural parameters definition * Complete Retina filter constructor which allows all basic structural parameters definition
* @param inputSize : the input frame size * @param inputSize : the input frame size
* @param colorMode : the chosen processing mode : with or without color processing * @param colorMode : the chosen processing mode : with or without color processing
* @param colorSamplingMethod: specifies which kind of color sampling will be used * @param colorSamplingMethod: specifies which kind of color sampling will be used
* @param useRetinaLogSampling: activate retina log sampling, if true, the 2 following parameters can be used * @param useRetinaLogSampling: activate retina log sampling, if true, the 2 following parameters can be used
* @param reductionFactor: only usefull if param useRetinaLogSampling=true, specifies the reduction factor of the output frame (as the center (fovea) is high resolution and corners can be underscaled, then a reduction of the output is allowed without precision leak * @param 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 * @param samplingStrenght: only usefull if param useRetinaLogSampling=true, specifies the strenght of the log scale that is applied
*/ */
RetinaImpl(Size inputSize, const bool colorMode, int colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const float reductionFactor=1.0f, const float samplingStrenght=10.0f); RetinaImpl(const Size inputSize, const bool colorMode, int colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const float reductionFactor=1.0f, const float samplingStrenght=10.0f);
virtual ~RetinaImpl(); virtual ~RetinaImpl();
/** /**
...@@ -115,7 +115,7 @@ public: ...@@ -115,7 +115,7 @@ public:
* => if the xml file does not exist, then default setup is applied * => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid * => warning, Exceptions are thrown if read XML file is not valid
* @param retinaParameterFile : the parameters filename * @param retinaParameterFile : the parameters filename
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/ */
void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
* => if the xml file does not exist, then default setup is applied * => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid * => warning, Exceptions are thrown if read XML file is not valid
* @param fs : the open Filestorage which contains retina parameters * @param fs : the open Filestorage which contains retina parameters
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/ */
void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true); void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
* => if the xml file does not exist, then default setup is applied * => if the xml file does not exist, then default setup is applied
* => warning, Exceptions are thrown if read XML file is not valid * => warning, Exceptions are thrown if read XML file is not valid
* @param newParameters : a parameters structures updated with the new target configuration * @param newParameters : a parameters structures updated with the new target configuration
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/ */
void setup(RetinaParameters newParameters); void setup(RetinaParameters newParameters);
...@@ -411,9 +411,6 @@ void RetinaImpl::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailur ...@@ -411,9 +411,6 @@ void RetinaImpl::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailur
printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what()); printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
printf("=> keeping current parameters\n"); printf("=> keeping current parameters\n");
} }
// report current configuration
printf("%s\n", printSetup().c_str());
} }
void RetinaImpl::setup(RetinaParameters newConfiguration) void RetinaImpl::setup(RetinaParameters newConfiguration)
...@@ -615,7 +612,7 @@ const Mat RetinaImpl::getParvoRAW() const { ...@@ -615,7 +612,7 @@ const Mat RetinaImpl::getParvoRAW() const {
return Mat((int)_retinaFilter->getContours().size(), 1, CV_32F, (void*)get_data(_retinaFilter->getContours())); return Mat((int)_retinaFilter->getContours().size(), 1, CV_32F, (void*)get_data(_retinaFilter->getContours()));
} }
// private method called by constructirs // private method called by constructors
void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const float reductionFactor, const float samplingStrenght) void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const float reductionFactor, const float samplingStrenght)
{ {
// basic error check // basic error check
...@@ -637,9 +634,6 @@ void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSa ...@@ -637,9 +634,6 @@ void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSa
// init retina // init retina
_retinaFilter->clearAllBuffers(); _retinaFilter->clearAllBuffers();
// report current configuration
printf("%s\n", printSetup().c_str());
} }
void RetinaImpl::_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)
......
...@@ -86,8 +86,7 @@ namespace cv ...@@ -86,8 +86,7 @@ namespace cv
namespace bioinspired namespace bioinspired
{ {
class TransientAreasSegmentationModuleImpl : class TransientAreasSegmentationModuleImpl : protected BasicRetinaFilter
protected BasicRetinaFilter
{ {
public: public:
...@@ -105,7 +104,7 @@ public: ...@@ -105,7 +104,7 @@ public:
/** /**
* @return the size of the manage input and output images * @return the size of the manage input and output images
*/ */
Size getSize(){return cv::Size(getNBcolumns(), getNBrows());}; Size getSize(){return cv::Size(getNBcolumns(), getNBrows());}
/** /**
* try to open an XML segmentation parameters file to adjust current segmentation instance setup * try to open an XML segmentation parameters file to adjust current segmentation instance setup
...@@ -189,19 +188,19 @@ protected: ...@@ -189,19 +188,19 @@ protected:
* access function * access function
* @return the local motion energy level picture (experimental, not usefull) * @return the local motion energy level picture (experimental, not usefull)
*/ */
inline const std::valarray<float> &getLocalMotionPicture() const {return _localMotion;}; inline const std::valarray<float> &getLocalMotionPicture() const {return _localMotion;}
/** /**
* access function * access function
* @return the neighborhood motion energy level picture (experimental, not usefull) * @return the neighborhood motion energy level picture (experimental, not usefull)
*/ */
inline const std::valarray<float> &getNeighborhoodMotionPicture() const {return _neighborhoodMotion;}; inline const std::valarray<float> &getNeighborhoodMotionPicture() const {return _neighborhoodMotion;}
/** /**
* access function * access function
* @return the motion energy context level picture (experimental, not usefull) * @return the motion energy context level picture (experimental, not usefull)
*/ */
inline const std::valarray<float> &getMotionContextPicture() const {return _contextMotionEnergy;}; inline const std::valarray<float> &getMotionContextPicture() const {return _contextMotionEnergy;}
struct cv::bioinspired::SegmentationParameters _segmentationParameters; struct cv::bioinspired::SegmentationParameters _segmentationParameters;
// template buffers and related acess pointers // template buffers and related acess pointers
...@@ -220,25 +219,25 @@ protected: ...@@ -220,25 +219,25 @@ protected:
// Buffer conversion utilities // Buffer conversion utilities
void _convertValarrayBuffer2cvMat(const std::valarray<bool> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, OutputArray outBuffer); void _convertValarrayBuffer2cvMat(const std::valarray<bool> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, OutputArray outBuffer);
bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray<float> &outputValarrayMatrix); bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray<float> &outputValarrayMatrix);
const TransientAreasSegmentationModuleImpl & operator = (const TransientAreasSegmentationModuleImpl &); const TransientAreasSegmentationModuleImpl & operator = (const TransientAreasSegmentationModuleImpl &);
}; };
class TransientAreasSegmentationModuleImpl_: public TransientAreasSegmentationModule class TransientAreasSegmentationModuleImpl_: public TransientAreasSegmentationModule
{ {
public: public:
TransientAreasSegmentationModuleImpl_(const Size size):_segmTool(size){}; TransientAreasSegmentationModuleImpl_(const Size size):_segmTool(size){}
inline virtual Size getSize(){return _segmTool.getSize();}; inline virtual Size getSize(){return _segmTool.getSize();}
inline virtual void write( cv::FileStorage& fs ) const{_segmTool.write(fs);}; inline virtual void write( cv::FileStorage& fs ) const{_segmTool.write(fs);}
inline virtual void setup(String segmentationParameterFile, const bool applyDefaultSetupOnFailure){_segmTool.setup(segmentationParameterFile, applyDefaultSetupOnFailure);}; inline virtual void setup(String segmentationParameterFile, const bool applyDefaultSetupOnFailure){_segmTool.setup(segmentationParameterFile, applyDefaultSetupOnFailure);}
inline virtual void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure){_segmTool.setup(fs, applyDefaultSetupOnFailure);}; inline virtual void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure){_segmTool.setup(fs, applyDefaultSetupOnFailure);}
inline virtual void setup(SegmentationParameters newParameters){_segmTool.setup(newParameters);}; inline virtual void setup(SegmentationParameters newParameters){_segmTool.setup(newParameters);}
inline virtual const String printSetup(){return _segmTool.printSetup();}; inline virtual const String printSetup(){return _segmTool.printSetup();}
inline virtual struct SegmentationParameters getParameters(){return _segmTool.getParameters();}; inline virtual struct SegmentationParameters getParameters(){return _segmTool.getParameters();}
inline virtual void write( String fs ) const{_segmTool.write(fs);}; inline virtual void write( String fs ) const{_segmTool.write(fs);}
inline virtual void run(InputArray inputToSegment, const int channelIndex){_segmTool.run(inputToSegment, channelIndex);}; inline virtual void run(InputArray inputToSegment, const int channelIndex){_segmTool.run(inputToSegment, channelIndex);}
inline virtual void getSegmentationPicture(OutputArray transientAreas){return _segmTool.getSegmentationPicture(transientAreas);}; inline virtual void getSegmentationPicture(OutputArray transientAreas){return _segmTool.getSegmentationPicture(transientAreas);}
inline virtual void clearAllBuffers(){_segmTool.clearAllBuffers();}; inline virtual void clearAllBuffers(){_segmTool.clearAllBuffers();}
private: private:
TransientAreasSegmentationModuleImpl _segmTool; TransientAreasSegmentationModuleImpl _segmTool;
...@@ -250,7 +249,7 @@ private: ...@@ -250,7 +249,7 @@ private:
*/ */
Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize){ Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize){
return makePtr<TransientAreasSegmentationModuleImpl_>(inputSize); return makePtr<TransientAreasSegmentationModuleImpl_>(inputSize);
}; }
// Constructor and destructors // Constructor and destructors
TransientAreasSegmentationModuleImpl::TransientAreasSegmentationModuleImpl(const Size size) TransientAreasSegmentationModuleImpl::TransientAreasSegmentationModuleImpl(const Size size)
...@@ -288,8 +287,8 @@ void TransientAreasSegmentationModuleImpl::clearAllBuffers() ...@@ -288,8 +287,8 @@ void TransientAreasSegmentationModuleImpl::clearAllBuffers()
struct SegmentationParameters TransientAreasSegmentationModuleImpl::getParameters() struct SegmentationParameters TransientAreasSegmentationModuleImpl::getParameters()
{ {
return _segmentationParameters; return _segmentationParameters;
}; }
// setup from XML file // setup from XML file
void TransientAreasSegmentationModuleImpl::setup(String segmentationParameterFile, const bool applyDefaultSetupOnFailure) void TransientAreasSegmentationModuleImpl::setup(String segmentationParameterFile, const bool applyDefaultSetupOnFailure)
...@@ -350,9 +349,6 @@ void TransientAreasSegmentationModuleImpl::setup(cv::FileStorage &fs, const bool ...@@ -350,9 +349,6 @@ void TransientAreasSegmentationModuleImpl::setup(cv::FileStorage &fs, const bool
std::cout<<"SegmentationModule::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl; std::cout<<"SegmentationModule::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
std::cout<<"=> keeping current parameters"<<std::endl; std::cout<<"=> keeping current parameters"<<std::endl;
} }
// report current configuration
printf("%s\n", printSetup().c_str());
} }
// setup parameters for the 2 filters that allow the segmentation // setup parameters for the 2 filters that allow the segmentation
...@@ -592,9 +588,3 @@ bool TransientAreasSegmentationModuleImpl::_convertCvMat2ValarrayBuffer(InputArr ...@@ -592,9 +588,3 @@ bool TransientAreasSegmentationModuleImpl::_convertCvMat2ValarrayBuffer(InputArr
} }
}} //namespaces end : cv and bioinspired }} //namespaces end : cv and bioinspired
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment