26 depth, timestamp = freenect.sync_get_depth()
27 depth = 255 * np.logical_and(depth >= current_depth - threshold,
28 depth <= current_depth + threshold)
29 depth = depth.astype(np.uint8)
30 image = cv.CreateImageHeader((depth.shape[1], depth.shape[0]),
33 cv.SetData(image, depth.tostring(),
34 depth.dtype.itemsize * depth.shape[1])
35 cv.ShowImage(
'Depth', image)
42 cv.NamedWindow(
'Depth')
43 cv.NamedWindow(
'Video')
44 cv.CreateTrackbar(
'threshold',
'Depth', threshold, 500, change_threshold)
45 cv.CreateTrackbar(
'depth',
'Depth', current_depth, 2048, change_depth)
47 print(
'Press ESC in window to stop')
53 if cv.WaitKey(10) == 27:
def change_threshold(value)