invisible

annotate src/frame.cc @ 2:b0b90ef993a0

backup
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Wed, 09 Oct 2013 22:56:42 +0300
parents fdbd55eaa14e
children 1ff5a1a50b41
rev   line source
eleni@2 1 #include <cv.h>
eleni@2 2 #include <pthread.h>
eleni@1 3 #include <stdio.h>
eleni@2 4 #include <string.h>
eleni@1 5
eleni@1 6 #include "frame.h"
eleni@2 7 #include "kinect.h"
eleni@1 8
eleni@2 9 extern Frame *frame;
eleni@2 10 extern KinectParams *kin_params;
eleni@1 11
eleni@2 12 extern bool has_video;
eleni@2 13 extern bool has_depth;
eleni@2 14
eleni@2 15 Frame::Frame()
eleni@1 16 {
eleni@2 17 if(video_buf.empty()) {
eleni@2 18 video_buf = cv::Mat(FREENECT_VIDEO_WIDTH, FREENECT_VIDEO_HEIGHT, CV_32FC3, cv::Scalar(0, 0, 0));
eleni@2 19 }
eleni@2 20 if(depth_buf.empty()) {
eleni@2 21 depth_buf = cv::Mat(FREENECT_DEPTH_WIDTH, FREENECT_VIDEO_HEIGHT, CV_16UC1, 0);
eleni@2 22 }
eleni@1 23 }
eleni@1 24
eleni@2 25 void Frame::process()
eleni@1 26 {
eleni@2 27 if(has_video && has_depth)
eleni@2 28 printf("Depth and Rgb\n");
eleni@2 29 }
eleni@2 30
eleni@2 31 void video_cb(freenect_device *kin_dev, void *video, uint32_t time)
eleni@2 32 {
eleni@2 33 if(!video) {
eleni@2 34 has_video = false;
eleni@2 35 return;
eleni@2 36 }
eleni@2 37
eleni@2 38 //copy *video to video_buf if fail => has_video = false
eleni@2 39 has_video = true;
eleni@1 40 }
eleni@1 41
eleni@1 42 void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time)
eleni@1 43 {
eleni@2 44 if(!depth) {
eleni@2 45 has_depth = false;
eleni@2 46 return;
eleni@2 47 }
eleni@2 48
eleni@2 49 has_depth = true;
eleni@1 50 }