diff --git a/modules/bioinspired/include/opencv2/bioinspired/retina.hpp b/modules/bioinspired/include/opencv2/bioinspired/retina.hpp index 4ed6f3abd..e531614ac 100644 --- a/modules/bioinspired/include/opencv2/bioinspired/retina.hpp +++ b/modules/bioinspired/include/opencv2/bioinspired/retina.hpp @@ -226,8 +226,9 @@ public: - warning, Exceptions are thrown if read XML file is not valid @param retinaParameterFile the parameters filename @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; diff --git a/modules/bioinspired/src/retina.cpp b/modules/bioinspired/src/retina.cpp index 9bd37a1f6..1e518f81b 100644 --- a/modules/bioinspired/src/retina.cpp +++ b/modules/bioinspired/src/retina.cpp @@ -86,18 +86,18 @@ public: * Main constructor with most commun use setup : create an instance of color ready retina model * @param inputSize : the input frame size */ - RetinaImpl(Size inputSize); + RetinaImpl(const Size inputSize); /** * 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 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 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, 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(); /** @@ -115,7 +115,7 @@ public: * => if the xml file does not exist, then default setup is applied * => warning, Exceptions are thrown if read XML file is not valid * @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); @@ -125,7 +125,7 @@ public: * => if the xml file does not exist, then default setup is applied * => warning, Exceptions are thrown if read XML file is not valid * @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); @@ -134,7 +134,7 @@ public: * => if the xml file does not exist, then default setup is applied * => warning, Exceptions are thrown if read XML file is not valid * @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); @@ -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("=> keeping current parameters\n"); } - - // report current configuration - printf("%s\n", printSetup().c_str()); } void RetinaImpl::setup(RetinaParameters newConfiguration) @@ -615,7 +612,7 @@ const Mat RetinaImpl::getParvoRAW() const { 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) { // basic error check @@ -637,9 +634,6 @@ void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSa // init retina _retinaFilter->clearAllBuffers(); - - // report current configuration - printf("%s\n", printSetup().c_str()); } void RetinaImpl::_convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, OutputArray outBuffer) diff --git a/modules/bioinspired/src/transientareassegmentationmodule.cpp b/modules/bioinspired/src/transientareassegmentationmodule.cpp index 185cc11f5..45e41feba 100644 --- a/modules/bioinspired/src/transientareassegmentationmodule.cpp +++ b/modules/bioinspired/src/transientareassegmentationmodule.cpp @@ -86,8 +86,7 @@ namespace cv namespace bioinspired { -class TransientAreasSegmentationModuleImpl : - protected BasicRetinaFilter +class TransientAreasSegmentationModuleImpl : protected BasicRetinaFilter { public: @@ -105,7 +104,7 @@ public: /** * @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 @@ -189,19 +188,19 @@ protected: * access function * @return the local motion energy level picture (experimental, not usefull) */ - inline const std::valarray &getLocalMotionPicture() const {return _localMotion;}; + inline const std::valarray &getLocalMotionPicture() const {return _localMotion;} /** * access function * @return the neighborhood motion energy level picture (experimental, not usefull) */ - inline const std::valarray &getNeighborhoodMotionPicture() const {return _neighborhoodMotion;}; + inline const std::valarray &getNeighborhoodMotionPicture() const {return _neighborhoodMotion;} /** * access function * @return the motion energy context level picture (experimental, not usefull) */ - inline const std::valarray &getMotionContextPicture() const {return _contextMotionEnergy;}; + inline const std::valarray &getMotionContextPicture() const {return _contextMotionEnergy;} struct cv::bioinspired::SegmentationParameters _segmentationParameters; // template buffers and related acess pointers @@ -220,25 +219,25 @@ protected: // Buffer conversion utilities void _convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, OutputArray outBuffer); bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray &outputValarrayMatrix); - + const TransientAreasSegmentationModuleImpl & operator = (const TransientAreasSegmentationModuleImpl &); }; class TransientAreasSegmentationModuleImpl_: public TransientAreasSegmentationModule { public: - TransientAreasSegmentationModuleImpl_(const Size size):_segmTool(size){}; - inline virtual Size getSize(){return _segmTool.getSize();}; - 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(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure){_segmTool.setup(fs, applyDefaultSetupOnFailure);}; - inline virtual void setup(SegmentationParameters newParameters){_segmTool.setup(newParameters);}; - inline virtual const String printSetup(){return _segmTool.printSetup();}; - inline virtual struct SegmentationParameters getParameters(){return _segmTool.getParameters();}; - 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 getSegmentationPicture(OutputArray transientAreas){return _segmTool.getSegmentationPicture(transientAreas);}; - inline virtual void clearAllBuffers(){_segmTool.clearAllBuffers();}; + TransientAreasSegmentationModuleImpl_(const Size size):_segmTool(size){} + inline virtual Size getSize(){return _segmTool.getSize();} + 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(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure){_segmTool.setup(fs, applyDefaultSetupOnFailure);} + inline virtual void setup(SegmentationParameters newParameters){_segmTool.setup(newParameters);} + inline virtual const String printSetup(){return _segmTool.printSetup();} + inline virtual struct SegmentationParameters getParameters(){return _segmTool.getParameters();} + 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 getSegmentationPicture(OutputArray transientAreas){return _segmTool.getSegmentationPicture(transientAreas);} + inline virtual void clearAllBuffers(){_segmTool.clearAllBuffers();} private: TransientAreasSegmentationModuleImpl _segmTool; @@ -250,7 +249,7 @@ private: */ Ptr createTransientAreasSegmentationModule(Size inputSize){ return makePtr(inputSize); -}; +} // Constructor and destructors TransientAreasSegmentationModuleImpl::TransientAreasSegmentationModuleImpl(const Size size) @@ -288,8 +287,8 @@ void TransientAreasSegmentationModuleImpl::clearAllBuffers() struct SegmentationParameters TransientAreasSegmentationModuleImpl::getParameters() { - return _segmentationParameters; -}; + return _segmentationParameters; +} // setup from XML file void TransientAreasSegmentationModuleImpl::setup(String segmentationParameterFile, const bool applyDefaultSetupOnFailure) @@ -350,9 +349,6 @@ void TransientAreasSegmentationModuleImpl::setup(cv::FileStorage &fs, const bool std::cout<<"SegmentationModule::setup: wrong/unappropriate xml parameter file : error report :`n=>"< keeping current parameters"<