# HG changeset patch # User Eleni Maria Stea # Date 1383503805 -7200 # Node ID db8f1c036d0e53dcf2a68736b2d5dd6a34016a9b # Parent 700127288dc567e815c75e3890ab2180adc6e670 quick backup - skata o kwdikas diff -r 700127288dc5 -r db8f1c036d0e src/frame.cc --- a/src/frame.cc Thu Oct 24 00:09:13 2013 +0300 +++ b/src/frame.cc Sun Nov 03 20:36:45 2013 +0200 @@ -1,6 +1,7 @@ #include #include #include //TODO remove +#include //TODO remove #include #include @@ -18,7 +19,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_8UC1); + depth_buf = cv::Mat::zeros(KINECT_DEPTH_HEIGHT, KINECT_DEPTH_WIDTH, CV_16UC1); tex_setup(); } @@ -81,16 +82,12 @@ } /* freenect depth data to cv mat: */ - unsigned char* src = (unsigned char*)depth; - unsigned char* dest = frame->depth_buf.data; - for(int i=0; idepth_buf.data, depth, KINECT_DEPTH_WIDTH * KINECT_DEPTH_HEIGHT * 2); - save_depth_ppm(depth, 640, 480); + save_depth_ppm(depth, KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT); + cv::imshow("foo", frame->depth_buf); + cv::waitKey(100); has_depth = true; } @@ -101,16 +98,14 @@ fprintf(stderr, "Failed to open video file for writing.\n"); return false; } - fprintf(fp, "P6\n640 480\n255\n"); -/* unsigned char *ptr = (unsigned char*)video; + fprintf(fp, "P6\n%d %d\n255\n", w, h); + unsigned char *ptr = (unsigned char*)video; for(int i=0; i> 8; + fputc(c, fp); + fputc(c, fp); + fputc(c, fp); } fclose(fp); return true; diff -r 700127288dc5 -r db8f1c036d0e src/frame.h --- a/src/frame.h Thu Oct 24 00:09:13 2013 +0300 +++ b/src/frame.h Sun Nov 03 20:36:45 2013 +0200 @@ -27,4 +27,5 @@ bool save_video_ppm(void *video, int w, int h); bool save_depth_ppm(void *depth, int w, int h); + #endif // FRAME_H_