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.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
729 lines (684 sloc)
23.8 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.cpp | |
*/ | |
#include "dab_tracker_com_manager.h" | |
#include "dab_tracker_camera.h" | |
//#include "dab_tracker_blob.h" | |
//#include "dab_tracker_motion_blob.h" | |
#if defined TARGET_WIN32 | |
//#include "dab_tracker_nuitrack_camera.h" | |
#endif | |
using namespace dab; | |
using namespace dab::tracker; | |
#pragma mark BlobSender implementation | |
//BlobSender::BlobSender(OscSender* pOscSender) | |
//: mOscSender(pOscSender) | |
//, mSendInterval(0) | |
//, mCurrentSendStep(0) | |
//, mNormalize(false) | |
//, mSendBoundingBox(true) | |
//, mSendContour(true) | |
//, mSendHull(true) | |
//, mLocked(false) | |
//{} | |
// | |
//void | |
//BlobSender::sendBoundingBox(bool pSendBoundingBox) | |
//{ | |
// mSendBoundingBox = pSendBoundingBox; | |
//} | |
// | |
//void | |
//BlobSender::sendContour(bool pSendContour) | |
//{ | |
// mSendContour = pSendContour; | |
//} | |
// | |
//void | |
//BlobSender::sendHull(bool pSendHull) | |
//{ | |
// mSendHull = pSendHull; | |
//} | |
// | |
//void | |
//BlobSender::setNormalize(const array<int, 2>& pFrameSize) | |
//{ | |
// mNormScale[0] = 1.0 / static_cast<float>(pFrameSize[0]); | |
// mNormScale[1] = 1.0 / static_cast<float>(pFrameSize[1]); | |
// mNormalize = true; | |
//} | |
// | |
//void | |
//BlobSender::setSendInterval(unsigned int pSendInterval) | |
//{ | |
// mSendInterval = pSendInterval; | |
//} | |
// | |
//void | |
//BlobSender::notifyUpdate(const std::vector<Blob>& pBlobs) | |
//{ | |
// if(mLocked == true) return; | |
// mLocked = true; | |
// | |
// if(mCurrentSendStep >= mSendInterval) | |
// { | |
// int blobCount = pBlobs.size(); | |
// for(int bI=0; bI<blobCount; ++bI) | |
// { | |
// const Blob& blob = pBlobs[bI]; | |
// | |
// std::string messageAddress = std::string("/BlobTracker/" + to_string(blob.getProcessorId()) + "/Blob/" + to_string(blob.getId())); | |
// std::shared_ptr<dab::OscMessage> message( new dab::OscMessage(messageAddress) ); | |
// | |
// message->add((float)blob.timeStamp()); | |
// | |
// if(mNormalize == false) | |
// { | |
// message->add(blob.position().getPtr(), 3); | |
// message->add(blob.velocity().getPtr(), 3); | |
// message->add(blob.orientation()); | |
// message->add(blob.area()); | |
// | |
// if(mSendBoundingBox == true) | |
// { | |
// const std::array<ofVec3f, 2>& boundingBox = blob.boundingBox(); | |
// float boundingBoxData[] = { boundingBox[0].x, boundingBox[0].y, boundingBox[0].z, boundingBox[1].x, boundingBox[1].y, boundingBox[1].z }; | |
// message->add(boundingBoxData, 6); | |
// } | |
// | |
// if(mSendContour == true) | |
// { | |
// const std::vector<ofVec3f>& contour = blob.contour(); | |
// unsigned int contourPointCount = contour.size(); | |
// | |
// std::vector<float> contourData(contourPointCount * 3); | |
// for(int pI=0, dI=0; pI<contourPointCount; ++pI) | |
// { | |
// contourData[dI++] = contour[pI].x; | |
// contourData[dI++] = contour[pI].y; | |
// contourData[dI++] = contour[pI].z; | |
// } | |
// message->add(contourData.data(), contourData.size()); | |
// } | |
// | |
// if(mSendHull == true) | |
// { | |
// const std::vector<ofVec3f>& hull = blob.hull(); | |
// unsigned int hullPointCount = hull.size(); | |
// | |
// std::vector<float> hullData(hullPointCount * 3); | |
// for(int pI=0, dI=0; pI<hullPointCount; ++pI) | |
// { | |
// hullData[dI++] = hull[pI].x; | |
// hullData[dI++] = hull[pI].y; | |
// hullData[dI++] = hull[pI].z; | |
// } | |
// message->add(hullData.data(), hullPointCount*3); | |
// } | |
// } | |
// else | |
// { | |
// const ofVec3f& position = blob.position(); | |
// float normPos[] = { position.x * mNormScale[0], position.y * mNormScale[1], position.z }; | |
// message->add(normPos, 3); | |
// | |
// const ofVec3f& velocity = blob.velocity(); | |
// float normVelocity[] = { velocity.x * mNormScale[0], velocity.y * mNormScale[1], velocity.z }; | |
// message->add(normVelocity, 3); | |
// | |
// message->add(blob.orientation()); | |
// | |
// float area = blob.area(); | |
// float normArea = area * mNormScale[0] * mNormScale[1]; | |
// message->add(normArea); | |
// | |
// if(mSendBoundingBox == true) | |
// { | |
// const std::array<ofVec3f, 2>& boundingBox = blob.boundingBox(); | |
// float normBoundingBox[] = { boundingBox[0].x * mNormScale[0], boundingBox[0].y * mNormScale[1], boundingBox[0].z, boundingBox[1].x * mNormScale[0], boundingBox[1].y * mNormScale[1], boundingBox[1].z }; | |
// message->add(normBoundingBox, 6); | |
// } | |
// | |
// if(mSendContour == true) | |
// { | |
// const std::vector<ofVec3f>& contour = blob.contour(); | |
// unsigned int contourPointCount = contour.size(); | |
// std::vector<float> normContourData(contourPointCount*3); | |
// for(int pI=0, dI=0; pI<contourPointCount; ++pI) | |
// { | |
// normContourData[dI++] = contour[pI].x * mNormScale[0]; | |
// normContourData[dI++] = contour[pI].y * mNormScale[1]; | |
// normContourData[dI++] = contour[pI].z; | |
// } | |
// message->add(normContourData.data(), contourPointCount*3); | |
// } | |
// | |
// if(mSendHull == true) | |
// { | |
// const std::vector<ofVec3f>& hull = blob.hull(); | |
// unsigned int hullPointCount = hull.size(); | |
// | |
// std::vector<float> normHullData(hullPointCount * 3); | |
// for(int pI=0, dI=0; pI<hullPointCount; ++pI) | |
// { | |
// normHullData[dI++] = hull[pI].x * mNormScale[0]; | |
// normHullData[dI++] = hull[pI].y * mNormScale[1]; | |
// normHullData[dI++] = hull[pI].z; | |
// } | |
// message->add(normHullData.data(), normHullData.size()); | |
// } | |
// } | |
// | |
// mOscSender->send(message); | |
// | |
// } | |
// | |
// mCurrentSendStep = 0; | |
// } | |
// else mCurrentSendStep++; | |
// | |
// mLocked = false; | |
//} | |
#pragma mark MotionBlobSender implementation | |
//MotionBlobSender::MotionBlobSender(OscSender* pOscSender) | |
//: mOscSender(pOscSender) | |
//, mSendInterval(0) | |
//, mCurrentSendStep(0) | |
//, mNormalize(false) | |
//, mLocked(false) | |
//{} | |
// | |
//void | |
//MotionBlobSender::setNormalize(const array<int, 2>& pFrameSize) | |
//{ | |
// mNormScale[0] = 1.0 / static_cast<float>(pFrameSize[0]); | |
// mNormScale[1] = 1.0 / static_cast<float>(pFrameSize[1]); | |
// mNormalize = true; | |
//} | |
// | |
//void | |
//MotionBlobSender::setSendInterval(unsigned int pSendInterval) | |
//{ | |
// mSendInterval = pSendInterval; | |
//} | |
// | |
// | |
//void | |
//MotionBlobSender::notifyUpdate(const std::vector<MotionBlob>& pBlobs) | |
//{ | |
// if(mLocked == true) return; | |
// mLocked = true; | |
// | |
// if(mCurrentSendStep >= mSendInterval) | |
// { | |
// int blobCount = pBlobs.size(); | |
// for(int bI=0; bI<blobCount; ++bI) | |
// { | |
// const MotionBlob& blob = pBlobs[bI]; | |
// | |
// std::string messageAddress = std::string("/MotionTemplate/" + to_string(blob.getProcessorId()) + "/MotionBlob/" + to_string(blob.getId())); | |
// std::shared_ptr<dab::OscMessage> message( new dab::OscMessage(messageAddress) ); | |
// | |
// message->add((float)blob.timeStamp()); | |
// | |
// if(mNormalize == false) | |
// { | |
// message->add(blob.position().getPtr(), 3); | |
// message->add(blob.size().data(), 2); | |
// } | |
// else | |
// { | |
// const ofVec3f& position = blob.position(); | |
// float normPos[] = { position.x * mNormScale[0], position.y * mNormScale[1], position.z }; | |
// message->add(normPos, 3); | |
// | |
// const std::array<float, 2>& size = blob.size(); | |
// float normSize[] = { size[0] * mNormScale[0], size[1] * mNormScale[1] }; | |
// message->add(normSize, 2); | |
// } | |
// | |
// message->add(blob.motionOrientation()); | |
// message->add(blob.motionLength()); | |
// | |
// if(mNormalize == false) | |
// { | |
// message->add(blob.area()); | |
// } | |
// else | |
// { | |
// message->add(blob.area() * mNormScale[0] * mNormScale[1]); | |
// } | |
// | |
// message->add(blob.priority()); | |
// | |
// mOscSender->send(message); | |
// } | |
// | |
// mCurrentSendStep = 0; | |
// } | |
// else mCurrentSendStep++; | |
// | |
// mLocked = false; | |
//} | |
#pragma mark MotionFeatureSender implementation | |
//MotionFeatureSender::MotionFeatureSender(OscSender* pOscSender) | |
//: mOscSender(pOscSender) | |
//, mSendInterval(0) | |
//, mCurrentSendStep(0) | |
//, mNormalize(false) | |
//, mLocked(false) | |
//{} | |
// | |
//void | |
//MotionFeatureSender::setNormalize(const array<int, 2>& pFrameSize) | |
//{ | |
// mNormScale[0] = 1.0 / static_cast<float>(pFrameSize[0]); | |
// mNormScale[1] = 1.0 / static_cast<float>(pFrameSize[1]); | |
// mNormalize = true; | |
//} | |
// | |
//void | |
//MotionFeatureSender::setSendInterval(unsigned int pSendInterval) | |
//{ | |
// mSendInterval = pSendInterval; | |
//} | |
// | |
// | |
//void | |
//MotionFeatureSender::notifyUpdate(const std::vector<MotionFeature>& pFeatures) | |
//{ | |
// if(mLocked == true) return; | |
// mLocked = true; | |
// | |
// if(mCurrentSendStep >= mSendInterval) | |
// { | |
// std::vector<MotionFeature> motionFeatures = pFeatures; | |
// int featureCount = motionFeatures.size(); | |
// | |
// std::vector<float> featurePositions(featureCount * 3); | |
// std::vector<float> featureVelocities(featureCount * 3); | |
// | |
// if(mNormalize == false) | |
// { | |
// for(int fI=0, dI=0; fI<featureCount; ++fI, dI += 3) | |
// { | |
// const MotionFeature& feature = motionFeatures[fI]; | |
// | |
// featurePositions[dI] = feature.mPosition.x; | |
// featurePositions[dI+1] = feature.mPosition.y; | |
// featurePositions[dI+2] = feature.mPosition.z; | |
// featureVelocities[dI] = feature.mVelocity.x; | |
// featureVelocities[dI+1] = feature.mVelocity.y; | |
// featureVelocities[dI+2] = feature.mVelocity.z; | |
// } | |
// } | |
// else | |
// { | |
// for(int fI=0, dI=0; fI<featureCount; ++fI, dI += 3) | |
// { | |
// const MotionFeature& feature = motionFeatures[fI]; | |
// | |
// featurePositions[dI] = feature.mPosition.x * mNormScale[0]; | |
// featurePositions[dI+1] = feature.mPosition.y * mNormScale[1]; | |
// featurePositions[dI+2] = feature.mPosition.z; | |
// featureVelocities[dI] = feature.mVelocity.x * mNormScale[0]; | |
// featureVelocities[dI+1] = feature.mVelocity.y * mNormScale[1]; | |
// featureVelocities[dI+2] = feature.mVelocity.z; | |
// } | |
// } | |
// | |
// std::string messageAddress = "/MotionFeatures"; | |
// std::shared_ptr<dab::OscMessage> message( new dab::OscMessage(messageAddress) ); | |
// message->add(featurePositions.data(), featurePositions.size()); | |
// message->add(featureVelocities.data(), featureVelocities.size()); | |
// | |
// mOscSender->send(message); | |
// | |
// mCurrentSendStep = 0; | |
// } | |
// else mCurrentSendStep++; | |
// | |
// mLocked = false; | |
//} | |
#pragma mark MotionFieldSender implementation | |
//MotionFieldSender::MotionFieldSender(OscSender* pOscSender) | |
//: mOscSender(pOscSender) | |
//, mSendInterval(0) | |
//, mCurrentSendStep(0) | |
//, mNormalize(false) | |
//, mLocked(false) | |
//{} | |
// | |
//void | |
//MotionFieldSender::setNormalize(const array<int, 2>& pFrameSize) | |
//{ | |
// mNormScale[0] = 1.0 / static_cast<float>(pFrameSize[0]); | |
// mNormScale[1] = 1.0 / static_cast<float>(pFrameSize[1]); | |
// mNormalize = true; | |
//} | |
// | |
//void | |
//MotionFieldSender::setSendInterval(unsigned int pSendInterval) | |
//{ | |
// mSendInterval = pSendInterval; | |
//} | |
// | |
// | |
//void | |
//MotionFieldSender::notifyUpdate(const MotionField& pField) | |
//{ | |
// if(mLocked == true) return; | |
// mLocked = true; | |
// | |
// if(mCurrentSendStep >= mSendInterval) | |
// { | |
// MotionField field = pField; | |
// int fieldVectorCount = field.mVelocities.size(); | |
// std::vector<float> fieldVelocties( fieldVectorCount * 3 ); | |
// | |
// if(mNormalize == false) | |
// { | |
// for(int vI=0, d=0; vI<fieldVectorCount; ++vI, d += 3) | |
// { | |
// fieldVelocties[d] = field.mVelocities[vI].x; | |
// fieldVelocties[d+1] = field.mVelocities[vI].y; | |
// fieldVelocties[d+2] = field.mVelocities[vI].z; | |
// } | |
// } | |
// else | |
// { | |
// for(int vI=0, d=0; vI<fieldVectorCount; ++vI, d += 3) | |
// { | |
// fieldVelocties[d] = field.mVelocities[vI].x * mNormScale[0]; | |
// fieldVelocties[d+1] = field.mVelocities[vI].y * mNormScale[1]; | |
// fieldVelocties[d+2] = field.mVelocities[vI].z; | |
// } | |
// } | |
// | |
// std::string messageAddress = "/MotionField"; | |
// std::shared_ptr<dab::OscMessage> message( new dab::OscMessage(messageAddress) ); | |
// message->add(field.mSize[0]); | |
// message->add(field.mSize[1]); | |
// message->add(fieldVelocties.data(), fieldVelocties.size()); | |
// | |
// mOscSender->send(message); | |
// | |
// mCurrentSendStep = 0; | |
// } | |
// else mCurrentSendStep++; | |
// | |
// mLocked = false; | |
//} | |
#pragma mark SkeletonSender implementation | |
//SkeletonSender::SkeletonSender(OscSender* pOscSender) | |
// : mOscSender(pOscSender) | |
// , mSendInterval(0) | |
// , mCurrentSendStep(0) | |
// , mNormalize(false) | |
// , mLocked(false) | |
//{} | |
//void | |
//SkeletonSender::setNormalize(const array<int, 2>& pFrameSize) | |
//{ | |
// mNormScale[0] = 1.0 / static_cast<float>(pFrameSize[0]); | |
// mNormScale[1] = 1.0 / static_cast<float>(pFrameSize[1]); | |
// mNormalize = true; | |
//} | |
// | |
//void | |
//SkeletonSender::setSendInterval(unsigned int pSendInterval) | |
//{ | |
// mSendInterval = pSendInterval; | |
//} | |
// | |
//void | |
//SkeletonSender::notifyUpdate(const std::vector<Skeleton>& pSkeletons) | |
//{ | |
// if (mLocked == true) return; | |
// mLocked = true; | |
// | |
// if (mCurrentSendStep >= mSendInterval) | |
// { | |
// int skeletonCount = pSkeletons.size(); | |
// | |
// for (int sI = 0; sI<skeletonCount; ++sI) | |
// { | |
// const Skeleton& skeleton = pSkeletons[sI]; | |
// | |
// if (skeleton.valid() == false) continue; | |
// | |
// std::string messageAddress = std::string("/SkeletonTracker/" + to_string(skeleton.trackerId()) + "/Skeleton/" + to_string(skeleton.id())); | |
// std::shared_ptr<dab::OscMessage> message(new dab::OscMessage(messageAddress)); | |
// | |
// const std::vector<ofVec3f>& jointPositions = skeleton.jointPositions(); | |
// const std::vector< std::array<unsigned int, 2> >& jointConnections = skeleton.jointConnections(); | |
// | |
// int jointCount = jointPositions.size(); | |
// int connectionCount = jointConnections.size(); | |
// | |
// std::vector<float> positionArray(jointCount*3); | |
// std:vector<int> connectionArray(connectionCount*2); | |
// | |
// if (mNormalize == false) | |
// { | |
// for (int jI = 0, aI=0; jI < jointCount; ++jI, aI += 3) | |
// { | |
// positionArray[aI] = jointPositions[jI].x; | |
// positionArray[aI+1] = jointPositions[jI].y; | |
// positionArray[aI+2] = jointPositions[jI].z; | |
// } | |
// } | |
// else | |
// { | |
// for (int jI = 0, aI = 0; jI < jointCount; ++jI, aI+=3) | |
// { | |
// positionArray[aI] = jointPositions[jI].x * mNormScale[0]; | |
// positionArray[aI + 1] = jointPositions[jI].y * mNormScale[1]; | |
// positionArray[aI + 2] = jointPositions[jI].z; | |
// } | |
// } | |
// | |
// for (int cI = 0, aI=0; cI < connectionCount; ++cI, aI+=2) | |
// { | |
// connectionArray[aI] = jointConnections[cI][0]; | |
// connectionArray[aI+1] = jointConnections[cI][1]; | |
// } | |
// | |
// message->add(positionArray.data(), positionArray.size()); | |
// message->add<int>(connectionArray.data(), connectionArray.size()); | |
// | |
// mOscSender->send(message); | |
// } | |
// | |
// mCurrentSendStep = 0; | |
// } | |
// else mCurrentSendStep++; | |
// | |
// mLocked = false; | |
//} | |
#pragma mark CameraOscControl implementation | |
CameraOscControl::CameraOscControl(Camera* pCamera) | |
: mCamera(pCamera) | |
{} | |
CameraOscControl::~CameraOscControl() | |
{} | |
void | |
CameraOscControl::notify(std::shared_ptr<OscMessage> pMessage) | |
{ | |
mLock.lock(); | |
mMessageQueue.push_back(pMessage); | |
if (mMessageQueue.size() > mMaxMessageQueueLength) mMessageQueue.pop_front(); | |
mLock.unlock(); | |
} | |
void | |
CameraOscControl::update() | |
{ | |
mLock.lock(); | |
while (mMessageQueue.size() > 0) | |
{ | |
std::shared_ptr< OscMessage > oscMessage = mMessageQueue[0]; | |
update(oscMessage); | |
mMessageQueue.pop_front(); | |
} | |
mLock.unlock(); | |
} | |
void | |
CameraOscControl::update(std::shared_ptr<OscMessage> pMessage) | |
{ | |
try | |
{ | |
std::string address = pMessage->address(); | |
std::cout << "address " << address << "\n"; | |
const std::vector<_OscArg*>& arguments = pMessage->arguments(); | |
if (address.compare("/RecordStill") == 0) recordStill(arguments); | |
else if (address.compare("/StartRecording") == 0) startRecording(arguments); | |
else if (address.compare("/StopRecording") == 0) stopRecording(arguments); | |
} | |
catch (dab::Exception& e) | |
{ | |
std::cout << e << "\n"; | |
} | |
} | |
void | |
CameraOscControl::startRecording(const std::vector<_OscArg*>& pArgs) throw (dab::Exception) | |
{ | |
mCamera->startRecording(); | |
} | |
void | |
CameraOscControl::stopRecording(const std::vector<_OscArg*>& pArgs) throw (dab::Exception) | |
{ | |
mCamera->stopRecording(); | |
} | |
void | |
CameraOscControl::recordStill(const std::vector<_OscArg*>& pArgs) throw (dab::Exception) | |
{ | |
int argCount = pArgs.size(); | |
if(argCount == 1 && pArgs[0]->oscType() == OSC_TYPE_INT32) | |
{ | |
int timeStamp = *pArgs[0]; | |
std::string stillFileName = "still_" + std::to_string(timeStamp); | |
std::cout << "CameraOscControl::recordStill " << timeStamp << "\n"; | |
mCamera->recordStill(stillFileName); | |
} | |
else if (argCount == 1 && pArgs[0]->oscType() == OSC_TYPE_STRING) | |
{ | |
std::string fileName = pArgs[0]->operator const std::string&(); | |
mCamera->recordStill(fileName); | |
} | |
else throw(dab::Exception( "ERR_OSC: Wrong Parameters for /RecordStill", __FILE__, __FUNCTION__, __LINE__ )); | |
} | |
#pragma mark ComManager implementation | |
void | |
ComManager::createOscReceiver(const std::string& pReceiverName, unsigned int pPort) throw (Exception) | |
{ | |
if (mOscReceivers.find(pReceiverName) != mOscReceivers.end()) throw Exception("TRACKER ERROR: osc receiver " + pReceiverName + " already exists", __FILE__, __FUNCTION__, __LINE__); | |
OscReceiver* oscReceiver = new OscReceiver(pReceiverName, pPort); | |
oscReceiver->start(); | |
mOscReceivers[pReceiverName] = oscReceiver; | |
} | |
void | |
ComManager::createOscSender(const std::string& pSenderName, const std::string& pIpAddress, unsigned int pPort) throw (Exception) | |
{ | |
if( mOscSenders.find(pSenderName) != mOscSenders.end() ) throw Exception("TRACKER ERROR: osc sender " + pSenderName + " already exists", __FILE__, __FUNCTION__, __LINE__); | |
OscSender* oscSender = new OscSender(pSenderName, pIpAddress, pPort); | |
mOscSenders[pSenderName] = oscSender; | |
} | |
void | |
ComManager::addCameraOscControl(const std::string& pReceiverName, Camera* pCamera) throw (Exception) | |
{ | |
if (mOscReceivers.find(pReceiverName) == mOscReceivers.end()) throw Exception("TRACKER ERROR: osc receiver " + pReceiverName + " not found", __FILE__, __FUNCTION__, __LINE__); | |
std::shared_ptr<CameraOscControl> camOscControl( new CameraOscControl(pCamera) ); | |
mCameraOscControls.push_back(camOscControl); | |
mOscReceivers[pReceiverName]->registerOscListener(std::weak_ptr<OscListener>(camOscControl)); | |
} | |
//std::shared_ptr<BlobSender> | |
//ComManager::registerBlobs(const std::string& pSenderName, BlobTracker* pBlobTracker) throw (Exception) | |
//{ | |
// if( mOscSenders.find(pSenderName) == mOscSenders.end() ) throw Exception("TRACKER ERROR: osc sender " + pSenderName + " not found", __FILE__, __FUNCTION__, __LINE__); | |
// | |
// OscSender* oscSender = mOscSenders[pSenderName]; | |
// | |
// std::cout << "oscSender " << oscSender << "\n"; | |
// | |
// std::shared_ptr<BlobSender> blobSender = std::shared_ptr<BlobSender>( new BlobSender(oscSender) ); | |
// pBlobTracker->registerListener(blobSender); | |
// | |
// mBlobSenders.push_back(blobSender); | |
// | |
// return blobSender; | |
//} | |
// | |
//std::shared_ptr<MotionBlobSender> | |
//ComManager::registerMotionBlobs(const std::string& pSenderName, MotionBlobTracker* pMotionBlobTracker) throw (Exception) | |
//{ | |
// if( mOscSenders.find(pSenderName) == mOscSenders.end() ) throw Exception("TRACKER ERROR: osc sender " + pSenderName + " not found", __FILE__, __FUNCTION__, __LINE__); | |
// | |
// OscSender* oscSender = mOscSenders[pSenderName]; | |
// | |
// std::shared_ptr<MotionBlobSender> motionBlobSender = std::shared_ptr<MotionBlobSender>( new MotionBlobSender(oscSender) ); | |
// pMotionBlobTracker->registerListener(motionBlobSender); | |
// | |
// mMotionBlobSenders.push_back(motionBlobSender); | |
// | |
// return motionBlobSender; | |
//} | |
// | |
//std::shared_ptr<MotionFeatureSender> | |
//ComManager::registerMotionFeatures(const std::string& pSenderName, MotionFeatureTracker* pMotionFeatureTracker) throw (Exception) | |
//{ | |
// if( mOscSenders.find(pSenderName) == mOscSenders.end() ) throw Exception("TRACKER ERROR: osc sender " + pSenderName + " not found", __FILE__, __FUNCTION__, __LINE__); | |
// | |
// OscSender* oscSender = mOscSenders[pSenderName]; | |
// | |
// std::shared_ptr<MotionFeatureSender> motionFeatureSender = std::shared_ptr<MotionFeatureSender>( new MotionFeatureSender(oscSender) ); | |
// pMotionFeatureTracker->registerListener(motionFeatureSender); | |
// | |
// mMotionFeatureSenders.push_back(motionFeatureSender); | |
// | |
// return motionFeatureSender; | |
//} | |
// | |
//std::shared_ptr<MotionFieldSender> | |
//ComManager::registerMotionField(const std::string& pSenderName, MotionFieldTracker* pMotionFieldTracker) throw (Exception) | |
//{ | |
// if( mOscSenders.find(pSenderName) == mOscSenders.end() ) throw Exception("TRACKER ERROR: osc sender " + pSenderName + " not found", __FILE__, __FUNCTION__, __LINE__); | |
// | |
// OscSender* oscSender = mOscSenders[pSenderName]; | |
// | |
// std::shared_ptr<MotionFieldSender> motionFieldSender = std::shared_ptr<MotionFieldSender>( new MotionFieldSender(oscSender) ); | |
// pMotionFieldTracker->registerListener(motionFieldSender); | |
// | |
// mMotionFieldSenders.push_back(motionFieldSender); | |
// | |
// return motionFieldSender; | |
//} | |
// | |
//std::shared_ptr<SkeletonSender> | |
//ComManager::registerSkeletons(const std::string& pSenderName, Camera* pCamera) throw (Exception) | |
//{ | |
// if (mOscSenders.find(pSenderName) == mOscSenders.end()) throw Exception("TRACKER ERROR: osc sender " + pSenderName + " not found", __FILE__, __FUNCTION__, __LINE__); | |
// | |
// OscSender* oscSender = mOscSenders[pSenderName]; | |
// | |
// std::shared_ptr<SkeletonSender> skeletonSender=(nullptr); | |
// | |
// #if defined TARGET_WIN32 | |
// if(dynamic_cast<NuiTrackCamera*>(pCamera) != nullptr) | |
// { | |
// NuiTrackCamera* camera = static_cast<NuiTrackCamera*>(pCamera); | |
// | |
// skeletonSender = std::shared_ptr<SkeletonSender>(new SkeletonSender(oscSender)); | |
// camera->registerListener(skeletonSender); | |
// mSkeletonSenders.push_back(skeletonSender); | |
// } | |
// #endif | |
// | |
// return skeletonSender; | |
//} | |
void | |
ComManager::update() | |
{ | |
for (auto camControlIter = mCameraOscControls.begin(); camControlIter != mCameraOscControls.end(); camControlIter++) | |
{ | |
(*camControlIter)->update(); | |
} | |
} |