Skip to content
Permalink
16e941848f
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
111 lines (86 sloc) 2.85 KB
/** \file dab_tracker_azure_camera.h
*/
#include <iostream>
#include <vector>
#include <thread>
#include <k4a/k4a.hpp>
#include <k4arecord/playback.hpp>
#include <k4arecord/record.hpp>
#include "dab_tracker_camera.h"
#include "dab_exception.h"
#pragma once
namespace dab
{
namespace tracker
{
class PointCloud;
class AzureTools;
class AzureCamera : public Camera
{
friend class AzureTools;
public:
enum WiredMode
{
NoWire,
Slave,
Master
};
AzureCamera(bool pColorMode, bool pDepthMode, bool pPointCloudMode, int pDeviceNr = 0, WiredMode pWiredMode = NoWire) throw (dab::Exception);
AzureCamera(bool pColorMode, bool pDepthMode, bool pPointCloudMode, const std::string& pString, WiredMode pWiredMode = NoWire) throw (dab::Exception);
AzureCamera(k4a_device_configuration_t pNativeConfig, int pDeviceNr = 0) throw (dab::Exception);
AzureCamera(k4a_device_configuration_t pNativeConfig, const std::string& pSerialNr) throw (dab::Exception);
~AzureCamera();
bool isColorMode() const;
bool isDepthMode() const;
bool isPointCloudMode() const;
ofxCvImage* colorFrame();
ofxCvImage* depthFrame();
PointCloud* pointCloud();
const k4a::image nativeColorFrame();
const k4a::image nativeDepthFrame();
const k4a::image nativeDepthColorFrame();
const k4a::image nativePointCloudFrame();
void setControlValue(const std::string& pControlName) throw (dab::Exception);
void setControlValue(const std::string& pControlName, const AbstractValue& pValue) throw (dab::Exception);
void start() throw (dab::Exception);
void stop() throw (dab::Exception);
void capture() throw (dab::Exception);
void startRecording() throw (dab::Exception);
void stopRecording() throw (dab::Exception);
void saveSettings() throw (dab::Exception);
void restoreSettings() throw (dab::Exception);
protected:
int mDeviceNr = -1;
std::string mSerialNr = "";
// camera internals
k4a::device mNativeDevice;
k4a_device_configuration_t mNativeConfig;
k4a::capture mNativeCapture;
k4a::playback mNativeMoviePlayer;
k4a::record mNativeMovieRecorder;
// camera internals for transforming depth image into color image
k4a::calibration mDepthColorCalibration;
k4a::transformation mDepthColorTransformation;
k4a::image mNativeColorImage;
k4a::image mNativeDepthImage;
k4a::image mNativeDepthColorImage;
k4a::image mNativePointCloudImage;
// camera frame
ofxCvColorImage* mColorFrame;
//ofxCvGrayscaleImage* mDepthFrame;
ofxCvShortImage* mDepthFrame;
PointCloud* mPointCloud;
// camera basic settings
float mMinDepth = 0.0;
float mMaxDepth = SHRT_MAX;
// camera state
WiredMode mWiredMode;
bool mColorMode;
bool mDepthMode;
bool mPointCloudMode;
std::mutex mLock;
std::shared_ptr<AzureCamera> mSelf;
void init() throw (dab::Exception);
};
}
}