kniectを使用してOpenCV 3.2.1でVS2010を実行しています。
ここからチュートリアルを使用しています
int main( int argc, char* argv[] ){
VideoCapture capture(CV_CAP_OPENNI); // or CV_CAP_OPENNI
for(;;)
{
Mat depthMap;
Mat bgrImage;
capture.grab();
capture.retrieve( depthMap, CV_CAP_OPENNI_DEPTH_MAP ); // Depth values in mm (CV_16UC1)
capture.retrieve( bgrImage, CV_CAP_OPENNI_BGR_IMAGE );
cout << "rows: " << depthMap.rows << " cols: " << depthMap.cols << endl;
cout << "depth: " << depthMap.at<int>(0,0) << endl;
imshow("RGB image", bgrImage);
if( waitKey( 30 ) >= 0 )
break;
}h
return 0;
コードを実行すると、次の結果が得られます。
約1メートル離れた壁の近く:
rows: 480 cols: 640
depth: 1157
rows: 480 cols: 640
depth: 1157
rows: 480 cols: 640
depth: 1157
rows: 480 cols: 640
depth: 1157
(Kinect を壁に向け、1 メートルほど離れたところに配置)
rows: 480 cols: 640
depth: 83690629
rows: 480 cols: 640
depth: 83690629
rows: 480 cols: 640
depth: 83690629
rows: 480 cols: 640
depth: 83690629
rows: 480 cols: 640
depth: 83690629
これらの値は実際には 2 ピクセルであると言われました。私は本当に理解していません。
したがって、これまでの私の理解は次のとおりです。
深度フレームを取得し、depthMap というマトリックス内に格納しました。マトリックスのサイズは 640*480 になりました。コード depthMap.at(0,0) を使用して、行 0、列 0 から最初の深度値を取得しています。これは、私が期待している最大値の 10000 から大きく外れています
これらの値を利用できるように、これらの値をミリメートルに変換するにはどうすればよいですか? ありがとうございました