Git Product home page Git Product logo

pylibfreenect2's Introduction

pylibfreenect2

PyPI Build Status Build status License DOI

A python interface for libfreenect2. The package is compatible with python 2.7-3.5.

Documentation

  • STABLEmost recently tagged version of the documentation.
  • LATESTin-development version of the documentation.

pylibfreenect2's People

Contributors

landersson avatar maderafunk avatar mikoychinese avatar r9y9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pylibfreenect2's Issues

Apply undistortDepth on numpy array instead of frame object

Hi,

is it possible to create a function similar to undistortDepth that accepts an numpy array instead of a frame object? My problem is, that I have already saved many depth images as numpy arrays and now I need the undistorted depth arrays.

pip does not let install pylibfreenect2

Hi,

My issue seem to be the same one than #36, every time I try to use pip install pylibfreenect2 I get the following message:
`Collecting pylibfreenect2
Downloading https://files.pythonhosted.org/packages/25/0a/12665fc2a467672ad3daf1823dddbee96ce2b6dfebbb7f3dab97b4a76a84/pylibfreenect2-0.1.2.tar.gz (98kB)
100% |████████████████████████████████| 102kB 1.3MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-D9Uer7/pylibfreenect2/setup.py", line 25, in
raise OSError("{}: is not found".format(libfreenect2_configh_path))
OSError: /usr/local/include/libfreenect2/config.h: is not found

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-D9Uer7/pylibfreenect2/
`
I am new to python and do not really how to fix as #36 is not really clear on how to fix the problem

I cannot do "from pylibfreenect2 import Freenect2",how to fix the problem?Thanks

Hi all, I ran into the same problem and was able to fix it through copying all of dlls generated in the libfreenect2 build (in build/install/bin by default in the libfreenect2 source directory),

freenect2.dll
glfw3.dll
libusb-1.0.dll
turbojpeg.dll

to my miniconda3 path,

C:\Users\<username>\AppData\Local\Continuum\miniconda3

Alternatively I believe you could append the path to the dlls to your path variable,

set path=%PATH%;C:\libfreenect2\build\install\bin

Originally posted by @jmarkow in #44 (comment)

Registration has no attribute 'getPointXYZ'

I've been working with these bindings for a couple months now, and have had few to no problems. However, I am currently trying to perform depth analysis using the getPointXYZ function from the Registration class. This is the error I'm receiving: "AttributeError: 'pylibfreenect2.libfreenect2.Registration' object has no attribute 'getPointXYZ'". Just curious as to if this is a common issue or one native to my machine?

missing cimport in module 'utility': /usr/lib/python2.7/dist-packages/Cython/Includes/libcpp/map.pxd

Perhaps depends on cython version. Previously @karanbudhraja reported this issue. From his email,

sudo python setup.py install
missing cimport in module 'utility': /usr/lib/python2.7/dist-packages/Cython/Includes/libcpp/map.pxd
running install
running bdist_egg
running egg_info
writing requirements to pylibfreenect2.egg-info/requires.txt
writing pylibfreenect2.egg-info/PKG-INFO
writing top-level names to pylibfreenect2.egg-info/top_level.txt
writing dependency_links to pylibfreenect2.egg-info/dependency_links.txt
reading manifest file 'pylibfreenect2.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pylibfreenect2.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pylibfreenect2
copying build/lib.linux-x86_64-2.7/pylibfreenect2/__init__.py -> build/bdist.linux-x86_64/egg/pylibfreenect2
copying build/lib.linux-x86_64-2.7/pylibfreenect2/libfreenect2.so -> build/bdist.linux-x86_64/egg/pylibfreenect2
byte-compiling build/bdist.linux-x86_64/egg/pylibfreenect2/__init__.py to __init__.pyc
creating stub loader for pylibfreenect2/libfreenect2.so
byte-compiling build/bdist.linux-x86_64/egg/pylibfreenect2/libfreenect2.py to libfreenect2.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/pylibfreenect2-0.0.1_dev-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pylibfreenect2-0.0.1_dev-py2.7-linux-x86_64.egg
Copying pylibfreenect2-0.0.1_dev-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages
Adding pylibfreenect2 0.0.1-dev to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/pylibfreenect2-0.0.1_dev-py2.7-linux-x86_64.egg
Processing dependencies for pylibfreenect2==0.0.1-dev
Searching for enum34==1.1.2
Best match: enum34 1.1.2
Processing enum34-1.1.2-py2.7.egg
enum34 1.1.2 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/enum34-1.1.2-py2.7.egg
Searching for numpy==1.8.2
Best match: numpy 1.8.2
numpy 1.8.2 is already the active version in easy-install.pth

Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for pylibfreenect2==0.0.1-dev

I think it's worth trying the following snippet:

import numpy as np
cimport numpy as np
cimport cython

from libcpp.map cimport map

def f(map[int,int] m):
    for pair in m:
        print(pair.first, pair.second)
$ cython -v --cplus test.pyx

to see if the issue is caused by cython or pylibfreenect2.

Device gets closed when code gets out of the scope

A sample code snippet is:

def open_device():
    # Create a processing pipeline.
    pipeline = OpenGLPacketPipeline()

    # Create a logger.
    logger = createConsoleLogger(LoggerLevel.Debug)
    setGlobalLogger(logger)

    # Discover Kinect device.
    fn = Freenect2()
    num_devices = fn.enumerateDevices()
    if num_devices == 0:
        print("No device connected!")
        sys.exit(1)

    serial = fn.getDeviceSerialNumber(0)

    # Connect to the device.
    device = fn.openDevice(serial, pipeline=pipeline)

    # Register listeners.
    listener = SyncMultiFrameListener(FrameType.Depth)
    device.setIrAndDepthFrameListener(listener)

    return device, listener

device, listener = open_device()

while True:
    cv2.waitKey(-1)

In this case, the device gets closed when exiting the function call open_device().

how to read a frame map by frame

Hello,
I have already installed pylibfreenect2, and can open kinect 2 in Python. I want to read image information frame by frame, but I don't know how to write the code?Someone has relevant source code, I am very grateful.

Packet Pipelines

I am unable to get either OpenCL or OpenGL packet pipelines to import in the example script. Only the CPU pipeline will import. Both pipelines will run fine in libfreenect2 Protonect test program.

System setup is:

  • Windows 10
  • Python 3.5.2 64bit
  • Cython 0.24
  • libfreenect and pylibfreenect both built from master branches (Also tried pylibfreenect from pipi)

Thank you

Installation Issue on Windows 10

Hello there, I am having issues with installing pylibfreenect2 from source as well as through the pip package manager. The installation fails everytime with this error:
"building 'pylibfreenect2.libfreenect2' extension
error: [WinError 2] The system cannot find the file specified."
I am running on windows 10, python 3.5.0.
My path variable includes the libfreenect prefix as well as the reference for ld_library.
freenect2 works as the protonect example functions properly.
Any ideas to help?

Collecting pylibfreenect2
  Using cached https://files.pythonhosted.org/packages/25/0a/12665fc2a467672ad3daf1823dddbee96ce2b6dfebbb7f3dab97b4a76a84/pylibfreenect2-0.1.2.tar.gz
Requirement already satisfied: numpy>=1.7.0 in c:\users\robin\appdata\local\programs\python\python35\lib\site-packages (from pylibfreenect2) (1.16.2)
Building wheels for collected packages: pylibfreenect2
  Building wheel for pylibfreenect2 (setup.py) ... error
  Complete output from command c:\users\robin\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Robin\\AppData\\Local\\Temp\\pip-install-htpe9czw\\pylibfreenect2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Robin\AppData\Local\Temp\pip-wheel-rkiq0kzu --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  creating build\lib.win-amd64-3.5\pylibfreenect2
  copying pylibfreenect2\__init__.py -> build\lib.win-amd64-3.5\pylibfreenect2
  creating build\lib.win-amd64-3.5\tests
  copying tests\test_libfreenect2.py -> build\lib.win-amd64-3.5\tests
  copying tests\__init__.py -> build\lib.win-amd64-3.5\tests
  running build_ext
  building 'pylibfreenect2.libfreenect2' extension
  error: [WinError 2] The system cannot find the file specified

  ----------------------------------------
  Failed building wheel for pylibfreenect2
  Running setup.py clean for pylibfreenect2
Failed to build pylibfreenect2
Installing collected packages: pylibfreenect2
  Running setup.py install for pylibfreenect2 ... error
    Complete output from command c:\users\robin\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Robin\\AppData\\Local\\Temp\\pip-install-htpe9czw\\pylibfreenect2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Robin\AppData\Local\Temp\pip-record-bcewbkes\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.5
    creating build\lib.win-amd64-3.5\pylibfreenect2
    copying pylibfreenect2\__init__.py -> build\lib.win-amd64-3.5\pylibfreenect2
    creating build\lib.win-amd64-3.5\tests
    copying tests\test_libfreenect2.py -> build\lib.win-amd64-3.5\tests
    copying tests\__init__.py -> build\lib.win-amd64-3.5\tests
    running build_ext
    building 'pylibfreenect2.libfreenect2' extension
    error: [WinError 2] The system cannot find the file specified

    ----------------------------------------
Command "c:\users\robin\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Robin\\AppData\\Local\\Temp\\pip-install-htpe9czw\\pylibfreenect2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Robin\AppData\Local\Temp\pip-record-bcewbkes\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Robin\AppData\Local\Temp\pip-install-htpe9czw\pylibfreenect2\

Performance Difference

Hi!

I'm noticing a performance difference between the ./bin/Protonect example with libfreenect2 and the multiframe listener example you've provided. Is this expected? The refresh rate is not very smooth. I'm running everything on macOS El Capitan.

Depth limited to 4.5 meters pylibfreenect api?

Hello,

as the caption mentioned in figured out that in the depth images, the maximum range is 4.5 meters. I need to extend this range to around 8 meters which should be possible. In a post for libfreenct2 it is possible to change the depth by setting the range in the DepthPacketProcessor. ([Depth limited to 4.5 meters?])(OpenKinect/libfreenect2#143) Is it possible to get access to the DepthPacketProcessor with pylibfreenct2? Maybe i'm just bad at applying the api.

Kind Regards, Dimitrij

TODOs for 0.1.0 release

  • Minimize API differences between C++ and python (I think I have done)
  • Consensus with already existence python binding remexre/pyfreenect2#10
    • I think I've merged pyfreenect2 efforts into this package.
  • Linux support
  • Windows support #11
  • API docs #7
  • user tests?
  • API doc and installation guide

Future work (just for reminder, shouldn't be blocking todo):

  • CUDA depth processor #2

memory leakage when running the examples

Both examples multiframe_listener.py and selective_streams.py make my mac running out of memory after keep running 1-2 minutes. I have 16GB memory. It took only few seconds to increase 500MB memory usage. The libfreenect2's example "Protonect" has no problem. The memory usage is only about 110MB.

Depth data

Hi ! I have been going through the code and trying to understand it.
Is there a function that returns the depth given a ROI ?

skipping depth packet. receiving just several frames per second

I cloned the repository and installed it using
python setup.py install
I am receiving frames with python multiframe_listener.py
here is the output of python multiframe_listener.py:

[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 8 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:3 with serial 025159651347
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 2016384 ir: 608*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
... so on

But right from the beginning it is missing almost all depth frames, so I could get only several frames per second.
./bin/Protonect works just fine.

How can I get the LD_LIBRARY_PATH path

## I install the pylibfreenect2 by the command ( wgb@wgb:~/wgb_install/pylibfreenect2-master$ python setup.py install) and got the following Instructions. Did them suggest that I installed correct?

/home/wgb/anaconda2/lib/python2.7/site-packages/setuptools/dist.py:341: UserWarning: Normalizing '0.1.3-dev' to '0.1.3.dev0'
normalized_version,
running install
running bdist_egg
running egg_info
writing requirements to pylibfreenect2.egg-info/requires.txt
writing pylibfreenect2.egg-info/PKG-INFO
writing top-level names to pylibfreenect2.egg-info/top_level.txt
writing dependency_links to pylibfreenect2.egg-info/dependency_links.txt
reading manifest file 'pylibfreenect2.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pylibfreenect2.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-x86_64/egg/tests
copying build/lib.linux-x86_64-2.7/tests/test_libfreenect2.py -> build/bdist.linux-x86_64/egg/tests
copying build/lib.linux-x86_64-2.7/tests/init.py -> build/bdist.linux-x86_64/egg/tests
creating build/bdist.linux-x86_64/egg/pylibfreenect2
copying build/lib.linux-x86_64-2.7/pylibfreenect2/libfreenect2.so -> build/bdist.linux-x86_64/egg/pylibfreenect2
copying build/lib.linux-x86_64-2.7/pylibfreenect2/init.py -> build/bdist.linux-x86_64/egg/pylibfreenect2
byte-compiling build/bdist.linux-x86_64/egg/tests/test_libfreenect2.py to test_libfreenect2.pyc
byte-compiling build/bdist.linux-x86_64/egg/tests/init.py to init.pyc
byte-compiling build/bdist.linux-x86_64/egg/pylibfreenect2/init.py to init.pyc
creating stub loader for pylibfreenect2/libfreenect2.so
byte-compiling build/bdist.linux-x86_64/egg/pylibfreenect2/libfreenect2.py to libfreenect2.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pylibfreenect2.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating 'dist/pylibfreenect2-0.1.3.dev0-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pylibfreenect2-0.1.3.dev0-py2.7-linux-x86_64.egg
Removing /home/wgb/anaconda2/lib/python2.7/site-packages/pylibfreenect2-0.1.3.dev0-py2.7-linux-x86_64.egg
Copying pylibfreenect2-0.1.3.dev0-py2.7-linux-x86_64.egg to /home/wgb/anaconda2/lib/python2.7/site-packages
pylibfreenect2 0.1.3.dev0 is already the active version in easy-install.pth

Installed /home/wgb/anaconda2/lib/python2.7/site-packages/pylibfreenect2-0.1.3.dev0-py2.7-linux-x86_64.egg
Processing dependencies for pylibfreenect2==0.1.3.dev0
Searching for enum34==1.1.6
Best match: enum34 1.1.6
Adding enum34 1.1.6 to easy-install.pth file

Using /home/wgb/anaconda2/lib/python2.7/site-packages
Searching for numpy==1.13.1
Best match: numpy 1.13.1
Adding numpy 1.13.1 to easy-install.pth file

Using /home/wgb/anaconda2/lib/python2.7/site-packages
Finished processing dependencies for pylibfreenect2==0.1.3.dev0

Logging Request

Hi, this is a feature request - is there a way to convert print statements to use loggers instead? This would allow me to disable output completely or redirect output to a file more easily.

Depth-RGB alignment

Is there a method to read the depth value from the depth video by using python and opencv?

Filtered depth map to frame

I am extracting the depth map from pylibfreenect2 suing the asarray function as I want to filter it to eliminate noise and 'holes' before the registration.

  • Is there a way to transform back this array of filtered depth into a frame to do the registration?

  • If it is possible what are the steps to be taken?

Hoping to hear from you soon

Kind regards,

Alex

Issue with asarray function

Hello all,

When I use the asarray function on the registered frame with the type np.float32, the array is getting resized as 424 X 512. Is it fine? Because we have registered frame as 512 X 424 X 4 and the output of asarray function should restrain dimensions.

If I use the same function with the type np.uint8, the output dimensions are restrained and the shape function on ndarray shows the dimension as 424 X 512 X 4(Shouldn't it be 512 X 424 X 4 ?). But since the fourth channel of registered frame would be having the depth frame, in which values range from 0 to 4500, I would like to have the type as np.float32. Any idea how we do that with current version?

Please verify.

Thank you.

Frame quality

Hi, I just wanted to ask if there is any variable I can set to improve the frame quality. Specially the IR frame is much darker when compared to the Protonect frame under the same lighting conditions. Any help would be good. Thanks.

Problem with blocking method waitForNewFrame()

waitForNewFrame() is blocking indefinitely. I'm using the code in Python 2.7, in a multiprocessing class.
On the same machine, the multiframe_listener example is working like a charm.

any idea?

Cannot succeed to install

I have installed libfreenect2 in my home directory.
This create freenect2 in my home directory too, containing /include and /lib
Protonect, NiViewer2 and Nite2 are working.
Try installing pylibfreenect2 with:
sudo LIBFREENECT2_INSTALL_PREFIX=/home/stf/freenect2/ pip install git+https://github.com/r9y9/pylibfreenect2
getting errors:

Downloading/unpacking git+https://github.com/r9y9/pylibfreenect2
Cloning https://github.com/r9y9/pylibfreenect2 to /tmp/pip-3jVmAQ-build
Running setup.py (path:/tmp/pip-3jVmAQ-build/setup.py) egg_info for package from git+https://github.com/r9y9/pylibfreenect2
Compiling pylibfreenect2/libfreenect2.pyx because it changed.
Cythonizing pylibfreenect2/libfreenect2.pyx

Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /usr/local/lib/python2.7/dist-packages (from pylibfreenect2==0.0.1-dev)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /usr/local/lib/python2.7/dist-packages (from pylibfreenect2==0.0.1-dev)
Installing collected packages: pylibfreenect2
Running setup.py install for pylibfreenect2
building 'pylibfreenect2.libfreenect2' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/home/stf/freenect2/include/libfreenect2 -I/usr/include/python2.7 -c pylibfreenect2/libfreenect2.cpp -o build/temp.linux-x86_64-2.7/pylibfreenect2/libfreenect2.o -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pylibfreenect2/libfreenect2.cpp:287:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^
In file included from pylibfreenect2/libfreenect2.cpp:298:0:
/home/stf/freenect2/include/libfreenect2/frame_listener_impl.h:35:43: fatal error: libfreenect2/frame_listener.hpp: Aucun fichier ou dossier de ce type
#include <libfreenect2/frame_listener.hpp>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-3jVmAQ-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-Om021S-record/install-record.txt --single-version-externally-managed --compile:
running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/pylibfreenect2

copying pylibfreenect2/init.py -> build/lib.linux-x86_64-2.7/pylibfreenect2

running build_ext

building 'pylibfreenect2.libfreenect2' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/pylibfreenect2

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/home/stf/freenect2/include/libfreenect2 -I/usr/include/python2.7 -c pylibfreenect2/libfreenect2.cpp -o build/temp.linux-x86_64-2.7/pylibfreenect2/libfreenect2.o -std=c++11

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]

In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0,

             from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,

             from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,

             from pylibfreenect2/libfreenect2.cpp:287:

/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

#warning "Using deprecated NumPy API, disable it by " \

^

In file included from pylibfreenect2/libfreenect2.cpp:298:0:

/home/stf/freenect2/include/libfreenect2/frame_listener_impl.h:35:43: fatal error: libfreenect2/frame_listener.hpp: Aucun fichier ou dossier de ce type

#include <libfreenect2/frame_listener.hpp>

                                       ^

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-3jVmAQ-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-Om021S-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-3jVmAQ-build
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/init.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

Fail to import due to a "DLL load failed error"

I'm running Windows 10. Protonect works fine and I have Microsoft Visual C++ 2015 Redistributable (x64) and (x86) installed.

When I try to import pylibfreenect2, it comes up with the error:

from .libfreenect2 import *
ImportError: DLL load failed: The specified module could not be found.

Installation problems

When I tried to install the setup.py file I got the next output:

UserWarning: Normalizing '0.1.3-dev' to '0.1.3.dev0'
  normalized_version,
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

SO Ubuntu 16.04, Python version Python 3.6.3 :: Anaconda custom (64-bit)

ColorFrame to ndarray (Question)

Is there a way to convert the colorframe to ndarray format?
I am using the following, provided by the tutorial (omitting other types):

...
frames = listener.waitForNewFrame()
color = frames["color"]
...
im = color.asarray()

I need the color frame to be an ndarray in order to fit in this piece of code:

#im (ndarray): a color image in BGR order
im_orig = im.astype(np.float32, copy=True)
im_orig -= cfg.PIXEL_MEANS

However, when I try to use im = color.asarray() the program gives the following error:

im_orig -= cfg.PIXEL_MEANS
ValueError: operands could not be broadcast together with shapes (540,960) (1,1,3) (540,960) 

What currently fits/works in that piece of code is:

#im_file is the name of an image in jpg format, i.e. 'demo/cat.jpg'
im = cv2.imread(im_file)

Probably this is something very simple, but I am having a hard time trying to solve it.
Is there anyone that could help me?

Generation of point clouds

Hello,
Is there a way to generate point clouds using pylibfreenect2?There is a repo based on libfreenect2 by the name "libfreenect2pclgrabber" can we use this?

why can not I find libfreenect2.py in the the pylibfreenect2

Hi,
When I tested the pylibfreenect2 by the anaconda, I got some following errors. I have installed the libfreenect2 correctly, but why could not me find the libfreenect2.py in the file (build/bdist.linux-x86_64)?

runfile('/home/wgb/wgb_install/pylibfreenect2-master/tests/test_libfreenect2.py', wdir='/home/wgb/wgb_install/pylibfreenect2-master/tests')
Traceback (most recent call last):

File "", line 1, in
runfile('/home/wgb/wgb_install/pylibfreenect2-master/tests/test_libfreenect2.py', wdir='/home/wgb/wgb_install/pylibfreenect2-master/tests')

File "/home/wgb/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile
execfile(filename, namespace)

File "/home/wgb/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)

File "/home/wgb/wgb_install/pylibfreenect2-master/tests/test_libfreenect2.py", line 9, in
from pylibfreenect2 import Freenect2, SyncMultiFrameListener

File "build/bdist.linux-x86_64/egg/pylibfreenect2/init.py", line 108, in

File "build/bdist.linux-x86_64/egg/pylibfreenect2/libfreenect2.py", line 7, in

File "build/bdist.linux-x86_64/egg/pylibfreenect2/libfreenect2.py", line 6, in bootstrap

ImportError: libfreenect2.so.0.2: cannot open shared object file: No such file or directory

GQCNN - pyfreenect2 multiframe_listener.py shows no icons

System information

OS: Ubutun 16.04
Container: Yes created with singularity 3.2.1
Pylibfreenect2 installation: Installed with pip
Python version: 3.7
Virtual environment: Conda Enviroment

Problem description

When running the pylibfreenect multiframe_listener.py example the cv2.imshow window doesn't show icons.

Expected

image

Current

image

Troubleshooting steps

I am currently looking at whether a system icon package is missing and whether this is a bug related to opencv.

What I already tried

  1. Installing opencv from different channels:
  • pip install opencv
  • conda install opencv
  • conda install opencv-python
  1. Installing GTK and VTK as explained in this topic.

Extra info

Before I got this problem i received the following error message:

    cv2.imshow("ir", ir.asarray() / 65535.)
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

This was solved by using the steps depicted in this topic.

Getting frames from multiple Kinects within a single script

Hey!
I have connected two kinects and both of them are working just fine if I start each of them with a separate Protonect or multiframe_listener (each of them is connected to a separate USB controller and libfreenect2/issues/807 is implemented)

But I am trying to get frames from both kinects within a single script.
Here is the code:

from scipy import ndimage
import numpy as np
import cv2
import sys
from pylibfreenect2 import Freenect2, SyncMultiFrameListener
from pylibfreenect2 import FrameType, Registration, Frame
from pylibfreenect2 import createConsoleLogger, setGlobalLogger
from pylibfreenect2 import LoggerLevel
import os
from pylibfreenect2 import OpenGLPacketPipeline
pipeline = OpenGLPacketPipeline()
print("Packet pipeline:", type(pipeline).__name__)

enable_rgb = True
enable_depth = True

fn = Freenect2()

device = fn.openDevice("025159651347", pipeline=pipeline)
device2 = fn.openDevice("004404264147", pipeline=pipeline)

types = 0
if enable_rgb:
    types |= FrameType.Color
if enable_depth:
    types |= (FrameType.Ir | FrameType.Depth)
listener = SyncMultiFrameListener(types)
listener2 = SyncMultiFrameListener(types)

# Register listeners
device.setColorFrameListener(listener)
device.setIrAndDepthFrameListener(listener)

# Here problems starts...
device2.setColorFrameListener(listener2)
device2.setIrAndDepthFrameListener(listener2)

I register listeners for the second device, but it does not work after that. It goes further to a while loop but it does not iterate.

Here is the remaining part of my code:

device.startStreams(rgb=enable_rgb, depth=enable_depth)
# device2.startStreams(rgb=enable_rgb, depth=enable_depth)

if enable_depth:
    registration = Registration(device.getIrCameraParams(),
                                device.getColorCameraParams())
    # registration2 = Registration(device2.getIrCameraParams(),
    #                             device2.getColorCameraParams())

undistorted = Frame(512, 424, 4)
registered = Frame(512, 424, 4)
# undistorted2 = Frame(512, 424, 4)
# registered2 = Frame(512, 424, 4)

while True:
    frames = listener.waitForNewFrame()
    # frames2 = listener2.waitForNewFrame()

    if enable_rgb:
        color = frames["color"]
        # color2 = frames2["color"]
    if enable_depth:
        ir = frames["ir"]
        depth = frames["depth"]
        # ir2 = frames2["ir"]
        # depth2 = frames2["depth"]

    if enable_rgb and enable_depth:
        registration.apply(color, depth, undistorted, registered)
        # registration2.apply(color2, depth2, undistorted2, registered2)
    elif enable_depth:
        registration.undistortDepth(depth, undistorted)
        # registration2.undistortDepth(depth2, undistorted2)

    depth_img = depth.asarray() / 4500.
    # depth_img = ndimage.rotate(depth_img, -90)
    cv2.imshow("depth", depth_img)

    listener.release(frames)
    # listener2.release(frames2)

    key = cv2.waitKey(delay=1)
    if key == ord('q'):
        break

device.stop()
device.close()
# device2.stop()
# device2.close()

sys.exit(0)

Is it correctly to do like this by the way:

while(1):
    frames = listener.waitForNewFrame()
    frames2 = listener2.waitForNewFrame()
    # frames and frames2 processing
    listener.release(frames)
    listener2.release(frames2)

Is there a way to sync kinects (not exactly, but at least somehow)?

I am using Ubuntu 16.04
Thanks a lot!

How can I use registration.apply offline?

I want to get the depth frame warped into color frame. But I only have depth and color images. I notice there's an issue about creating Frame from numpy.ndarray, I tried but there's not a parameter called byte_data anymore and I didn't find anything helpful in the documentation about creating Frame from numpy.ndarray. So how can I get bigdepth from previously collected color and depth images without Kinect v2?

Find RGB coordinates in the depth map

Hello,

I am trying to find a way find the corresponding point from RGB image (1920x1080) on a depth map (512x424), is there any formula or exampleI can find

Packet buffer is NULL

I am getting the following error on Ubuntu 14.04 while running the examples:

[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
[Error] [DepthPacketStreamParser] Packet buffer is NULL
.....
it continuously prints the above and eventually crashes. Am I missing something in the installation? since they worked fine on OSX.

--Edit--
Just to add, the Protonect binary seems to work fine in libfreenect2

Installation errors

While executing the pip command I get the following error:

OSError: /home/abc/libfreenect2/include/libfreenect2/config.h: is not found

This is because the file is named config.h.in and not config.h
Even if I change the filename, during installation it is not able to find the lib folder.
This is because the lib folder is inside the build folder.

Is there something I am missing for doing this installation ?

Installation Issue

Trying to execute the command "pip install pylibfreenect" gives the below error.

Downloading/unpacking pylibfreenect2
  Downloading pylibfreenect2-0.1.1.tar.gz (83kB): 83kB downloaded
  Running setup.py (path:/tmp/pip_build_yvtheja/pylibfreenect2/setup.py) egg_info for package pylibfreenect2
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_yvtheja/pylibfreenect2/setup.py", line 112, in <module>
        has_define_in_config("LIBFREENECT2_WITH_OPENCL_SUPPORT"),
      File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 818, in cythonize
        aliases=aliases)
      File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 704, in create_extension_list
        for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
      File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 108, in nonempty
        raise ValueError(error_msg)
    ValueError: 'pylibfreenect2/libfreenect2.pyx' doesn't match any files
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_yvtheja/pylibfreenect2/setup.py", line 112, in <module>

    has_define_in_config("LIBFREENECT2_WITH_OPENCL_SUPPORT"),

  File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 818, in cythonize

    aliases=aliases)

  File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 704, in create_extension_list

    for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):

  File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 108, in nonempty

    raise ValueError(error_msg)

ValueError: 'pylibfreenect2/libfreenect2.pyx' doesn't match any files

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_yvtheja/pylibfreenect2
Storing debug log for failure in /home/yvtheja/.pip/pip.log

I have tried installing OpenCL and installing it again, but it doesn't work. Seems like the error comes from Cython.

Any idea how to fix it?

Thank you :)

Extracting 3 channels in a colour stream

I am trying to extract 3 channels from an image coming from Kinect2 stream. So, first I ream the color stream with the pylibfreenect2 package.

color = frames["color"]
So I have the following shape

print(color.asarray().shape) #(1080, 1920, 4)
As I understood, 4 is rather the number of bytes per pixel or the alpha-channel. I want the image to have 3 channels (RGB) and have a shape of (1080, 1920, 3). I tried to do it like:

image_c = cv2.cvtColor(c, cv2.COLOR_RGBA2RGB)
But had an error from PIL package:

TypeError: Cannot handle this data type

Support for libfreenect2 v0.2.0 API changes

  • Freenect2Device::startStreams() (selectively start RGB or depth stream)
  • Registration::undistortDepth() (rectification only without registration)
  • Registration::getPointXYZ()

Continuous integration

Check for builds with supported python versions.

  • ubuntu 14.04
  • osx 10.10 travis doesn't seem to support python on osx
  • Windows #11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.