Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- how to get depth values and then convert to millimetres in OpenCV with Kinect?
- 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;
- rows: 480 cols: 640
- depth: 1157
- rows: 480 cols: 640
- depth: 1157
- rows: 480 cols: 640
- depth: 1157
- rows: 480 cols: 640
- depth: 1157
- 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
Add Comment
Please, Sign In to add comment