source: flair-src/trunk/demos/Sinus/src/MeanFilter.h @ 14

Last change on this file since 14 was 14, checked in by Sanahuja Guillaume, 5 years ago

sinus

File size: 2.5 KB
Line 
1//  created:    2013/06/27
2//  filename:   MeanFilter.h
3//
4//  author:     Guillaume Sanahuja
5//              Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7//  version:    $Id: $
8//
9//  purpose:    object computing a mean filter
10//
11//
12/*********************************************************************/
13
14#ifndef MEANFILTER_H
15#define MEANFILTER_H
16
17//we fix the max number of elements to compute the mean
18//this is a simple example, it should be dynamical
19#define MAX_NUMBER_OF_ELEMENTS 200
20
21//necessary include, as IODevice is a base of our class
22#include <IODevice.h>
23
24//forward declaration for other classes
25namespace flair {
26    namespace core {
27        class cvmatrix;
28    }
29    namespace gui {
30        class LayoutPosition;
31        class GroupBox;
32        class SpinBox;
33    }
34}
35
36//MeanFilter is a class computing a mean
37// based on a parametrizable number of elements
38// it derives on IODevice as it as an input and an output
39// it is a filter, we extend the namespace
40namespace flair { namespace filter {
41    class MeanFilter : public core::IODevice {
42
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);
55
56            /*!
57            * \brief Destructor
58            */
59            ~MeanFilter();
60
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;
69
70            /*!
71            * \brief Value
72            *
73            * this method is equivalent to GetMatrix()->Value(0,0)
74            *
75            * \return actual mean value
76            */
77            float GetValue(void) const;
78
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
90#endif // MEANFILTER_H
Note: See TracBrowser for help on using the repository browser.