X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;ds=sidebyside;f=include%2FEngine.h;h=8443e197871e407a6989cd4d42bd6ee66e934bb5;hb=97b147e9106cb549dd7dd62829b9d29b326738c7;hp=5405539fe2bc73c6d889320838e5c5d4e8e71c60;hpb=79009fa0674d90e03b7a7bd958f7ee1e20d9b194;p=trackerpp.git diff --git a/include/Engine.h b/include/Engine.h index 5405539..8443e19 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -9,12 +9,16 @@ #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 { @@ -24,16 +28,26 @@ public: 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& p); + void onPersonsOut(const std::vector& p); private: Engine(); void run(); + WorkerThread eventThread {"EventThread"}; + WorkerThread writeImgThread {"WriteImgThread"}; DetectorPtr detector; MultiTrackerPtr multiTracker; std::set observer_list; - //std::string videoSrc; VideoReaderPtr reader; }; @@ -58,7 +72,7 @@ struct Person 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"; @@ -66,7 +80,7 @@ struct Person } } - std::string toString(){ + std::string toString() const { std::stringstream ss; ss << "Person: id=" << id << ". Gender:" << (gender == Gender::Male ? "Male" : "Female" ) << ". Age: " << ageToString(age); @@ -77,9 +91,8 @@ struct Person class EngineObserver { public: - //virtual void onPersonIn(std::set persons) = 0; - virtual void onPersonIn(Person& p) = 0; - virtual void onPersonOut(Person& p) = 0; + virtual void onPersonsIn(const std::vector& p) = 0; + virtual void onPersonsOut(const std::vector& p) = 0; }; } // namespace suanzi