You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im kinda new to coding (and github), so i apologize if this isnt the right place for this since its not really an issue. I just want to share some beginner freindly steps that worked for me. Here it is.
Below is a step‐by‐step walkthrough of the installation process based on the guide you posted. I’ll explain where you should type each command (mostly in a terminal, and in specific directories as noted) and how to set up the Python bindings for libfreenect2 on Ubuntu 20.04 (which I assume is what you meant by “Ubuntu 20.45”). You’ll be working from the command line (open a terminal using Ctrl+Alt+T) throughout these steps.
1. Prepare Your Environment
Before you start, make sure you have the necessary development tools and dependencies installed. In your terminal you can install them by running:
These commands are run in your terminal (any directory is fine since they install system-wide packages).
2. Clone the libfreenect2 Repository
Decide on a working directory where you’d like to keep the source code (for example, your home directory). Then, in your terminal type:
cd~
git clone https://github.com/OpenKinect/libfreenect2.git
cd libfreenect2
Here, you’re cloning the repository and then changing your directory into the cloned folder.
3. (Ubuntu 14.04–Specific Steps – Skip on Ubuntu 20.04)
The guide mentions running a script to download upgraded Debian packages for Ubuntu 14.04. Since you’re on Ubuntu 20.04, you can skip the step:
cd depends; ./download_debs_trusty.sh
4. Build libfreenect2
Now, you need to compile the library. Still inside the libfreenect2 directory, create a new directory called build and change into it:
mkdir build &&cd build
The “..” in later commands refers to the parent directory (which is the root of the libfreenect2 source).
Now run CMake to configure the build. This command tells CMake to set the installation prefix (where the library will be installed) to a folder in your home directory:
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
Then compile and install:
make
make install
All these commands are run inside the build directory of the libfreenect2 folder.
5. Set Up udev Rules for Device Access
To allow non-root access to the Kinect device, copy the udev rules file:
After running this, unplug and replug your Kinect device so the new rules take effect.
This command is run from your current directory (inside build), since the path “../platform/linux/udev/90-kinect2.rules” is relative to the build folder.
6. Test the Installation
Now you can run the test program provided by libfreenect2:
./bin/Protonect
This command is run in the build directory, where the binary was built.
If everything is working, you should see output from the Kinect streams.
7. Setting Up the Python Version (Python Bindings)
The core libfreenect2 library is written in C/C++, but there are community-supported Python bindings available (often referred to as “freenect2-python”). Here’s how to get started:
Ensure libfreenect2 is Installed:
The Python binding needs to locate libfreenect2. To help with that, add the following environment variables so that pkg-config can find your installation:
It’s a good idea to add these lines to your ~/.bashrc so they load automatically when you open a new terminal.
Install the Python Bindings:
There is an experimental Python interface available. For example, you can use a community package (often called “freenect2” or “pyfreenect2”). One common method is:
pip install --user freenect2
If that package isn’t available or doesn’t work as expected, you may need to clone a repository such as pyfreenect2 and follow its build instructions.
Test the Python Interface:
Create a simple Python script (e.g., test_freenect2.py) with the following content:
fromfreenect2importDevice, FrameTypeimportnumpyasnpfromPILimportImage# Open the default Kinect devicedevice=Device()
# Start the device using a context manager so it stops automaticallywithdevice.running():
# Wait for an IR framefortype_, frameindevice:
iftype_isFrameType.Ir:
break# Convert the frame to a numpy array and process it (normalize, etc.)ir_image=frame.to_array()
ir_image=np.sqrt(ir_image/ir_image.max()) # simple gamma correction# Save the imageImage.fromarray((ir_image*255).astype(np.uint8)).save('output.jpg')
print("IR image saved as output.jpg")
Run this script in your terminal:
python3 test_freenect2.py
If everything is set up correctly, the script should capture an IR frame from your Kinect and save it as output.jpg.
Summary
Terminal Commands: All commands (from installing packages to building the library) are typed into a terminal.
Directories:
Clone: Run git clone in your chosen working directory (e.g., your home folder).
Build: Inside the libfreenect2 folder, create and enter a build directory and run CMake and make there.
udev Rules: Run the copy command from within the build folder so that the relative path to platform/linux/udev/90-kinect2.rules is correct.
Python Bindings: After installing libfreenect2, set the environment variables (or add them to your .bashrc) so that your Python binding can locate the library. Then install the Python package (via pip or from source) and run a test script.
By following these steps in your terminal, you should have a working libfreenect2 setup with a Python interface on Ubuntu 20.04. If you run into any issues (like missing files or compilation errors), double-check that you’re in the correct directory and that all dependencies are properly installed.
The text was updated successfully, but these errors were encountered:
Im kinda new to coding (and github), so i apologize if this isnt the right place for this since its not really an issue. I just want to share some beginner freindly steps that worked for me. Here it is.
Below is a step‐by‐step walkthrough of the installation process based on the guide you posted. I’ll explain where you should type each command (mostly in a terminal, and in specific directories as noted) and how to set up the Python bindings for libfreenect2 on Ubuntu 20.04 (which I assume is what you meant by “Ubuntu 20.45”). You’ll be working from the command line (open a terminal using Ctrl+Alt+T) throughout these steps.
1. Prepare Your Environment
Before you start, make sure you have the necessary development tools and dependencies installed. In your terminal you can install them by running:
These commands are run in your terminal (any directory is fine since they install system-wide packages).
2. Clone the libfreenect2 Repository
Decide on a working directory where you’d like to keep the source code (for example, your home directory). Then, in your terminal type:
Here, you’re cloning the repository and then changing your directory into the cloned folder.
3. (Ubuntu 14.04–Specific Steps – Skip on Ubuntu 20.04)
The guide mentions running a script to download upgraded Debian packages for Ubuntu 14.04. Since you’re on Ubuntu 20.04, you can skip the step:
4. Build libfreenect2
Now, you need to compile the library. Still inside the
libfreenect2
directory, create a new directory calledbuild
and change into it:The “
..
” in later commands refers to the parent directory (which is the root of the libfreenect2 source).Now run CMake to configure the build. This command tells CMake to set the installation prefix (where the library will be installed) to a folder in your home directory:
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
Then compile and install:
All these commands are run inside the
build
directory of the libfreenect2 folder.5. Set Up udev Rules for Device Access
To allow non-root access to the Kinect device, copy the udev rules file:
After running this, unplug and replug your Kinect device so the new rules take effect.
This command is run from your current directory (inside
build
), since the path “../platform/linux/udev/90-kinect2.rules
” is relative to the build folder.6. Test the Installation
Now you can run the test program provided by libfreenect2:
This command is run in the
build
directory, where the binary was built.If everything is working, you should see output from the Kinect streams.
7. Setting Up the Python Version (Python Bindings)
The core libfreenect2 library is written in C/C++, but there are community-supported Python bindings available (often referred to as “freenect2-python”). Here’s how to get started:
Ensure libfreenect2 is Installed:
The Python binding needs to locate libfreenect2. To help with that, add the following environment variables so that
pkg-config
can find your installation:It’s a good idea to add these lines to your
~/.bashrc
so they load automatically when you open a new terminal.Install the Python Bindings:
There is an experimental Python interface available. For example, you can use a community package (often called “freenect2” or “pyfreenect2”). One common method is:
If that package isn’t available or doesn’t work as expected, you may need to clone a repository such as pyfreenect2 and follow its build instructions.
Test the Python Interface:
Create a simple Python script (e.g.,
test_freenect2.py
) with the following content:Run this script in your terminal:
If everything is set up correctly, the script should capture an IR frame from your Kinect and save it as
output.jpg
.Summary
git clone
in your chosen working directory (e.g., your home folder).libfreenect2
folder, create and enter abuild
directory and run CMake and make there.build
folder so that the relative path toplatform/linux/udev/90-kinect2.rules
is correct..bashrc
) so that your Python binding can locate the library. Then install the Python package (via pip or from source) and run a test script.By following these steps in your terminal, you should have a working libfreenect2 setup with a Python interface on Ubuntu 20.04. If you run into any issues (like missing files or compilation errors), double-check that you’re in the correct directory and that all dependencies are properly installed.
The text was updated successfully, but these errors were encountered: