mirror of
https://github.com/storytold/LiveScan3D.git
synced 2026-10-09 00:09:58 +00:00
Working with Azure Kinect but without body and only single sensor per machine
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ICapture.h"
|
||||
#include <k4a/k4a.h>
|
||||
#include "utils.h"
|
||||
|
||||
class AzureKinectCapture : public ICapture
|
||||
{
|
||||
public:
|
||||
AzureKinectCapture();
|
||||
~AzureKinectCapture();
|
||||
|
||||
bool Initialize();
|
||||
bool Initialize(int deviceIdx);
|
||||
bool AcquireFrame();
|
||||
void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints);
|
||||
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
|
||||
void MapDepthFrameToColorSpace(UINT16 *pDepthInColorSpace);
|
||||
void MapColorFrameToDepthSpace(RGB *pColorInDepthSpace);
|
||||
private:
|
||||
k4a_device_t kinectSensor = NULL;
|
||||
int32_t captureTimeoutMs = 1000;
|
||||
|
||||
k4a_image_t colorImage = NULL;
|
||||
k4a_image_t depthImage = NULL;
|
||||
k4a_image_t depthPointCloudImage = NULL;
|
||||
k4a_image_t colorImageInDepth = NULL;
|
||||
k4a_image_t depthImageInColor = NULL;
|
||||
k4a_transformation_t transformation = NULL;
|
||||
|
||||
void UpdateDepthPointCloud();
|
||||
};
|
||||
@@ -12,9 +12,9 @@ public:
|
||||
FrameFileWriterReader();
|
||||
void openNewFileForWriting();
|
||||
void openCurrentFileForReading();
|
||||
|
||||
|
||||
// leave filename blank if you want the filename to be generated from the date
|
||||
void setCurrentFilename(std::string filename = "");
|
||||
void setCurrentFilename(std::string filename = "");
|
||||
|
||||
void writeFrame(std::vector<Point3s> points, std::vector<RGB> colors);
|
||||
bool readFrame(std::vector<Point3s> &outPoints, std::vector<RGB> &outColors);
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
int getRecordingTimeMilliseconds();
|
||||
|
||||
FILE *m_pFileHandle = nullptr;
|
||||
bool m_bFileOpenedForWriting = false;
|
||||
bool m_bFileOpenedForWriting = false;
|
||||
bool m_bFileOpenedForReading = false;
|
||||
|
||||
std::string m_sFilename = "";
|
||||
|
||||
@@ -15,15 +15,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils.h"
|
||||
#include "Kinect.h"
|
||||
|
||||
struct Joint
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct Body
|
||||
{
|
||||
Body()
|
||||
{
|
||||
bTracked = false;
|
||||
vJoints.resize(JointType_Count);
|
||||
vJointsInColorSpace.resize(JointType_Count);
|
||||
vJoints.resize(5);
|
||||
vJointsInColorSpace.resize(5);
|
||||
}
|
||||
bool bTracked;
|
||||
std::vector<Joint> vJoints;
|
||||
@@ -40,8 +44,8 @@ public:
|
||||
virtual bool AcquireFrame() = 0;
|
||||
virtual void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0;
|
||||
virtual void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints) = 0;
|
||||
virtual void MapDepthFrameToColorSpace(Point2f *pColorSpacePoints) = 0;
|
||||
virtual void MapColorFrameToDepthSpace(Point2f *pDepthSpacePoints) = 0;
|
||||
virtual void MapDepthFrameToColorSpace(UINT16 *pColorSpacePoints) = 0;
|
||||
virtual void MapColorFrameToDepthSpace(RGB *pDepthSpacePoints) = 0;
|
||||
|
||||
bool bInitialized;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
UINT m_sourceWidth;
|
||||
LONG m_sourceStride;
|
||||
|
||||
// Direct2D
|
||||
// Direct2D
|
||||
ID2D1Factory* m_pD2DFactory;
|
||||
ID2D1HwndRenderTarget* m_pRenderTarget;
|
||||
ID2D1Bitmap* m_pBitmap;
|
||||
@@ -64,12 +64,12 @@ private:
|
||||
HRESULT EnsureResources();
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of Direct2d resources
|
||||
/// Dispose of Direct2d resources
|
||||
/// </summary>
|
||||
void DiscardResources();
|
||||
|
||||
void DrawBody(Body &body);
|
||||
void DrawBone(Body &body, JointType joint0, JointType joint1);
|
||||
//void DrawBody(Body &body);
|
||||
//void DrawBone(Body &body, JointType joint0, JointType joint1);
|
||||
|
||||
ID2D1SolidColorBrush* m_pBrushJointTracked;
|
||||
ID2D1SolidColorBrush* m_pBrushJointInferred;
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (C) 2015 Marek Kowalski (M.Kowalski@ire.pw.edu.pl), Jacek Naruniec (J.Naruniec@ire.pw.edu.pl)
|
||||
// License: MIT Software License See LICENSE.txt for the full license.
|
||||
|
||||
// If you use this software in your research, then please use the following citation:
|
||||
|
||||
// Kowalski, M.; Naruniec, J.; Daniluk, M.: "LiveScan3D: A Fast and Inexpensive 3D Data
|
||||
// Acquisition System for Multiple Kinect v2 Sensors". in 3D Vision (3DV), 2015 International Conference on, Lyon, France, 2015
|
||||
|
||||
// @INPROCEEDINGS{Kowalski15,
|
||||
// author={Kowalski, M. and Naruniec, J. and Daniluk, M.},
|
||||
// booktitle={3D Vision (3DV), 2015 International Conference on},
|
||||
// title={LiveScan3D: A Fast and Inexpensive 3D Data Acquisition System for Multiple Kinect v2 Sensors},
|
||||
// year={2015},
|
||||
// }
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ICapture.h"
|
||||
#include "Kinect.h"
|
||||
#include "utils.h"
|
||||
|
||||
class KinectCapture : public ICapture
|
||||
{
|
||||
public:
|
||||
KinectCapture();
|
||||
~KinectCapture();
|
||||
|
||||
bool Initialize();
|
||||
bool AcquireFrame();
|
||||
void MapDepthFrameToCameraSpace(Point3f *pCameraSpacePoints);
|
||||
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
|
||||
void MapDepthFrameToColorSpace(Point2f *pColorSpacePoints);
|
||||
void MapColorFrameToDepthSpace(Point2f *pDepthSpacePoints);
|
||||
private:
|
||||
ICoordinateMapper* pCoordinateMapper;
|
||||
IKinectSensor* pKinectSensor;
|
||||
IMultiSourceFrameReader* pMultiSourceFrameReader;
|
||||
|
||||
void GetDepthFrame(IMultiSourceFrame* pMultiFrame);
|
||||
void GetColorFrame(IMultiSourceFrame* pMultiFrame);
|
||||
void GetBodyFrame(IMultiSourceFrame* pMultiFrame);
|
||||
void GetBodyIndexFrame(IMultiSourceFrame* pMultiFrame);
|
||||
};
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "SocketCS.h"
|
||||
#include "calibration.h"
|
||||
#include "utils.h"
|
||||
#include "KinectCapture.h"
|
||||
#include "azureKinectCapture.h"
|
||||
#include "frameFileWriterReader.h"
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
@@ -70,11 +70,11 @@ private:
|
||||
INT64 m_nLastCounter;
|
||||
double m_fFreq;
|
||||
INT64 m_nNextStatusTime;
|
||||
DWORD m_nFramesSinceUpdate;
|
||||
DWORD m_nFramesSinceUpdate;
|
||||
|
||||
Point3f* m_pCameraSpaceCoordinates;
|
||||
Point2f* m_pColorCoordinatesOfDepth;
|
||||
Point2f* m_pDepthCoordinatesOfColor;
|
||||
RGB* m_pColorInDepthSpace;
|
||||
UINT16* m_pDepthInColorSpace;
|
||||
|
||||
// Direct2D
|
||||
ImageRenderer* m_pDrawColor;
|
||||
@@ -82,8 +82,8 @@ private:
|
||||
RGB* m_pDepthRGBX;
|
||||
|
||||
void UpdateFrame();
|
||||
void ProcessColor(RGB* pBuffer, int nWidth, int nHeight);
|
||||
void ProcessDepth(const UINT16* pBuffer, int nHeight, int nWidth);
|
||||
void ShowColor();
|
||||
void ShowDepth();
|
||||
|
||||
bool SetStatusMessage(_In_z_ WCHAR* szMessage, DWORD nShowTimeMsec, bool bForce);
|
||||
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
void SendFrame(vector<Point3s> vertices, vector<RGB> RGB, vector<Body> body);
|
||||
|
||||
void SocketThreadFunction();
|
||||
void StoreFrame(Point3f *vertices, Point2f *mapping, RGB *color, vector<Body> &bodies, BYTE* bodyIndex);
|
||||
void StoreFrame(Point3f *vertices, RGB *colorInDepth, vector<Body> &bodies, BYTE* bodyIndex);
|
||||
void ShowFPS();
|
||||
void ReadIPFromFile();
|
||||
void WriteIPToFile();
|
||||
|
||||
Reference in New Issue
Block a user