Quantization.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file Quantization.h
  3. * @brief Quantization of one-dimensional signals with a standard range of [0,1] (Interface)
  4. * @author Erik Rodner, Alexander Freytag
  5. * @date 01/09/2012
  6. */
  7. #ifndef _NICE_QUANTIZATIONINCLUDE
  8. #define _NICE_QUANTIZATIONINCLUDE
  9. // NICE-core includes
  10. #include <core/basics/types.h>
  11. #include <core/basics/Persistent.h>
  12. namespace NICE {
  13. /**
  14. * @class Quantization
  15. * @brief Quantization of one-dimensional signals with a standard range of [0,1]
  16. * @author Erik Rodner, Alexander Freytag
  17. */
  18. class Quantization : public NICE::Persistent
  19. {
  20. /** TODO
  21. * The current implementation only provides uniform quantization. We could extend this
  22. * by giving a ParameterizedFunction object to the constructor, which would allow us to inverse transform function values
  23. * before performing the binning.
  24. */
  25. protected:
  26. uint numBins;
  27. public:
  28. /**
  29. * @brief default constructor
  30. * @author Alexander Freytag
  31. * @date 06-02-2014
  32. */
  33. Quantization( );
  34. /**
  35. * @brief simple constructor
  36. * @author Erik Rodner
  37. * @date
  38. */
  39. Quantization( uint numBins );
  40. /** simple destructor */
  41. virtual ~Quantization();
  42. /**
  43. * @brief get the size of the vocabulary, i.e. the number of bins
  44. */
  45. virtual uint size() const;
  46. /**
  47. * @brief get specific word or prototype element of the quantization
  48. *
  49. * @param bin the index of the bin
  50. *
  51. * @return value of the prototype
  52. */
  53. virtual double getPrototype (uint bin) const;
  54. /**
  55. * @brief Determine for a given signal value the bin in the vocabulary. This is not the corresponding prototype, which
  56. * has to be requested with getPrototype afterwards
  57. *
  58. * @param value signal function value
  59. *
  60. * @return index of the bin entry corresponding to the given signal value
  61. */
  62. virtual uint quantize (double value) const;
  63. ///////////////////// INTERFACE PERSISTENT /////////////////////
  64. // interface specific methods for store and restore
  65. ///////////////////// INTERFACE PERSISTENT /////////////////////
  66. virtual void restore ( std::istream & is, int format = 0 );
  67. virtual void store ( std::ostream & os, int format = 0 ) const;
  68. virtual void clear () {};
  69. };
  70. }
  71. #endif