I am using the openkinect with python bindings and running the following demo app...
#!/usr/bin/env python
import freenect
import cv
import frame_convert
cv.NamedWindow('Depth')
cv.NamedWindow('Video')
print('Press ESC in window to stop')
def get_depth():
return frame_convert.pretty_depth_cv(freenect.sync_get_depth()[0])
def get_video():
return frame_convert.video_cv(freenect.sync_get_video()[0])
while 1:
cv.ShowImage('Depth', get_depth())
cv.ShowImage('Video', get_video())
if cv.WaitKey(10) == 27:
break
When I press escape this program does not stop. So I have tried to execute it as follows
#!/usr/bin/env python
import freenect
import cv
import frame_convert
cv.NamedWindow('Depth')
cv.NamedWindow('Video')
print('Press ESC in window to stop')
def get_depth():
return frame_convert.pretty_depth_cv(freenect.sync_get_depth()[0])
def get_video():
return frame_convert.video_cv(freenect.sync_get_video()[0])
for i in range(10):
cv.ShowImage('Depth', get_depth())
cv.ShowImage('Video', get_video())
if cv.WaitKey(10) == 27:
break
to execute it 10 times only.
The problem is that the program never stops and keep displaying the images. I think that one needs to stop kinect.
I want to take the depth image at a specific time instance. So it means that the kinect has to be restarted. I cant keep it executing all the time.
Could anybody help me in this please.