AbandObjDetector.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef __ABANDOBJDETECTOR_H
  2. #define __ABANDOBJDETECTOR_H
  3. #include "Detector.h"
  4. #include "AbandObjApp.h"
  5. #include "AbandObjCfg.h"
  6. #include "Locks.h"
  7. #include "ExHeaders.h"
  8. #include <opencv2/dnn.hpp>
  9. #include <opencv2/opencv.hpp>
  10. NAMESPACE_MAS_BEGIN
  11. NAMESPACE_ABANDOBJ_BEGIN
  12. class AbandObjDetector : public Detector, public tzc::OSThread {
  13. public:
  14. AbandObjDetector(const std::string& key, const std::string& name);
  15. ~AbandObjDetector();
  16. virtual TZ_INT Initialize(const std::string& initParam);
  17. virtual TZ_INT Dispose();
  18. virtual TZ_INT TurnOnGPU();
  19. virtual TZ_INT TurnOffGPU();
  20. virtual TZ_INT DoDetect(SPtr<StreamInfo>& media, fDetCallback callback, void* ctx);
  21. virtual TZ_INT SetDetectCfg(const std::string& param);
  22. private:
  23. virtual void Entry();
  24. void skipFrame(SPtr<StreamInfo> & media, fDetCallback callback, void * ctx);
  25. void draw(AbandObjDetectResult& AbandObjRst, DrawInfo& draw, TZ_INT height, TZ_INT width);
  26. AbandObjCfg m_cfgParam;
  27. AbandObjApp* m_abandObj;
  28. std::list<std::tuple<SPtr<StreamInfo>, fDetCallback, void*>> m_waitList;
  29. tzc::Mutex m_cntLock;
  30. tzc::Mutex m_listLock;
  31. tzc::Mutex m_rstLock;
  32. tzc::Semaphore m_sema;
  33. const TZ_Uint32 MAX_WAIT_LIST_LEN = 5;
  34. const TZ_Uint32 ABANDOBJ_WAIT_MSECOND = 100;
  35. };
  36. NAMESPACE_ABANDOBJ_END
  37. NAMESPACE_MAS_END
  38. #endif