Added new UI for the Temporal Sync Feature, made the software more robust including:

-Settings window can only be opened once
    -When the client can't open a device, it tries multiple times
    -Recording bins are now saved with a unique ID per device, to allow multiple clients to record on the same PC
    -Synchronized & Unsynchronized devices can be both used in one server
    -Included a workaround for a bug in the Azure Kinect SDK regarding exposure (microsoft/Azure-Kinect-Sensor-SDK#1378)
This commit is contained in:
Christopher Remde
2020-10-14 23:21:18 +02:00
parent 2b15ed0f5b
commit 76bf5e9dba
15 changed files with 744 additions and 129 deletions
+14 -4
View File
@@ -3,7 +3,9 @@
#include "stdafx.h"
#include "ICapture.h"
#include <k4a/k4a.h>
#include "utils.h"
#include <iostream>
using namespace std;
//#include "utils.h"
class AzureKinectCapture : public ICapture
{
@@ -11,15 +13,17 @@ public:
AzureKinectCapture();
~AzureKinectCapture();
bool Initialize(bool asMaster, bool asSubOrdinate, int syncOffset);
bool Close();
bool Initialize(SYNC_STATE state, int syncOffset);
bool AcquireFrame();
bool Close();
void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapDepthFrameToColorSpace(UINT16 *pDepthInColorSpace);
void MapColorFrameToDepthSpace(RGB *pColorInDepthSpace);
int GetSyncJackState();
uint64_t GetTimeStamp();
int GetDeviceIndex();
void SetExposureState(bool enableAutoExposure, int exposureStep);
private:
@@ -34,6 +38,12 @@ private:
k4a_transformation_t transformation = NULL;
bool syncInConnected = false;
bool syncOutConnected = false;
uint64_t currentTimeStamp;
uint64_t currentTimeStamp = 0;
SYNC_STATE syncState = Standalone;
int deviceIDForRestart = -1;
int restartAttempts = 0;
bool autoExposureEnabled = true;
int exposureTimeStep = 0;
void UpdateDepthPointCloud();
};
@@ -10,13 +10,13 @@ class FrameFileWriterReader
{
public:
FrameFileWriterReader();
void openNewFileForWriting();
void openNewFileForWriting(int deviceID);
void openCurrentFileForReading();
// leave filename blank if you want the filename to be generated from the date
void setCurrentFilename(std::string filename = "");
void writeFrame(std::vector<Point3s> points, std::vector<RGB> colors, uint64_t timestamp);
void writeFrame(std::vector<Point3s> points, std::vector<RGB> colors, uint64_t timestamp, int deviceID);
bool readFrame(std::vector<Point3s> &outPoints, std::vector<RGB> &outColors);
bool openedForWriting() { return m_bFileOpenedForWriting; }
+4 -1
View File
@@ -40,7 +40,7 @@ public:
ICapture();
~ICapture();
virtual bool Initialize(bool asMaster, bool asSubOrdinate, int syncOffset) = 0;
virtual bool Initialize(SYNC_STATE state, int syncOffset) = 0;
virtual bool AcquireFrame() = 0;
virtual bool Close() = 0;
virtual void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0;
@@ -49,6 +49,9 @@ public:
virtual void MapColorFrameToDepthSpace(RGB *pDepthSpacePoints) = 0;
virtual int GetSyncJackState() = 0;
virtual uint64_t GetTimeStamp() = 0;
virtual int GetDeviceIndex() = 0;
virtual void SetExposureState(bool enableAutoExposure, int exposureStep) = 0;
bool bInitialized;
+5 -1
View File
@@ -18,7 +18,7 @@
#include "ImageRenderer.h"
#include "SocketCS.h"
#include "calibration.h"
#include "utils.h"
//#include "utils.h"
#include "azureKinectCapture.h"
#include "frameFileWriterReader.h"
#include <thread>
@@ -45,6 +45,7 @@ private:
bool m_bIsMaster;
bool m_bIsSubOrdinate;
bool m_bRestartingCamera;
ICapture *pCapture;
@@ -56,10 +57,13 @@ private:
bool m_bConfirmCaptured;
bool m_bConfirmTempSyncState;
bool m_bConfirmSubOrdinateStarted;
bool m_bConfirmRestartAsMaster;
bool m_bConfirmCalibrated;
bool m_bShowDepth;
bool m_bFrameCompression;
int m_iCompressionLevel;
bool m_bAutoExposureEnabled;
int m_nExposureStep;
enum tempSyncConfig { MASTER, SUBORDINATE, STANDALONE };
tempSyncConfig currentTempSyncState;
+12 -2
View File
@@ -30,7 +30,8 @@ enum INCOMING_MESSAGE_TYPE
MSG_CLEAR_STORED_FRAMES,
MSG_SET_TEMPSYNC_ON,
MSG_SET_TEMPSYNC_OFF,
MSG_START_MASTER
MSG_START_MASTER,
MSG_REQUEST_SYNC_JACK_STATE,
};
enum OUTGOING_MESSAGE_TYPE
@@ -39,7 +40,16 @@ enum OUTGOING_MESSAGE_TYPE
MSG_CONFIRM_CALIBRATED,
MSG_STORED_FRAME,
MSG_LAST_FRAME,
MSG_CONFIRM_TEMP_SYNC_STATUS
MSG_CONFIRM_TEMP_SYNC_STATUS,
MSG_CONFIRM_MASTER_RESTART,
MSG_SYNC_JACK_STATE
};
enum SYNC_STATE
{
Subordinate,
Master,
Standalone
};
typedef struct Point3f