Hi, I'm developing an 3D visualization app for Azure Kinect DK in C / C ++.
In case of Kinect v2, I can get the color 2D coordinates(x,y) of each pixel of the Depth camera using ICoordinateMapper-> MapDepthFrameToColorSpace() at high speed.
I used to draw a body mesh with color-camera-resolution image in real time.
(Refer 22sec-35sec : https://youtu.be/NERfvP4JwB0?t=22)
How can I get the same thing faster with the Azure Kinect DK?
My current code is below and it takes 50-60ms only in this part.
unsigned short depthBuffFromK4a = (unsigned short)k4a_image_get_buffer(image);
k4a_float2_t pixPosDin;
k4a_float2_t pixPosCout;
k4a_result_t apiResult;
int valid;
unsigned int buffPos = 0;
for (int y = 0; y < _bufferHeightD; ++y) {
for (int x = 0; x < _bufferWidthD; ++x) {
pixPosDin.xy.x = (float)x;
pixPosDin.xy.y = (float)y;
//2d_2d function
result = k4a_calibration_2d_to_2d(
&_calibration,
&pixPosDin,
static_cast<float>(depthBuffFromK4a[buffPos]),
K4A_CALIBRATION_TYPE_DEPTH,
K4A_CALIBRATION_TYPE_COLOR,
&pixPosCout,
&valid
);
if (result == K4A_RESULT_SUCCEEDED && valid == 1) {
//----description for valid value----//
}
else {
//----error description----//
}
++buffPos;
}
}
I also tried multithreading, but 25ms was the limit.
Can you tell me how to get the data at high speed?
Thank you for reading.