Finalized depth_image_to_Color_Camera mapping, added dynamic resize of the Color Image via OpenCV for improved performance and improved performance on the StoreFrame function by avoiding "vector.push_back"

This commit is contained in:
Christopher Remde
2020-07-02 13:50:24 +02:00
parent 4a4f9ae0ad
commit 00383d8867
25 changed files with 220 additions and 120 deletions
+14 -2
View File
@@ -3,7 +3,10 @@
#include "stdafx.h"
#include "ICapture.h"
#include <k4a/k4a.h>
#include <opencv2/opencv.hpp>
#include "utils.h"
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
class AzureKinectCapture : public ICapture
{
@@ -17,16 +20,25 @@ public:
void MapColorFrameToCameraSpace(Point3f *pCameraSpacePoints);
void MapDepthFrameToColorSpace(UINT16 *pDepthInColorSpace);
void MapColorFrameToDepthSpace(RGB *pColorInDepthSpace);
k4a_image_t Downscale_image_2x2_binning(const k4a_image_t color_image);
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 pointCloudImage = NULL;
k4a_image_t transformed_depth_image = NULL;
k4a_image_t colorImageInDepth = NULL;
k4a_image_t depthImageInColor = NULL;
k4a_image_t color_image_downscaled = NULL;
int color_image_downscaled_width;
int color_image_downscaled_height;
k4a_transformation_t transformation = NULL;
k4a_transformation_t transformation_color_downscaled = NULL;
k4a_image_t opencv_to_k4a_image(const cv::Mat cImg);
cv::Mat color_to_opencv(const k4a_image_t im);
void UpdateDepthPointCloud();
void UpdateDepthPointCloudForColorFrame();
};
+1 -1
View File
@@ -73,7 +73,7 @@ private:
DWORD m_nFramesSinceUpdate;
Point3f* m_pCameraSpaceCoordinates;
RGB* m_pColorInDepthSpace;
RGB* m_pColorInColorSpace;
UINT16* m_pDepthInColorSpace;
// Direct2D
+10
View File
@@ -45,16 +45,26 @@ typedef struct Point3f
this->X = 0;
this->Y = 0;
this->Z = 0;
this->Invalid = false;
}
Point3f(float X, float Y, float Z, bool invalid)
{
this->X = X;
this->Y = Y;
this->Z = Z;
this->Invalid = invalid;
}
Point3f(float X, float Y, float Z)
{
this->X = X;
this->Y = Y;
this->Z = Z;
this->Invalid = false;
}
float X;
float Y;
float Z;
bool Invalid = false;
} Point3f;
typedef struct Point3s