Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JadnoABS opened this issue Jun 14, 2021 · 7 comments
Open

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

JadnoABS opened this issue Jun 14, 2021 · 7 comments

Comments

@JadnoABS
Copy link

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
Copy link

Please install OpenCV and try streamer_recorder function following this:

Linux

  • Install build tools
sudo apt-get install opencv3
  • Build (start from the libfreenect2 root directory)
mkdir build && cd build
cmake .. -DBUILD_STREAMER_RECORDER=ON
make
make install
  • Run the test program (accepts all the same options as Protonect with 3 extra):
    • ./bin/ProtonectSR -record -- to start recording enable frames (freenect2-record presupposes this option)
    • ./bin/ProtonectSR -stream -- to start streaming frames to a receiver application (freenect2-stream presupposes this option)
    • ./bin/ProtonectSR -replay -- to start replaying recorded frames (freenect2-replay presupposes this option)
    • ./bin/ProtonectSR -replay -stream -- to relay and stream recorded frames
    • ./bin/ProtonectSR -record -stream -- to record and stream frames

@JadnoABS
Copy link
Author

JadnoABS commented Jul 2, 2021

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
Copy link

@JadnoABS
Copy link
Author

JadnoABS commented Jul 6, 2021

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
Copy link

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
Copy link
Contributor

smokhov commented Mar 7, 2022

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants