Changeset 16 in flair-src for trunk/demos/Sinus/src/MeanFilter.h
- Timestamp:
- Apr 8, 2016, 3:48:40 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/Sinus/src/MeanFilter.h
r14 r16 15 15 #define MEANFILTER_H 16 16 17 // we fix the max number of elements to compute the mean18 // this is a simple example, it should be dynamical17 // we fix the max number of elements to compute the mean 18 // this is a simple example, it should be dynamical 19 19 #define MAX_NUMBER_OF_ELEMENTS 200 20 20 21 // necessary include, as IODevice is a base of our class21 // necessary include, as IODevice is a base of our class 22 22 #include <IODevice.h> 23 23 24 // forward declaration for other classes24 // forward declaration for other classes 25 25 namespace flair { 26 27 28 29 30 31 32 33 26 namespace core { 27 class cvmatrix; 28 } 29 namespace gui { 30 class LayoutPosition; 31 class GroupBox; 32 class SpinBox; 33 } 34 34 } 35 35 36 // MeanFilter is a class computing a mean36 // MeanFilter is a class computing a mean 37 37 // based on a parametrizable number of elements 38 38 // it derives on IODevice as it as an input and an output 39 39 // it is a filter, we extend the namespace 40 namespace flair { namespace filter { 41 class MeanFilter : public core::IODevice { 40 namespace flair { 41 namespace filter { 42 class MeanFilter : public core::IODevice { 42 43 43 public: 44 /*! 45 * \brief Constructor 46 * 47 * Builds a mean filter. \n 48 * After calling this function, position will be deleted as it is no longer usefull. \n 49 * 50 * \param parent IODevice to use as parent 51 * \param position where to place settings 52 * \param name name of the object 53 */ 54 MeanFilter(const core::IODevice* parent,const gui::LayoutPosition* position,std::string name); 44 public: 45 /*! 46 * \brief Constructor 47 * 48 * Builds a mean filter. \n 49 * After calling this function, position will be deleted as it is no longer 50 *usefull. \n 51 * 52 * \param parent IODevice to use as parent 53 * \param position where to place settings 54 * \param name name of the object 55 */ 56 MeanFilter(const core::IODevice *parent, const gui::LayoutPosition *position, 57 std::string name); 55 58 56 57 58 59 59 /*! 60 * \brief Destructor 61 */ 62 ~MeanFilter(); 60 63 61 /*! 62 * \brief Output matrix 63 * 64 * allows to access output matrix, to get signal value or to put it in a graph. \n 65 * 66 * \return pointer to the output matrix 67 */ 68 core::cvmatrix *GetMatrix(void) const; 64 /*! 65 * \brief Output matrix 66 * 67 * allows to access output matrix, to get signal value or to put it in a graph. 68 *\n 69 * 70 * \return pointer to the output matrix 71 */ 72 core::cvmatrix *GetMatrix(void) const; 69 73 70 71 72 73 74 75 76 77 74 /*! 75 * \brief Value 76 * 77 * this method is equivalent to GetMatrix()->Value(0,0) 78 * 79 * \return actual mean value 80 */ 81 float GetValue(void) const; 78 82 79 private: 80 //UpdateFrom method from base class IODevice 81 void UpdateFrom(const core::io_data *data); 82 gui::GroupBox *groupBox; 83 gui::SpinBox *numberOfElements; 84 core::cvmatrix *output; 85 float previousValues[MAX_NUMBER_OF_ELEMENTS];//previous values storage 86 87 }; 88 }// end namespace filter 89 }// end namespace flair 83 private: 84 // UpdateFrom method from base class IODevice 85 void UpdateFrom(const core::io_data *data); 86 gui::GroupBox *groupBox; 87 gui::SpinBox *numberOfElements; 88 core::cvmatrix *output; 89 float previousValues[MAX_NUMBER_OF_ELEMENTS]; // previous values storage 90 }; 91 } // end namespace filter 92 } // end namespace flair 90 93 #endif // MEANFILTER_H
Note:
See TracChangeset
for help on using the changeset viewer.