私は現在、XNAでkinectを使用して手/指のトラッキングを作成しようとしています。このためには、プログラムでレンダリングする深度範囲を指定できる必要があります。私は見回しましたが、これがどのように行われるのかわかりません。私の知る限り、kinectの深度値は、depthStreamにある事前設定された範囲でのみ機能します。
私がやりたいのは、kinectがレンダリングする深度範囲を変更できるように、モジュール化することです。私はこれが以前にダウンしていることを知っていますが、これを行う方法を私に示すことができるものをオンラインで見つけることができません。
誰かが私を助けてくれませんか?
Kinectを使用して標準の深度ビューをレンダリングできるようにしました。深度フレームを変換する方法は次のとおりです(ここで設定する必要があると感じています)
private byte[] ConvertDepthFrame(short[] depthFrame, DepthImageStream depthStream, int depthFrame32Length)
{
int tooNearDepth = depthStream.TooNearDepth;
int tooFarDepth = depthStream.TooFarDepth;
int unknownDepth = depthStream.UnknownDepth;
byte[] depthFrame32 = new byte[depthFrame32Length];
for (int i16 = 0, i32 = 0; i16 < depthFrame.Length && i32 < depthFrame32.Length; i16++, i32 += 4)
{
int player = depthFrame[i16] & DepthImageFrame.PlayerIndexBitmask;
int realDepth = depthFrame[i16] >> DepthImageFrame.PlayerIndexBitmaskWidth;
// transform 13-bit depth information into an 8-bit intensity appropriate
// for display (we disregard information in most significant bit)
byte intensity = (byte)(~(realDepth >> 8));
if (player == 0 && realDepth == 00)
{
// white
depthFrame32[i32 + RedIndex] = 255;
depthFrame32[i32 + GreenIndex] = 255;
depthFrame32[i32 + BlueIndex] = 255;
}
// omitted other if statements. Simple changed the color of the pixels if they went out of the pre=set depth values
else
{
// tint the intensity by dividing by per-player values
depthFrame32[i32 + RedIndex] = (byte)(intensity >> IntensityShiftByPlayerR[player]);
depthFrame32[i32 + GreenIndex] = (byte)(intensity >> IntensityShiftByPlayerG[player]);
depthFrame32[i32 + BlueIndex] = (byte)(intensity >> IntensityShiftByPlayerB[player]);
}
}
return depthFrame32;
}
intplayerとintrealDepthの値を変更する必要があるという強い予感がありますが、確信が持てません。