You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASIC_VIDEO_ANALYZER_HEADER__
  2. #define __BASIC_VIDEO_ANALYZER_HEADER__
  3. #ifndef M_E
  4. #include <math.h>
  5. #endif
  6. #include <vector>
  7. #include <stdio.h>
  8. #include <opencv2/opencv.hpp>
  9. #include <opencv2/core/core.hpp>
  10. #include <opencv2/features2d/features2d.hpp>
  11. //#include <opencv2/nonfree/features2d.hpp>
  12. //#include <opencv2/nonfree/nonfree.hpp>
  13. #include <opencv2/highgui/highgui.hpp>
  14. #include <opencv2/stitching/detail/matchers.hpp>
  15. #undef min
  16. #undef max
  17. //#include <opencv2/gpu/gpu.hpp>
  18. #include <opencv2/video/tracking.hpp>
  19. //#ifdef _DEBUG
  20. // #pragma comment(lib,"opencv_core249d")
  21. // #pragma comment(lib,"opencv_gpu249d")
  22. // #pragma comment(lib,"opencv_highgui249d")
  23. //#else
  24. // #pragma comment(lib,"opencv_core249")
  25. // #pragma comment(lib,"opencv_gpu249")
  26. // #pragma comment(lib,"opencv_highgui249")
  27. //#endif
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include "basicLoggingService.h"
  31. #include "basicMediaDestination.h"
  32. #include "basicLogCollection.h"
  33. #include "basicMediaSource.h"
  34. #include "basicEventHeap.h"
  35. #include "basicThread.h"
  36. #include "basicMutex.h"
  37. using namespace cv;
  38. using namespace std;
  39. typedef vector< Point > tContour;
  40. typedef vector< Point2f > tPoints2F;
  41. typedef vector< tContour > tContours;
  42. typedef vector< Vec4i > tHierarhy;
  43. typedef enum E_VIDEO_ANALYZER_TYPE{
  44. VA_NO_TYPE = 0,
  45. VA_BLOB_DETECT = 1,
  46. VA_VM_DETECT = 2,
  47. VA_OPTIC_FLOW = 3,
  48. VA_SURF_DETECT = 4,
  49. VA_FEAT_DETECT = 5,
  50. VA_HAAR_DETECT = 6
  51. }VIDEO_ANALYZER_TYPE;
  52. class basicVideoAnalyzer : public basicMediaDestination, public basicMediaSource {
  53. private:
  54. basicLogCollection *m_pLog;
  55. basicEventHeap *m_pEventHeap;
  56. void m_fThreadProc( void );
  57. protected:
  58. VIDEO_ANALYZER_TYPE type;
  59. basicMutex m_mBufferProtectorMutex;
  60. bool m_bPIP;
  61. bool m_bDetectionStatus;
  62. bool m_bDataIsActive;
  63. Mat m_oWorkingMat;
  64. virtual bool m_fImageAnalyzer( Mat &Picture ){ return false;};
  65. virtual basicEvent *createVAEvent(bool Status){ return NULL; };
  66. public:
  67. basicVideoAnalyzer();
  68. ~basicVideoAnalyzer();
  69. bool getDetectionStatus( void ){ return m_bDetectionStatus; };
  70. virtual void pushFrame(cv::Mat *Frame);
  71. virtual void markup( Mat &Picture ){};
  72. void setPIP( bool Val ){ m_bPIP = Val; };
  73. VIDEO_ANALYZER_TYPE getType(void){ return type; };
  74. };
  75. typedef vector<basicVideoAnalyzer*> vectorVA;
  76. #endif