ClipDetector.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef __CLIPDETECTOR_H
  2. #define __CLIPDETECTOR_H
  3. #include "Detector.h"
  4. #include "ClipApp.h"
  5. #include "ClipCfg.h"
  6. #include "AbandObjCfg.h"
  7. #include "Locks.h"
  8. #include "ExHeaders.h"
  9. #include <opencv2/opencv.hpp>
  10. NAMESPACE_MAS_BEGIN
  11. NAMESPACE_CLIP_BEGIN
  12. class ClipDetector : public Detector, public tzc::OSThread {
  13. public:
  14. ClipDetector(const std::string& key, const std::string& name);
  15. ~ClipDetector();
  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(ClipDetectResult& clipRst, DrawInfo& draw, TZ_INT height, TZ_INT width);
  26. ClipApp* m_clip;
  27. std::list<std::tuple<SPtr<StreamInfo>, fDetCallback, void*>> m_waitList;
  28. std::queue<std::string> m_qAbandObjQueue;
  29. tzc::Mutex m_cntLock;
  30. tzc::Mutex m_listLock;
  31. tzc::Mutex m_rstLock;
  32. tzc::Mutex m_abandObjLock;
  33. tzc::Semaphore m_sema;
  34. const TZ_Uint32 MAX_WAIT_LIST_LEN = 5;
  35. const TZ_Uint32 CLIP_WAIT_MSECOND = 100;
  36. void cropImageByProposals(const cv::Mat& image, const std::vector<abandobj::Proposal>& proposals);
  37. };
  38. NAMESPACE_CLIP_END
  39. NAMESPACE_MAS_END
  40. #endif