invisible

view 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
line source
1 #include <cv.h>
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <string.h>
6 #include "frame.h"
7 #include "kinect.h"
9 extern Frame *frame;
10 extern KinectParams *kin_params;
12 extern bool has_video;
13 extern bool has_depth;
15 Frame::Frame()
16 {
17 if(video_buf.empty()) {
18 video_buf = cv::Mat(FREENECT_VIDEO_WIDTH, FREENECT_VIDEO_HEIGHT, CV_32FC3, cv::Scalar(0, 0, 0));
19 }
20 if(depth_buf.empty()) {
21 depth_buf = cv::Mat(FREENECT_DEPTH_WIDTH, FREENECT_VIDEO_HEIGHT, CV_16UC1, 0);
22 }
23 }
25 void Frame::process()
26 {
27 if(has_video && has_depth)
28 printf("Depth and Rgb\n");
29 }
31 void video_cb(freenect_device *kin_dev, void *video, uint32_t time)
32 {
33 if(!video) {
34 has_video = false;
35 return;
36 }
38 //copy *video to video_buf if fail => has_video = false
39 has_video = true;
40 }
42 void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time)
43 {
44 if(!depth) {
45 has_depth = false;
46 return;
47 }
49 has_depth = true;
50 }