[英]Display IR image from XBOX 360 using Open Kinect via Python and OpenCV
I would like to display on the computer screen the infra-red camera using an XBox Kinect 360. This code below will open a new frame but the display is just a back frame and not the IR video feed.我想使用 XBox Kinect 360 在计算机屏幕上显示红外摄像头。下面的代码将打开一个新帧,但显示只是一个后帧而不是 IR 视频馈送。 How can I get the frame to display the IR image?
如何让框架显示红外图像?
#!/usr/bin/python
import freenect
import cv2
def get_video():
array,_ = freenect.sync_get_video(0,freenect.VIDEO_IR_10BIT)
return array
if __name__ == "__main__":
while 1:
#get a frame from RGB camera
frame = get_video()
#display IR image
cv2.imshow('IR image',frame)
# quit program when 'esc' key is pressed
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
Thanks for the clues Robert Prevost!感谢罗伯特普雷沃斯特的线索! This code returns a frame showing the IR image.
此代码返回一个显示红外图像的帧。
#!/usr/bin/python
import freenect
import numpy as np
import cv2
def get_video():
array,_ = freenect.sync_get_video(0,freenect.VIDEO_IR_10BIT)
return array
def pretty_depth(depth):
np.clip(depth, 0, 2**10-1, depth)
depth >>=2
depth=depth.astype(np.uint8)
return depth
if __name__ == "__main__":
while 1:
#get a frame from RGB camera
frame = get_video()
#display IR image
frame = pretty_depth(frame)
cv2.imshow('IR image',frame)
# quit program when 'esc' key is pressed
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.