OpenKinect / libfreenect2

Open source drivers for the Kinect for Windows v2 device
2.08k stars 752 forks source link

How do I use Kinect v2 as webcam after installing LibFreeNect2? #1151

Open JadnoABS opened 3 years ago

JadnoABS commented 3 years ago

I'm using Manjaro Linux and I want to use my XBOne Kinect as a webcam device. I have installed Libfreenect2 and the Kinect works when I run Protonect.

doctorstoo commented 3 years ago

Please install OpenCV and try streamer_recorder function following this:

Linux

JadnoABS commented 3 years ago

Thanks, I installed opencv3 and ran cmake .. -DBUILD_STREAMER_RECORDER=ON but when I ran make I received several errors like this one:

/home/user/libfreenect2/tools/streamer_recorder/include/PracticalSocket.h:336:49: error: ISO C++17 does not allow dynamic exception specifications 336 | void leaveGroup(const string &multicastGroup) throw(SocketException);

doctorstoo commented 3 years ago

Hope this will help you. https://github.com/r9y9/pylibfreenect2/blob/master/examples/multiframe_listener.py

JadnoABS commented 3 years ago

I ran that script and it opened a window which showed the correct kinect capture, but still there is no option for kinect on software that uses webcam.

obiwan1337 commented 2 years ago

i came as far as this goes. With 4 individual windows for ir, color, depth and combined input now on my screen I have no idea what do do or how to access those streams. If you think about using the virtual camera option of OBS for example you can emulate the webcam and use a recording as input to show. You'll need the streamwindow to be open all the time with this construction...

I ran that script and it opened a window which showed the correct kinect capture, but still there is no option for kinect on software that uses webcam.

smokhov commented 2 years ago

Unlike Kinect Azure or other cameras like RealSense, Kinect 2 cameras do not show up in Linux as "video devices" with libfreenec2, which is not really a L4V2 video driver. To make your Kinect 2 as a video cam in Linux (compared to what users would do via Syphon on OS X or Spout2 on Windows), you need to modify Protonect to write color frames into a virtual L4V2 loopback device. Then that device can be used in any other app as a webcam. You will have to install https://github.com/umlaeute/v4l2loopback first, then write your Kinect 2 frames into it.

thelabcat commented 2 years ago

Another option is to screen capture the Protonect window, and crop it. Kind of clumsy, but works.