I have a python openCV program that uses a webcam to track an image target. I switched computers, but this new computer does not have a webcam. I hooked up my kinect, installed stome stuff from OpenKinect.org (can now use glview
), and would like to use the Kinect camera as a webcam for this program. How can I do this? The program I wrote is:
http://pastebin.com/usspQXNU
2 Answers
Newer kernels (3.0 or higher IIRC) support using the Kinect's RGB camera as a regular webcam. Suppose the Kinect camera is /dev/video0, you can run this command to get a video stream:
$ gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv ! ffmpegcolorspace ! xvimagesink
That means OpenCV's highgui.cvCreateCameraCapture(0)
should also just work (with 0 as the id for the Kinect camera).
You can check if the modules are loaded with this command:
$ lsmod | grep -i gspca
gspca_kinect 12936 0
gspca_main 28366 1 gspca_kinect
videodev 98259 2 gspca_main,uvcvideo
Try this may help you https://github.com/wildbillcat/KinectCam/
One more thing, I have same problem but with kinect v2 not kinect v1