# HG changeset patch # User Eleni Maria Stea # Date 1383517754 -7200 # Node ID 6f5f53d0d16624ddabdac3f11f6120bdfd900298 # Parent bd1b0385a10b84c932f492300359354794f34a17 use 8bit mat to save depth frames to avoid convertions during inpaint diff -r bd1b0385a10b -r 6f5f53d0d166 src/frame.cc --- a/src/frame.cc Sun Nov 03 22:07:00 2013 +0200 +++ b/src/frame.cc Mon Nov 04 00:29:14 2013 +0200 @@ -1,5 +1,7 @@ #include #include +#include + #include //TODO remove #include //TODO remove @@ -19,7 +21,7 @@ Frame::Frame() { video_buf = cv::Mat::zeros(KINECT_VIDEO_HEIGHT, KINECT_VIDEO_WIDTH, CV_8UC3); - depth_buf = cv::Mat::zeros(KINECT_DEPTH_HEIGHT, KINECT_DEPTH_WIDTH, CV_16UC1); + depth_buf = cv::Mat::zeros(KINECT_DEPTH_HEIGHT, KINECT_DEPTH_WIDTH, CV_8UC1); tex_setup(); } @@ -83,20 +85,19 @@ /* freenect depth data to cv mat: */ uint16_t* src = (uint16_t*)depth; - uint16_t* dest = (uint16_t*)frame->depth_buf.data; + uint8_t* dest = (uint8_t*)frame->depth_buf.data; for(int i=0; i= 2047) { val = 0; } - val = val << 5; - *dest = val; + *dest = val >> 3; src++; dest++; } - + cv::medianBlur(frame->depth_buf, frame->depth_buf, 5); cv::imshow("foo", frame->depth_buf); cv::waitKey(100); has_depth = true;