eleni@2: #include eleni@2: #include eleni@1: #include eleni@2: #include eleni@1: eleni@1: #include "frame.h" eleni@2: #include "kinect.h" eleni@1: eleni@2: extern Frame *frame; eleni@2: extern KinectParams *kin_params; eleni@1: eleni@2: extern bool has_video; eleni@2: extern bool has_depth; eleni@2: eleni@2: Frame::Frame() eleni@1: { eleni@2: if(video_buf.empty()) { eleni@2: video_buf = cv::Mat(FREENECT_VIDEO_WIDTH, FREENECT_VIDEO_HEIGHT, CV_32FC3, cv::Scalar(0, 0, 0)); eleni@2: } eleni@2: if(depth_buf.empty()) { eleni@2: depth_buf = cv::Mat(FREENECT_DEPTH_WIDTH, FREENECT_VIDEO_HEIGHT, CV_16UC1, 0); eleni@2: } eleni@1: } eleni@1: eleni@2: void Frame::process() eleni@1: { eleni@2: if(has_video && has_depth) eleni@2: printf("Depth and Rgb\n"); eleni@2: } eleni@2: eleni@2: void video_cb(freenect_device *kin_dev, void *video, uint32_t time) eleni@2: { eleni@2: if(!video) { eleni@2: has_video = false; eleni@2: return; eleni@2: } eleni@2: eleni@2: //copy *video to video_buf if fail => has_video = false eleni@2: has_video = true; eleni@1: } eleni@1: eleni@1: void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time) eleni@1: { eleni@2: if(!depth) { eleni@2: has_depth = false; eleni@2: return; eleni@2: } eleni@2: eleni@2: has_depth = true; eleni@1: }