Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ofxDabVideoTracker/src/dab_tracker_com_manager.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
211 lines (180 sloc)
5.75 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** \file dab_tracker_com_manager.h | |
*/ | |
#ifndef _dab_tracker_com_manager_h_ | |
#define _dab_tracker_com_manager_h_ | |
#include <iostream> | |
#include <map> | |
#include "dab_singleton.h" | |
#include "dab_exception.h" | |
#include "dab_osc_sender.h" | |
#include "dab_osc_receiver.h" | |
//#include "dab_tracker_blob_tracker.h" | |
//#include "dab_tracker_motion_blob_tracker.h" | |
//#include "dab_tracker_motion_feature_tracker.h" | |
//#include "dab_tracker_motion_field_tracker.h" | |
//#include "dab_tracker_skeleton.h" | |
namespace dab | |
{ | |
namespace tracker | |
{ | |
class Camera; | |
#pragma mark BlobSender definition | |
//class BlobSender : public BlobListener | |
//{ | |
//public: | |
// BlobSender(OscSender* pOscSender); | |
// | |
// void sendBoundingBox(bool pSendBoundingBox); | |
// void sendContour(bool pSendContour); | |
// void sendHull(bool pSendHull); | |
// void setNormalize(const array<int, 2>& pFrameSize); | |
// void setSendInterval(unsigned int pSendInterval); | |
// | |
// void notifyUpdate(const std::vector<Blob>& pBlobs); | |
// | |
//protected: | |
// unsigned int mSendInterval; | |
// unsigned int mCurrentSendStep; | |
// bool mSendBoundingBox; | |
// bool mSendContour; | |
// bool mSendHull; | |
// | |
// OscSender* mOscSender; | |
// | |
// array<float, 2> mNormScale; | |
// bool mNormalize; | |
// | |
// bool mLocked; | |
//}; | |
#pragma mark MotionBlobSender definition | |
//class MotionBlobSender : public MotionBlobListener | |
//{ | |
//public: | |
// MotionBlobSender(OscSender* pOscSender); | |
// | |
// void setNormalize(const array<int, 2>& pFrameSize); | |
// void setSendInterval(unsigned int pSendInterval); | |
// | |
// void notifyUpdate(const std::vector<MotionBlob>& pBlobs); | |
// | |
//protected: | |
// unsigned int mSendInterval; | |
// unsigned int mCurrentSendStep; | |
// | |
// OscSender* mOscSender; | |
// | |
// array<float, 2> mNormScale; | |
// bool mNormalize; | |
// | |
// bool mLocked; | |
//}; | |
#pragma mark MotionFeatureSender definition | |
//class MotionFeatureSender : public MotionFeatureListener | |
//{ | |
//public: | |
// MotionFeatureSender(OscSender* pOscSender); | |
// | |
// void setNormalize(const array<int, 2>& pFrameSize); | |
// void setSendInterval(unsigned int pSendInterval); | |
// | |
// void notifyUpdate(const std::vector<MotionFeature>& pFeatures); | |
// | |
//protected: | |
// unsigned int mSendInterval; | |
// unsigned int mCurrentSendStep; | |
// | |
// OscSender* mOscSender; | |
// | |
// array<float, 2> mNormScale; | |
// bool mNormalize; | |
// | |
// bool mLocked; | |
//}; | |
#pragma mark MotionFieldSender definition | |
//class MotionFieldSender : public MotionFieldListener | |
//{ | |
//public: | |
// MotionFieldSender(OscSender* pOscSender); | |
// | |
// void setNormalize(const array<int, 2>& pFrameSize); | |
// void setSendInterval(unsigned int pSendInterval); | |
// | |
// void notifyUpdate(const MotionField& pField); | |
// | |
//protected: | |
// unsigned int mSendInterval; | |
// unsigned int mCurrentSendStep; | |
// | |
// OscSender* mOscSender; | |
// | |
// array<float, 2> mNormScale; | |
// bool mNormalize; | |
// | |
// bool mLocked; | |
//}; | |
#pragma mark SkeletonSender definition | |
//class SkeletonSender : public SkeletonListener | |
//{ | |
//public: | |
// SkeletonSender(OscSender* pOscSender); | |
// | |
// void setNormalize(const array<int, 2>& pFrameSize); | |
// void setSendInterval(unsigned int pSendInterval); | |
// | |
// void notifyUpdate(const std::vector<Skeleton>& pSkeletons); | |
// | |
//protected: | |
// unsigned int mSendInterval; | |
// unsigned int mCurrentSendStep; | |
// | |
// OscSender* mOscSender; | |
// | |
// array<float, 2> mNormScale; | |
// bool mNormalize; | |
// | |
// bool mLocked; | |
//}; | |
#pragma mark CameraOscControl definition | |
class CameraOscControl : public OscListener | |
{ | |
public: | |
CameraOscControl(Camera* pCamera); | |
~CameraOscControl(); | |
void notify(std::shared_ptr<OscMessage> pMessage); | |
void update(); | |
void update(std::shared_ptr<OscMessage> pMessage); | |
protected: | |
unsigned int mMaxMessageQueueLength = 1000; | |
std::deque< std::shared_ptr<OscMessage> > mMessageQueue; | |
Camera* mCamera; | |
void startRecording(const std::vector<_OscArg*>& pArgs) throw (dab::Exception); | |
void stopRecording(const std::vector<_OscArg*>& pArgs) throw (dab::Exception); | |
void recordStill(const std::vector<_OscArg*>& pArgs) throw (dab::Exception); | |
std::mutex mLock; | |
}; | |
#pragma mark ComManager definition | |
class ComManager : public Singleton<ComManager> | |
{ | |
public: | |
void createOscReceiver(const std::string& pReceiverName, unsigned int pPort) throw (Exception); | |
void createOscSender(const std::string& pSenderName, const std::string& pIpAddress, unsigned int pPort) throw (Exception); | |
void addCameraOscControl(const std::string& pReceiverName, Camera* pCamera) throw (Exception); | |
// std::shared_ptr<BlobSender> registerBlobs(const std::string& pSenderName, BlobTracker* pBlobTracker) throw (Exception); | |
// std::shared_ptr<MotionBlobSender> registerMotionBlobs(const std::string& pSenderName, MotionBlobTracker* pMotionBlobTracker) throw (Exception); | |
// std::shared_ptr<MotionFeatureSender> registerMotionFeatures(const std::string& pSenderName, MotionFeatureTracker* pMotionFeatureTracker) throw (Exception); | |
// std::shared_ptr<MotionFieldSender> registerMotionField(const std::string& pSenderName, MotionFieldTracker* pMotionFieldTracker) throw (Exception); | |
//std::shared_ptr<SkeletonSender> registerSkeletons(const std::string& pSenderName, Camera* pCamera) throw (Exception); | |
void update(); | |
protected: | |
std::map<std::string, OscReceiver*> mOscReceivers; | |
std::map<std::string, OscSender*> mOscSenders; | |
std::vector< std::shared_ptr<CameraOscControl> > mCameraOscControls; | |
// std::vector< std::shared_ptr<BlobSender> > mBlobSenders; | |
// std::vector< std::shared_ptr<MotionBlobSender> > mMotionBlobSenders; | |
// std::vector< std::shared_ptr<MotionFeatureSender> > mMotionFeatureSenders; | |
// std::vector< std::shared_ptr<MotionFieldSender> > mMotionFieldSenders; | |
//std::vector< std::shared_ptr<SkeletonSender> > mSkeletonSenders; | |
}; | |
}; | |
}; | |
#endif |