Skip to content

Commit 175eff9

Browse files
committed
added demo for high res, added hack to disable whitebalance/autogain
1 parent dc776c0 commit 175eff9

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

wrappers/c_sync/libfreenect_sync.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ int freenect_sync_get_video_with_res(void **video, uint32_t *timestamp, int inde
374374
if (!thread_running || !kinects[index] || kinects[index]->video.fmt != fmt || kinects[index]->video.res != res)
375375
if (setup_kinect(index, res, fmt, 0))
376376
return -1;
377+
//hack to turn off autogain and white balance - pgaskell
378+
freenect_set_flag(kinects[index]->dev, FREENECT_AUTO_EXPOSURE, FREENECT_OFF);
379+
freenect_set_flag(kinects[index]->dev, FREENECT_AUTO_WHITE_BALANCE, FREENECT_OFF);
380+
//end hack
377381
sync_get(video, timestamp, &kinects[index]->video);
378382
return 0;
379383
}
@@ -394,6 +398,7 @@ int freenect_sync_get_depth_with_res(void **depth, uint32_t *timestamp, int inde
394398
|| kinects[index]->depth.res != res)
395399
if (setup_kinect(index, res, fmt, 1))
396400
return -1;
401+
397402
sync_get(depth, timestamp, &kinects[index]->depth);
398403
return 0;
399404
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
import freenect
3+
import cv2
4+
import frame_convert2
5+
6+
cv2.namedWindow('Depth')
7+
cv2.namedWindow('Video')
8+
print('Press ESC in window to stop')
9+
10+
11+
def get_depth():
12+
return frame_convert2.pretty_depth_cv(freenect.sync_get_depth_with_res(format = freenect.DEPTH_11BIT)[0])
13+
14+
15+
def get_video():
16+
return frame_convert2.video_cv(freenect.sync_get_video_with_res(resolution=freenect.RESOLUTION_HIGH)[0])
17+
18+
19+
while 1:
20+
cv2.imshow('Depth', get_depth())
21+
cv2.imshow('Video', get_video())
22+
if cv2.waitKey(10) == 27:
23+
break

0 commit comments

Comments
 (0)