#include "MultiTracker.h"
#include "VideoReader.h"
#include "SharedPtr.h"
+#include "WorkerThread.h"
namespace suanzi{
class EngineObserver;
TK_DECLARE_PTR(Engine);
+TK_DECLARE_PTR(MultiTracker);
+
+struct Person;
class Engine
{
virtual ~Engine();
virtual void start();
+ //virtual void getCurrentCount();
+ // virtual void capture(bool bb = false);
void addObserver(EngineObserver* o);
void setVideoSrc(VideoSrcType type, const std::string& url);
+ // stream the video source as http, return the url
+ std::string setPreview(bool isPreview, bool showBB = false){return "";}
+
+protected:
+ friend class MultiTracker;
+ void onPersonsIn(const std::vector<Person>& p);
+ void onPersonsOut(const std::vector<Person>& p);
private:
Engine();
void run();
+ WorkerThread eventThread {"EventThread"};
+ WorkerThread writeImgThread {"WriteImgThread"};
DetectorPtr detector;
MultiTrackerPtr multiTracker;
std::set<EngineObserver *> observer_list;
- //std::string videoSrc;
VideoReaderPtr reader;
};
Gender gender = Female;
Ages age = Kid;
- std::string ageToString (Ages age){
+ std::string ageToString (Ages age) const {
switch (age){
case Kid: return "Kid";
case Teenager: return "Teenager";
}
}
- std::string toString(){
+ std::string toString() const {
std::stringstream ss;
ss << "Person: id=" << id << ". Gender:" << (gender == Gender::Male ? "Male" : "Female" ) <<
". Age: " << ageToString(age);
class EngineObserver
{
public:
- //virtual void onPersonIn(std::set<Person> persons) = 0;
- virtual void onPersonIn(Person& p) = 0;
- virtual void onPersonOut(Person& p) = 0;
+ virtual void onPersonsIn(const std::vector<Person>& p) = 0;
+ virtual void onPersonsOut(const std::vector<Person>& p) = 0;
};
} // namespace suanzi