how to use the following portion?
how to get 3D position using the following API ?
mapper.MapDepthPointToWorldSpace(new Vector3D(x, y, depthValue));
void PrintDepth(Astra.DepthFrame depthFrame,
Astra.CoordinateMapper mapper)
{
if (depthFrame != null)
{
int width = depthFrame.Width;
int height = depthFrame.Height;
long frameIndex = depthFrame.FrameIndex;
//determine if buffer needs to be reallocated
if (width != _lastWidth || height != _lastHeight)
{
_buffer = new short[width * height];
_lastWidth = width;
_lastHeight = height;
}
depthFrame.CopyData(ref _buffer);
int index = (int)((width * (height / 2.0f)) + (width / 2.0f));
short middleDepth = _buffer[index];
Vector3D worldPoint = mapper.MapDepthPointToWorldSpace(new Vector3D(width / 2.0f, height / 2.0f, middleDepth));
Vector3D depthPoint = mapper.MapWorldPointToDepthSpace(worldPoint);
Debug.Log("depth frameIndex: " + frameIndex
+ " width: " + width
+ " height: " + height
+ " middleDepth: " + middleDepth
+ " wX: " + worldPoint.X
+ " wY: " + worldPoint.Y
+ " wZ: " + worldPoint.Z
+ " dX: " + depthPoint.X
+ " dY: " + depthPoint.Y
+ " dZ: " + depthPoint.Z + " frameCount: " + _frameCount);
}
}
There is no template and no example for the implementation of this part.
Any help or a small script would be highly appreciable.
Prasanna.