@@ -49,6 +49,8 @@ cdef extern from "libfreenect.h":
4949 FREENECT_DEPTH_10BIT
5050 FREENECT_DEPTH_11BIT_PACKED
5151 FREENECT_DEPTH_10BIT_PACKED
52+ FREENECT_DEPTH_REGISTERED
53+ FREENECT_DEPTH_MM
5254
5355 ctypedef enum freenect_led_options :
5456 FREENECT_LED_OFF "LED_OFF"
@@ -148,6 +150,8 @@ DEPTH_11BIT = FREENECT_DEPTH_11BIT
148150DEPTH_10BIT = FREENECT_DEPTH_10BIT
149151DEPTH_11BIT_PACKED = FREENECT_DEPTH_11BIT_PACKED
150152DEPTH_10BIT_PACKED = FREENECT_DEPTH_10BIT_PACKED
153+ DEPTH_REGISTERED = FREENECT_DEPTH_REGISTERED
154+ DEPTH_MM = FREENECT_DEPTH_MM
151155LED_OFF = FREENECT_LED_OFF
152156LED_GREEN = FREENECT_LED_GREEN
153157LED_RED = FREENECT_LED_RED
@@ -278,7 +282,7 @@ cpdef init():
278282 # to both but haven't wrapped the python API for selecting subdevices yet.
279283 # Also, we don't support audio in the python wrapper yet, so no sense claiming
280284 # the device.
281- freenect_select_subdevices (ctx , FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA )
285+ freenect_select_subdevices (ctx , < freenect_device_flags > ( FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA ) )
282286 cdef CtxPtr ctx_out
283287 ctx_out = CtxPtr ()
284288 ctx_out ._ptr = ctx
@@ -369,16 +373,19 @@ def runloop(depth=None, video=None, body=None, dev=None):
369373 if not mdev :
370374 error_open_device ()
371375 return
376+ if depth is not None :
377+ freenect_set_depth_mode (mdev ._ptr , freenect_find_depth_mode (FREENECT_RESOLUTION_MEDIUM , FREENECT_DEPTH_11BIT ))
378+ if video is not None :
379+ freenect_set_video_mode (mdev ._ptr , freenect_find_video_mode (FREENECT_RESOLUTION_MEDIUM , FREENECT_VIDEO_RGB ))
380+
372381 else :
373382 mdev = dev
374383 devp = mdev ._ptr
375384 ctxp = mdev .ctx ._ptr
376385 if depth is not None :
377- freenect_set_depth_mode (devp , freenect_find_depth_mode (FREENECT_RESOLUTION_MEDIUM , FREENECT_DEPTH_11BIT ))
378386 freenect_start_depth (devp )
379387 freenect_set_depth_callback (devp , depth_cb )
380388 if video is not None :
381- freenect_set_video_mode (devp , freenect_find_video_mode (FREENECT_RESOLUTION_MEDIUM , FREENECT_VIDEO_RGB ))
382389 freenect_start_video (devp )
383390 freenect_set_video_callback (devp , video_cb )
384391 try :
@@ -476,7 +483,7 @@ def sync_get_depth(index=0, format=DEPTH_11BIT):
476483 if out :
477484 error_open_device ()
478485 return
479- if format == DEPTH_11BIT :
486+ if format in ( DEPTH_11BIT , DEPTH_10BIT , DEPTH_MM , DEPTH_REGISTERED ) :
480487 dims [0 ], dims [1 ] = 480 , 640
481488 return PyArray_SimpleNewFromData (2 , dims , npc .NPY_UINT16 , data ), timestamp
482489 else :
0 commit comments