libvibe++ : a generic C++ library for the ViBe algorithm
ViBeBase.h
Go to the documentation of this file.
1 /* Copyright - Benjamin Laugraud <blaugraud@ulg.ac.be> - 2016
2  * Copyright - Marc Van Droogenbroeck <m.vandroogenbroeck@ulg.ac.be> - 2016
3  *
4  * ViBe is covered by a patent (see http://www.telecom.ulg.ac.be/research/vibe).
5  *
6  * Permission to use ViBe without payment of fee is granted for nonprofit
7  * educational and research purposes only.
8  *
9  * This work may not be copied or reproduced in whole or in part for any
10  * purpose.
11  *
12  * Copying, reproduction, or republishing for any purpose shall require a
13  * license. Please contact the authors in such cases. All the code is provided
14  * without any guarantee.
15  */
16 
17 /**
18  @file ViBeBase.h
19  @brief Interface to the ViBe class
20 
21  @author Benjamin Laungraud and Marc Van Droogenbroeck
22 
23  @date June 2016
24 */
25 
26 #ifndef _LIB_VIBE_XX_COMMON_VIBE_BASE_H_
27 #define _LIB_VIBE_XX_COMMON_VIBE_BASE_H_
28 
29 #include <iostream>
30 
31 #include "../system/types.h"
32 
33 namespace ViBe {
34  class ViBeBase {
35  friend std::ostream& operator<<(std::ostream& os, const ViBeBase& vibe);
36 
37  public:
38 
39  static const uint8_t BACKGROUND = 0;
40  static const uint8_t FOREGROUND = 255;
41 
42  protected:
43 
44  static const uint32_t DEFAULT_NUMBER_OF_SAMPLES = 20;
45  static const uint32_t DEFAULT_MATCHING_THRESHOLD = 20;
46  static const uint32_t DEFAULT_MATCHING_NUMBER = 2;
47  static const uint32_t DEFAULT_UPDATE_FACTOR = 16;
48  static const uint32_t NUMBER_OF_HISTORY_IMAGES = 2;
49 
50  protected:
51 
52  /* Parameters. */
53  uint32_t height;
54  uint32_t width;
55  uint32_t numberOfSamples;
56  uint32_t matchingThreshold;
57  uint32_t matchingNumber;
58  uint32_t updateFactor;
59 
60  /* Common values. */
61  uint32_t stride;
62  uint32_t pixels;
63  uint32_t numValues;
64 
65  /* Storage for the history. */
66  uint8_t* historyImage;
67  uint8_t* historyBuffer;
68  uint32_t lastHistoryImageSwapped;
69 
70  /* Buffers with random values. */
71  uint32_t* jump;
72  int32_t* neighbor;
73  uint32_t* position;
74 
75  protected:
76 
77  ViBeBase(
78  int32_t height,
79  int32_t width,
80  int32_t channels,
81  const uint8_t* buffer
82  );
83 
84  public:
85 
86  virtual ~ViBeBase();
87 
88  uint32_t getNumberOfSamples() const;
89 
90  uint32_t getMatchingThreshold() const;
91 
92  void setMatchingThreshold(int32_t matchingThreshold);
93 
94  uint32_t getMatchingNumber() const;
95 
96  void setMatchingNumber(int32_t matchingNumber);
97 
98  uint32_t getUpdateFactor() const;
99 
100  void setUpdateFactor(int32_t updateFactor);
101 
102  public://TODO protected and debug operator overload.
103 
104  virtual void print(std::ostream& os = std::cout) const;
105  };
106 }
107 
108 #endif /* _LIB_VIBE_XX_COMMON_VIBE_BASE_H_ */

License/Copyright

This code is copyrighted by the University of Liège, Belgium. 
It is only shared for research purposes. Please do not distribute it. 
B. Laugraud and M. Van Droogenbroeck, May 2016.