Skip to content
Browse files

Resolved compilation issues. Now to get it to link...

  • Loading branch information...
1 parent 37b935d commit 74017672e4aa0a296f0d8fc4af1be1c37f197368 @kench kench committed Jun 19, 2011
Showing with 9 additions and 5 deletions.
  1. +1 −1 npapi_plugin/depthjs.cc
  2. +8 −4 npapi_plugin/ocv_freenect.cpp
View
2 npapi_plugin/depthjs.cc
@@ -72,7 +72,7 @@ class Mutex {
class DepthJSDevice : public Freenect::FreenectDevice {
public:
DepthJSDevice(freenect_context *_ctx, int _index)
- : Freenect::FreenectDevice(_ctx, _index), m_buffer_depth(FREENECT_DEPTH_11BIT),m_buffer_video(FREENECT_VIDEO_RGB_SIZE), m_gamma(2048), m_new_rgb_frame(false), m_new_depth_frame(false)
+ : Freenect::FreenectDevice(_ctx, _index), m_buffer_depth(freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT).bytes),m_buffer_video(freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB).bytes), m_gamma(2048), m_new_rgb_frame(false), m_new_depth_frame(false)
{
for( unsigned int i = 0 ; i < 2048 ; i++) {
float v = i/2048.0;
View
12 npapi_plugin/ocv_freenect.cpp
@@ -54,7 +54,8 @@ void depth_cb(freenect_device *dev, void *depth, uint32_t timestamp)
//copy to ocv buf...
//memcpy(depthMat.data, depth, FREENECT_DEPTH_SIZE);
- memcpy(depthMat.datastart, depth, FREENECT_DEPTH_11BIT_SIZE);
+ //memcpy(depthMat.datastart, depth, FREENECT_DEPTH_11BIT_SIZE);
+ memcpy(depthMat.datastart, depth, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT).bytes);
got_frames++;
pthread_cond_signal(&frame_cond);
@@ -67,7 +68,8 @@ void rgb_cb(freenect_device *dev, void *rgb, uint32_t timestamp)
got_frames++;
//copy to ocv_buf..
//memcpy(rgbMat.data, rgb, FREENECT_RGB_SIZE);
- memcpy(rgbMat.datastart, rgb, FREENECT_VIDEO_RGB_SIZE);
+ //memcpy(rgbMat.datastart, rgb, FREENECT_VIDEO_RGB_SIZE);
+ memcpy(rgbMat.datastart, rgb, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB).bytes);
pthread_cond_signal(&frame_cond);
pthread_mutex_unlock(&buf_mutex);
@@ -130,8 +132,10 @@ int initFreenect() {
//freenect_set_rgb_callback(f_dev, rgb_cb);
//freenect_set_rgb_format(f_dev, FREENECT_FORMAT_RGB);
freenect_set_video_callback(f_dev, rgb_cb);
- freenect_set_video_format(f_dev, FREENECT_VIDEO_RGB);
- freenect_set_depth_format(f_dev, FREENECT_DEPTH_11BIT);
+ //freenect_set_video_format(f_dev, FREENECT_VIDEO_RGB);
+ //freenect_set_depth_format(f_dev, FREENECT_DEPTH_11BIT);
+ freenect_set_video_mode(f_dev, freenect_find_video_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_VIDEO_RGB));
+ freenect_set_depth_mode(f_dev, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT));
freenect_start_depth(f_dev);
freenect_start_video(f_dev);

0 comments on commit 7401767

Please sign in to comment.
Something went wrong with that request. Please try again.