etiennedub / pyk4a Goto Github PK
View Code? Open in Web Editor NEWPython 3 wrapper for Azure-Kinect-Sensor-SDK
License: MIT License
Python 3 wrapper for Azure-Kinect-Sensor-SDK
License: MIT License
Python 3.8.5 (with venv)
when importing:
from pyk4a import PyK4A
I hit the issue:
"DLL load failed while importing k4a_module: The specified module could not be found"
DLL loading works when installing and importing from Python 3.7.5
Hi,
Thanks for making this repo, it looks like a promising solution for running the Kinect through Python. I have some issues after installing it though, not all the functions from the cpp source file end up in the k4a_module, like device_get_depth_image()
or transformation_depth_image_to_color_camera()
. I have tried uninstalling and reinstalling a couple times, with the path to both SKD v.1.2.0 and v.1.4.0, as in your installation instruction. Do you know why this happens, or how I can have all the necessary functions in the module?
The functions I need the most are getting depth, RGB-D or point cloud, and calibration data for using OpenCV with aruco boards etc.
Screenshot of k4a_module.py:
Functions in the file calibration.py should pass the argument thead_safe
because it's expected in the low level c functions.
Thanks for your wonderful work!
I extracted depth and images from .mkv (recorded with the k4arecorder tool), but the pixels of the two images do not correspond to each other. How to transform the local depth image from the viewpoint of the depth camera into the viewpoint of the color camera?
Hi,
Thanks for your awesome work!
I wonder if there are any way to get one specific frame from mkv by playback.py ?
For now, I can only get the target frame by using get_next_capture() tons of times.
I noticed that there is a method seek() in playback.py, but it returns nothing.
Also, it dose not change the pointer position of playback from my observation.
So, what is exactly the function the seek()?
And, if there are any way to get the target frame quickly?
Thanks!
Hi, I am writing a huge machine vision project. So I want to separate capturing frame thread and logic main thread. Is your module released GIL while working?
I tried to install pyk4a in Win10 python37 using:
pip install pyk4a --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.0\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.0\sdk\windows-desktop\amd64\release\lib"
but I get error like:
pyk4a/pyk4a.cpp(4): fatal error C1083: 无法打开包括文件: “k4a/k4a.h”: No such file or directory
Could you please help me to fix it, thanks very much
ERROR: Failed building wheel for pyk4a
Failed to build pyk4a
ERROR: Could not build wheels for pyk4a which use PEP 517 and cannot be installed directly
PS D:\python\pyk4a\example> python .\viewer_point_cloud.py
Traceback (most recent call last):
File ".\viewer_point_cloud.py", line 62, in
main()
File ".\viewer_point_cloud.py", line 41, in main
points = capture.depth_point_cloud.reshape((-1, 3))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyk4a\capture.py", line
56, in depth_point_cloud
self._depth_point_cloud = depth_image_to_point_cloud(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyk4a\transformation.py", line 28, in depth_image_to_point_cloud
calibration.transformation_handle, thread_safe, depth, calibration_type_depth,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyk4a\calibration.py", line 118, in transformation_handle
handle = k4a_module.transformation_create(self._calibration_handle, self.thread_safe)
NameError: name 'k4a_module' is not defined
PS D:\python\pyk4a\example>
我也尝试添加了
添加了之后 运行 python .\viewe.py 没问题
但是python .\viewer_point_cloud.py 仍然有错误
Currently seems like only one camera can capture at the time. I am able to connect to 3 different cameras yet when capturing images from the different cameras, the latest one to which I connected is the one that is accessed during independent captures.
Is there already development for supporting multi-cams?
Thanks for your project!
Is there any function i can use to get the camera intrinsic matrix?
I use playback to read mkv and want to get transformed depth frame. The code is as follows:
It works well on Win10, but when run it on Ubuntu 18.04, I got an error:
[2020-11-12 01:28:57.332] [error] [t=1300] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/sdk/k4a.c (1201): transformation_depth_image_to_color_camera_custom(transformation_handle, depth_image_buffer, &depth_image_descriptor, custom_image_buffer, &dummy_descriptor, transformed_depth_image_buffer, &transformed_depth_image_descriptor, transformed_custom_image_buffer, &dummy_descriptor, interpolation_type, invalid_custom_value) returned failure in k4a_transformation_depth_image_to_color_camera()
[2020-11-12 01:28:57.339] [error] [t=1300] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/transformation/transformation.c (584): k4a_transformation_t_get_context(). Invalid k4a_transformation_t (nil)
[2020-11-12 01:28:57.339] [error] [t=1300] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/transformation/transformation.c (649): Invalid argument to transformation_destroy(). transformation_handle ((nil)) is not a valid handle of type k4a_transformation_t
The version of pyk4a and Azure Kinect SDK on Ubuntu is the same as Win10.
How can I solve this?
PS D:\Downloads\pyk4a-master\pyk4a-master\example> python .\viewer.py [2019-11-12 14:10:08.078] [error] [t=5644] D:\a\1\s\extern\Azure-Kinect-Sensor-SDK\src\image\image.c (51): k4a_image_t_get_context(). Invalid k4a_image_t 0000000000000000 [2019-11-12 14:10:08.078] [error] [t=5644] D:\a\1\s\extern\Azure-Kinect-Sensor-SDK\src\image\image.c (359): Invalid argument to image_get_buffer(). image_handle (0000000000000000) is not a valid handle of type k4a_image_t [2019-11-12 14:10:08.079] [error] [t=5644] D:\a\1\s\extern\Azure-Kinect-Sensor-SDK\src\image\image.c (51): k4a_image_t_get_context(). Invalid k4a_image_t 0000000000000000 [2019-11-12 14:10:08.080] [error] [t=5644] D:\a\1\s\extern\Azure-Kinect-Sensor-SDK\src\image\image.c (397): Invalid argument to image_get_height_pixels(). image_handle (0000000000000000) is not a valid handle of type k4a_image_t [2019-11-12 14:10:08.080] [error] [t=5644] D:\a\1\s\extern\Azure-Kinect-Sensor-SDK\src\image\image.c (51): k4a_image_t_get_context(). Invalid k4a_image_t 0000000000000000 [2019-11-12 14:10:08.080] [error] [t=5644] D:\a\1\s\extern\Azure-Kinect-Sensor-SDK\src\image\image.c (390): Invalid argument to image_get_width_pixels(). image_handle (0000000000000000) is not a valid handle of type k4a_image_t Traceback (most recent call last): File ".\viewer.py", line 18, in <module> img_color = k4a.get_capture(color_only=True) File "C:\ProgramData\Anaconda3\lib\site-packages\pyk4a\pyk4a.py", line 65, in get_capture color = k4a_module.device_get_color_image() ValueError: Cannot set the NumPy array 'base' dependency to NULL after initialization
OS: Windows 10
Thank you for this great library!
I might found the following bug:
In
Line 27 in 887d89b
config
is an mutable object. Therefore every other instance with no argument for config
shares this single object.
I don't think that this is intentional, if it is I do not understand why.
The most common pattern I know for this would be:
def __init__(self, config=None, device_id=0):
if not config:
config = Config()
or
def __init__(self, config=None, device_id=0):
self.config = config if config else Config()
if you prefer a one liner.
For a better explanation of this problem see https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
First of all thank you for this repo. I am currently working on Nvidia Xavier and I receive the following error:
The error I receive is :
Collecting pyk4a
Downloading https://files.pythonhosted.org/packages/ab/95/39fc624670d1f2c303e8db27b92a8d391085bcdb654004fcba0a43f41e7a/pyk4a-0.3.tar.gz
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from pyk4a)
Building wheels for collected packages: pyk4a
Running setup.py bdist_wheel for pyk4a ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-2pf4lz14/pyk4a/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 /tmp/tmp0xd5qmq2pip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.6
creating build/lib.linux-aarch64-3.6/pyk4a
copying pyk4a/pyk4a.py -> build/lib.linux-aarch64-3.6/pyk4a
copying pyk4a/config.py -> build/lib.linux-aarch64-3.6/pyk4a
copying pyk4a/init.py -> build/lib.linux-aarch64-3.6/pyk4a
running build_ext
building 'k4a_module' extension
creating build/temp.linux-aarch64-3.6
creating build/temp.linux-aarch64-3.6/pyk4a
aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.6m -c pyk4a/pyk4a.cpp -o build/temp.linux-aarch64-3.6/pyk4a/pyk4a.o
In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib/python3/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyk4a/pyk4a.cpp:2:
/usr/lib/python3/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 "
^~~~~~~
pyk4a/pyk4a.cpp:4:10: fatal error: k4a/k4a.h: No such file or directory
#include <k4a/k4a.h>
^~~~~~~~~~~
compilation terminated.
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
Failed building wheel for pyk4a
Running setup.py clean for pyk4a
Failed to build pyk4a
Installing collected packages: pyk4a
Running setup.py install for pyk4a ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-2pf4lz14/pyk4a/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-t0682us4-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.6
creating build/lib.linux-aarch64-3.6/pyk4a
copying pyk4a/pyk4a.py -> build/lib.linux-aarch64-3.6/pyk4a
copying pyk4a/config.py -> build/lib.linux-aarch64-3.6/pyk4a
copying pyk4a/init.py -> build/lib.linux-aarch64-3.6/pyk4a
running build_ext
building 'k4a_module' extension
creating build/temp.linux-aarch64-3.6
creating build/temp.linux-aarch64-3.6/pyk4a
aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.6m -c pyk4a/pyk4a.cpp -o build/temp.linux-aarch64-3.6/pyk4a/pyk4a.o
In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib/python3/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyk4a/pyk4a.cpp:2:
/usr/lib/python3/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 "
^~~~~~~
pyk4a/pyk4a.cpp:4:10: fatal error: k4a/k4a.h: No such file or directory
#include <k4a/k4a.h>
^~~~~~~~~~~
compilation terminated.
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-2pf4lz14/pyk4a/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-t0682us4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2pf4lz14/pyk4a/
Did you guys ever see this :
[2020-04-18 14:47:40.098] [error] [t=32] ../../src/color/uvc_camerareader.cpp (1300): DecodeMJPEGtoBGRA32(). MJPEG decode failed: -1
[2020-04-18 14:47:40.110] [error] [t=32] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_depth" was popped in a disabled state.
[2020-04-18 14:47:40.124] [error] [t=29] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_color" was popped in a disabled state.
[2020-04-18 14:47:40.170] [error] [t=29] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_color" was popped in a disabled state.
[2020-04-18 14:47:40.184] [error] [t=34] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_capture" was popped in a disabled state.
[2020-04-18 14:47:40.184] [error] [t=34] ../../src/sdk/k4a.c (269): capturesync_get_capture(device->capturesync, capture_handle, timeout_in_ms) returned failure in k4a_device_get_capture()
[2020-04-18 14:47:40.246] [error] [t=29] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_color" was popped in a disabled state.
[2020-04-18 14:47:40.303] [error] [t=29] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_color" was popped in a disabled state.
[2020-04-18 14:47:40.370] [error] [t=29] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_color" was popped in a disabled state.
[2020-04-18 14:47:40.374] [error] [t=34] ../../src/queue/queue.c (112): queue_pop(). Queue "Queue_capture" was popped in a disabled state.
[2020-04-18 14:47:40.374] [error] [t=34] ../../src/sdk/k4a.c (269): capturesync_get_capture(device->capturesync, capture_handle, timeout_in_ms) returned failure in k4a_device_get_capture()
and it goes on forever? I just reset the device and it works after. It doesn't happen too often but sometimes it does and I find it interesting/annoying. :)
Hey there,
is there a way to capture the soundtrack from the Kinect?
In this sense, is it also possible to activate or deactivate corresponding sensors, such as the microphone?
If not, is this possibly planned for the future?
Nice work btw.
Thank you.
First of all thank you so much for this package. I have one problem with the "k4a_module". I get the error "DLL load failed the specified module could not be found". Can you help me?
How to using this package to get point cloud?
I can only get depth image and color image
See coverage failures: #92
guys, would you be interested in getting a PR in for supporting the coordinates transformation functions? I've just completed the work + additional class for Calibration (basic version of the C++ version of the Calibration class - I need to rework the hierarchy once I figure things out better). I've completed what I think is a working versino of calibration_3d_to_3d for now. Probably not optimized at this point but it looks like it's working.
color = k4a_module.device_get_color_image()
ValueError: array is too big; arr.size * arr.dtype.itemsize
is larger than the maximum possible size.
File "playback.py", line 21, in play
cv2.imshow("Depth", colorize(capture.transformed_depth, (None, 5000)))
File "/home/shagren/PycharmProjects/altis-local-api/venv/lib/python3.7/site-packages/pyk4a/capture.py", line 50, in transformed_depth
self._transformed_depth = depth_image_to_color_camera(self._depth, self._calibration, self.thread_safe)
File "/home/shagren/PycharmProjects/altis-local-api/venv/lib/python3.7/site-packages/pyk4a/transformation.py", line 16, in depth_image_to_color_camera
calibration.transformation_handle, thread_safe, depth, calibration.color_resolution,
I am trying to install the body tracking feature on Windows 10 from the body tracking branch using the command: pip install git+https://github.com/lpasselin/pyk4a.git@feature/body-tracking-optional --global-option="build_ext" --global-option="--enable-body-tracking"
The INCLUDE and LIB paths contain the respective SDK include and lib folders. However, I am getting the following error:
Can someone please help me with this issue?
Thank you!
How to using this package to get point cloud?
I can only get depth image and color image
I found some strange behaviors while experimenting with the auto mode for exposure and whitebalance:
To understand 3. I tried manually setting the gain value to its maximum (255) to balance this effect. It kind of works but setting the exposure to auto again will still give a brighter image than a manual setting of max exposure and max gain.
To reproduce the problems:
So for some reason the auto exposure seems to affect the gain and some other hidden parameter. The brightness doesn't seem to be it, trying to change it doesn't affect the image the same way the auto mode does. If you have any idea or question let me know, all I found was this vague mention of gain.
Here I include a slightly modified version of your viewer.py file which uses some keys to modify the parameters and displays their values on the image for easy testing:
import cv2
import numpy as np
import pyk4a
from pyk4a import PyK4A
""" Minimal working example based on example/viewer.py
Whitebalance, exposure time, gain and brightness can be changed or set
to auto when running using keys. Esc or 'q' exit the program.
(+) and (-) keys for settings:
'.' and ',' for whitebalance,
'm' and 'n' for exposure,
'g' and 'f' for gain,
'b' and 'v' for brightness.
"""
def main():
k4a = PyK4A() # all default parameters: 720p, 30fps...
k4a.start()
# getters and setters directly get and set on device
k4a.whitebalance = 4500
# dict of exposure values (for 30fps):
exp_dict = {-11: 500, -10: 1250, -9: 2500, -8: 8330, -7: 16670, -6: 33330}
exp_val = -6 # to be changed when running
k4a.exposure = exp_dict[exp_val]
# (whitebalance & exposure are manual now)
# text settings
text_font = cv2.FONT_HERSHEY_SIMPLEX
text_scale = 1
text_clr = (255, 255, 255)
while 1:
capture = k4a.get_capture()
if np.any(capture.color):
img = capture.color[:, :, :3].copy() # cannot write text on capture
# Add "debug" text on display
text_line1 = "Whitebalance:{} (auto: {})".format(
k4a.whitebalance, k4a.whitebalance_mode_auto)
cv2.putText(img, text_line1, (10,50),
text_font, text_scale, text_clr)
text_line2 = "Exposure:{} (auto: {})".format(
k4a.exposure, k4a.exposure_mode_auto)
cv2.putText(img, text_line2, (10, 100),
text_font, text_scale, text_clr)
text_line3 = "Gain:{}, Brightness:{}".format(
k4a.gain, k4a.brightness)
cv2.putText(img, text_line3, (10, 150),
text_font, text_scale, text_clr)
cv2.imshow("k4a", img)
key = cv2.waitKey(10)
if key == 27 or key == 113: # 'Esc' or 'q' to close
cv2.destroyAllWindows()
break
# New key commands:
elif key == 97: # 'a' resets to auto mode
k4a.whitebalance_mode_auto = True
k4a.exposure_mode_auto = True
# Whitebalance
elif key == 46: # increase with "."
k4a.whitebalance = min(12500, k4a.whitebalance + 100)
elif key == 44: # decrease with ","
k4a.whitebalance = max(2500, k4a.whitebalance - 100)
# Exposure
elif key == 109: # "m" to increase
exp_val = min(-6, exp_val + 1)
k4a.exposure = exp_dict[exp_val]
elif key == 110: # "n" to decrease
exp_val = max(-11, exp_val - 1)
k4a.exposure = exp_dict[exp_val]
# Gain
elif key == 103: # 'g' to increase
k4a.gain = min(255, k4a.gain + 1)
elif key == 102: # 'f' to decrease
k4a.gain = max(0, k4a.gain - 1)
# Brightness (not really necessary)
elif key == 98: # 'b' to increase
k4a.brightness = min(255, k4a.brightness + 1)
elif key == 118: # 'v' to decrease
k4a.brightness = max(0, k4a.brightness - 1)
k4a.stop()
if __name__ == "__main__":
main()
My setup: Windows 10, using SDK v1.4.1, Kinect firmware AzureKinectDK_Fw_1.6.110079014, Python 3.8.6, pyk4a 1.1.0.
And btw thanks a lot for your work, it really helps a ton!
Should source_points
be floats instead of integers? Both the inputs and outputs of the related SDK functions are floats?
https://github.com/etiennedub/pyk4a/blob/develop/pyk4a/calibration.py#L33
Hi,
May I ask if the conversion from 3d to 2d and 2d to 2d are intentional left out or have not been implemented yet? Is there any plan of adding these useful functions?
Appreciate for the awesome work, and thanks in advance!
How to output a depth image of float type?
Building the library works fine however when I try to run the example code on Windows, I receive ImportError: DLL load failed while importing k4a_module: The specified module could not be found. Seems like #60 issues still persist. I am using python version 3.8.5
File "c:\Users\Ozguc\Documents\GitHub\KinectAzureDepthMapping\main.py", line 1, in
from pyk4a import PyK4A
File "C:\Users\Ozguc\anaconda3\envs\azure\lib\site-packages\pyk4a_init_.py", line 1, in
from .calibration import Calibration, CalibrationType
File "C:\Users\Ozguc\anaconda3\envs\azure\lib\site-packages\pyk4a\calibration.py", line 4, in
import k4a_module
ImportError: DLL load failed while importing k4a_module: The specified module could not be found.
Hello,
Thanks for this helpfull code !!
I have a question. Do you know how can we access the joints positions of the skeleton ?
Thanks a lot,
Robin Fays
Hi!
I'm currently trying to install pyk4a with the following method:
pip install git+https://github.com/etiennedub/pyk4a.git --upgrade --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.4.0\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.4.0\sdk\win
dows-desktop\amd64\release\lib"
and I got this error:
Installing collected packages: pyk4a
Running setup.py install for pyk4a ... error
Complete output from command C:\Users\felip\Rebartek\vision-system\Scripts\python.exe -u -c "import setuptools, tokenize;file='C:\Users\felip\AppData\Local\Temp\pip-req-build-kgv40y5d\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().r
eplace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" build_ext "-IC:\Program Files\Azure Kinect SDK v1.4.0\sdk\include" "-LC:\Program Files\Azure Kinect SDK v1.4.0\sdk\win" install --record C:\Users\felip\AppData\Local\Temp\pip-record-y7vyiq7t\install
-record.txt --single-version-externally-managed --compile --install-headers C:\Users\felip\Rebartek\vision-system\include\site\python3.7\pyk4a:
running build_ext
building 'k4a_module' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\pyk4a
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\felip\Rebartek\vision-system\lib\site-packages\numpy\core\include "-IC:\Program Files\Azure Kinect SDK v1
.4.0\sdk\include" -IC:\Users\felip\Rebartek\vision-system\include -IC:\RoboDK\Python37\include -IC:\RoboDK\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\10\i
nclude\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows
Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tppyk4a/pyk4a.cpp /Fobuild\temp.win-amd64-3.7\Release\pyk4a/pyk4a.obj
pyk4a.cpp
C:\Users\felip\Rebartek\vision-system\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pyk4a/pyk4a.cpp(204): warning C4244: 'initializing': conversion from 'npy_intp' to 'int', possible loss of data
pyk4a/pyk4a.cpp(205): warning C4244: 'initializing': conversion from 'npy_intp' to 'int', possible loss of data
creating C:\Users\felip\AppData\Local\Temp\pip-req-build-kgv40y5d\build\lib.win-amd64-3.7
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:libucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\Azure Kinect SDK
v1.4.0\sdk\win" /LIBPATH:C:\Users\felip\Rebartek\vision-system\libs /LIBPATH:C:\RoboDK\Python37\libs /LIBPATH:C:\RoboDK\Python37 /LIBPATH:C:\Users\felip\Rebartek\vision-system\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\T
ools\MSVC\14.26.28801\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" k4a.lib /EXPORT:PyInit_k4a_module build\temp.win-amd64-3.7\Release\pyk4a/pyk4a.obj /OUT
:build\lib.win-amd64-3.7\k4a_module.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\pyk4a\k4a_module.cp37-win_amd64.lib
LINK : fatal error LNK1181: cannot open input file 'k4a.lib'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.exe' failed with exit status 1181
----------------------------------------
Command "C:\Users\felip\Rebartek\vision-system\Scripts\python.exe -u -c "import setuptools, tokenize;file='C:\Users\felip\AppData\Local\Temp\pip-req-build-kgv40y5d\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.c
lose();exec(compile(code, file, 'exec'))" build_ext "-IC:\Program Files\Azure Kinect SDK v1.4.0\sdk\include" "-LC:\Program Files\Azure Kinect SDK v1.4.0\sdk\win" install --record C:\Users\felip\AppData\Local\Temp\pip-record-y7vyiq7t\install-record.txt --single-ver
sion-externally-managed --compile --install-headers C:\Users\felip\Rebartek\vision-system\include\site\python3.7\pyk4a" failed with error code 1 in C:\Users\felip\AppData\Local\Temp\pip-req-build-kgv40y5d\
Any idea on how to solve it?
I've previously installed this library without any error, I recently uninstalled it to see if it works but i keep getting this
Thanks in advance!
Hello,
I got the camera's internal and external parameters "mtx", "dist", "rvecs", "tvecs" of color and depth camera through OpenCV。
How to write these parameters to the function calibration matrix of the project application, and how to use these values.
Thank you for this library, it is very useful.
I try to use 2 different camera to capture images, what I did:
k4a = PyK4A(device_id=0)
k4a.start()
k4a_1 = PyK4A(device_id=1)
k4a_1.start()
the message I got is :
_[2020-12-26 16:52:15.745] [critical] [t=31959] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/usbcommand/usbcommand.c (366): find_libusb_device(). libusb device(s) are all unavalable. Is the device being used by another application?
[2020-12-26 16:52:15.745] [error] [t=31959] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/depth_mcu/depth_mcu.c (68): usb_cmd_create(USB_DEVICE_DEPTH_PROCESSOR, device_index, NULL, &depthmcu->usb_cmd) returned failure in depthmcu_create()
[2020-12-26 16:52:15.745] [error] [t=31959] /_w/1/s/extern/Azure-Kinect-Sensor-SDK/src/sdk/k4a.c (133): depthmcu_create(index, &device->depthmcu) returned failure in k4a_device_open()
Can you give me some advice? Looking forward your reply.
Hello,
how do I get the depth value at a certain point from the depth image that I get in my code?
How do I use this library to generate point cloud images?
Thanks,
Hi,
I am getting misalignment between RGB and depth outputs after "using capture.transformed_depth". Any inputs on how to resolve this issue?
Thanks,
Sai
When I was running viewer.py
GOT AN ERROR :Traceback (most recent call last):
File "viewer.py", line 1, in
import pyk4a
File "D:\ProgramData\Anaconda3\envs\pose\lib\site-packages\pyk4a_init_.py", line 2, in
from .pyk4a import *
File "D:\ProgramData\Anaconda3\envs\pose\lib\site-packages\pyk4a\pyk4a.py", line 2, in
import k4a_module
ImportError: DLL load failed: cannot find the specified module
fristly, I think it is the SDK vision problem, so I was trying to find vision1.2 SDK. but when I was installed vision1.2 it did not worked either.
I guess it is the linking problem, but I did not know how to use it
When additional analysis is applied to the image frame following the capture in the viewer.py example such that the looping frequency is less than 30 Hz, a noticeable delay gets introduced (~0.5 seconds) in the video. This makes it difficult to properly align the Kinect data with other external sensors.
Perhaps this relates to the "lazily fetched" images. Is it possible to get the most recent capture using get_capture() and avoid generating a delay when the looping frequency is less than the camera fps?
Hi
I was looking at the viewer_point_cloud.py script is there a reason you use :
while True:
capture = k4a.get_capture()
if np.any(capture.depth) and np.any(capture.color):
break
instead of just : capture = k4a.get_capture()
It seems you want to make sure the depth and color cameras are both synchronized but I think I read they are synchronized via the hardware ?
also is there a reason for having two while loops ?
thank you
Hi,
Is it possible for multiple applications to access the Kinect stream in parallel ?
Hi @etiennedub
I've got these values from the RGB camera:
"ModelParameters": [
0.49965196847915649,
0.50621724128723145,
0.47322136163711548,
0.63089394569396973,
0.44268873333930969,
-2.6038174629211426,
1.5527737140655518,
0.32462942600250244,
-2.4303467273712158,
1.4789470434188843,
0,
0,
-0.00035283574834465981,
0.00099612073972821236
]
I know that the first 2 are cx, cy, fx and fy and that they are normalized so I can't use them inside opencv as the intrinsic matrix...
Right now i'm using this configuration:
K4A_FRAMES_PER_SECOND_15
K4A_COLOR_RESOLUTION_1080P
K4A_DEPTH_MODE_WFOV_UNBINNED
You gave me this code to check it out, but I'm not sure if I understand it correctly
I'd appreciate if you give me some help on transforming these values, thanks again!
Hello,
When I'm using this command from your code in Jupyterlab :
pip install pyk4a --global-option=build_ext --global-option="-IC:\Program Files\Azure Kinect SDK v1.3.0\sdk\include" --global-option="-LC:\Program Files\Azure Kinect SDK v1.3.0\sdk\windows-desktop\amd64\release\lib"
Do you know what can be the problem ? I added the folder to my path variables like this :
Thanks for your answer !
Robin Fays
This is more of a feature request. But I noticed that the camera capturing hangs on k4a.get_capture() when running in a subprocess.
I am thinking about using multiple cameras and I know I need to synchronize them. Is it possible to access multiple cameras with this wrapper and can I synch the cameras (as the kinect SDK docs says) by doing something like this :
k4a_device_configuration_t deviceConfig;
deviceConfig.wired_sync_mode = K4A_WIRED_SYNC_MODE_SUBORDINATE
with the wrapper ?
Hi @etiennedub
I'm currently using your repo to work with my Azure Kinect and it works really nice!
I'm having some issues with the intrinsics that I got from this function (save_calibration_json)
I have the current intrinsics that I got from the Open3D Method (with the mkv reader) and I got this (and they work):
1920, 1080, 919.42980957, 919.3795166, 953.07250977, 551.76287842
The problem now is that using your function I got this:
0.49665233492851257,
0.50851589441299438,
0.47886967658996582,
0.6384580135345459,
0.32674625515937805,
-2.3125674724578857,
1.3249306678771973,
0.21215163171291351,
-2.1464962959289551,
1.2583736181259155,
0,
0,
-0.00038163267890922725,
0.000783831172157079
and none of these values look like the ones that I got
I think that this is some form of problem converting these values and I'd really appreciate some help from you!
Thanks for everything
I'm trying to use the pyk4a example regarding the depth image demo and there is a reference there to helpers library . To which helpers library it refers ? Can you help with a link to it's intsallation?
At first: Thanks for making this repo available!
I'm currently unable to install pyk4a on linux (Mint 19.1 which is based on Ubuntu 18.04).
Problem:
It seems that the compiler can't find the k4a.h.
pyk4a/pyk4a.cpp:4:10: fatal error: k4a/k4a.h: No such file or directory
#include <k4a/k4a.h>
^~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
What i did:
(Kinect_env) nixi@nixis-laptop:~/Projects/Azure_Kinect/pyk4a/example$ export LD_LIBRARY_PATH=/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/
(Kinect_env) nixi@nixis-laptop:~/Projects/Azure_Kinect/pyk4a/example$ echo $LD_LIBRARY_PATH
/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/
(Kinect_env) nixi@nixis-laptop:~/Projects/Azure_Kinect/pyk4a/example$ pip install pyk4a
Collecting pyk4a
Using cached pyk4a-0.3.tar.gz (6.9 kB)
Requirement already satisfied: numpy in /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages (from pyk4a) (1.18.2)
Building wheels for collected packages: pyk4a
Building wheel for pyk4a (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/nixi/anaconda3/envs/Kinect_env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-12goisa7/pyk4a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-12goisa7/pyk4a/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 /tmp/pip-wheel-457cvchg
cwd: /tmp/pip-install-12goisa7/pyk4a/
Complete output (27 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/pyk4a
copying pyk4a/pyk4a.py -> build/lib.linux-x86_64-3.8/pyk4a
copying pyk4a/config.py -> build/lib.linux-x86_64-3.8/pyk4a
copying pyk4a/__init__.py -> build/lib.linux-x86_64-3.8/pyk4a
running build_ext
building 'k4a_module' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/pyk4a
gcc -pthread -B /home/nixi/anaconda3/envs/Kinect_env/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include -I/home/nixi/anaconda3/envs/Kinect_env/include/python3.8 -c pyk4a/pyk4a.cpp -o build/temp.linux-x86_64-3.8/pyk4a/pyk4a.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
from /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyk4a/pyk4a.cpp:2:
/home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^~~~~~~
pyk4a/pyk4a.cpp:4:10: fatal error: k4a/k4a.h: No such file or directory
#include <k4a/k4a.h>
^~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyk4a
Running setup.py clean for pyk4a
Failed to build pyk4a
Installing collected packages: pyk4a
Running setup.py install for pyk4a ... error
ERROR: Command errored out with exit status 1:
command: /home/nixi/anaconda3/envs/Kinect_env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-12goisa7/pyk4a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-12goisa7/pyk4a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-asgtfnnx/install-record.txt --single-version-externally-managed --compile --install-headers /home/nixi/anaconda3/envs/Kinect_env/include/python3.8/pyk4a
cwd: /tmp/pip-install-12goisa7/pyk4a/
Complete output (27 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/pyk4a
copying pyk4a/pyk4a.py -> build/lib.linux-x86_64-3.8/pyk4a
copying pyk4a/config.py -> build/lib.linux-x86_64-3.8/pyk4a
copying pyk4a/__init__.py -> build/lib.linux-x86_64-3.8/pyk4a
running build_ext
building 'k4a_module' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/pyk4a
gcc -pthread -B /home/nixi/anaconda3/envs/Kinect_env/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include -I/home/nixi/anaconda3/envs/Kinect_env/include/python3.8 -c pyk4a/pyk4a.cpp -o build/temp.linux-x86_64-3.8/pyk4a/pyk4a.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
from /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyk4a/pyk4a.cpp:2:
/home/nixi/anaconda3/envs/Kinect_env/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^~~~~~~
pyk4a/pyk4a.cpp:4:10: fatal error: k4a/k4a.h: No such file or directory
#include <k4a/k4a.h>
^~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/nixi/anaconda3/envs/Kinect_env/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-12goisa7/pyk4a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-12goisa7/pyk4a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-asgtfnnx/install-record.txt --single-version-externally-managed --compile --install-headers /home/nixi/anaconda3/envs/Kinect_env/include/python3.8/pyk4a Check the logs for full command output.
(Kinect_env) nixi@nixis-laptop:~/Projects/Azure_Kinect/pyk4a/example$
I think I didn't add the LD_LIBRARY_PATH correctly.
5 . So I tryed the following as well:
(Kinect_env) nixi@nixis-laptop:~/Projects/Azure_Kinect/pyk4a/example$ sudo -H pip install --global-option build_ext --global-option -I/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ --global-option -L/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ pyk4a
[sudo] password for nixi:
/usr/lib/python2.7/dist-packages/pip/commands/install.py:212: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting pyk4a
Using cached https://files.pythonhosted.org/packages/ab/95/39fc624670d1f2c303e8db27b92a8d391085bcdb654004fcba0a43f41e7a/pyk4a-0.3.tar.gz
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (from pyk4a)
Skipping bdist_wheel for pyk4a, due to binaries being disabled for it.
Installing collected packages: pyk4a
Running setup.py install for pyk4a ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hqYnRx/pyk4a/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext -I/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ -L/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ install --record /tmp/pip-8stf3r-record/install-record.txt --single-version-externally-managed --compile:
running build_ext
building 'k4a_module' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/pyk4a
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/ -I/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ -I/usr/include/python2.7 -c pyk4a/pyk4a.cpp -o build/temp.linux-x86_64-2.7/pyk4a/pyk4a.o
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pyk4a/pyk4a.cpp:2:
/usr/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 /usr/include/python2.7/Python.h:84:0,
from pyk4a/pyk4a.cpp:1:
pyk4a/pyk4a.cpp: In function ‘int pyk4a_traverse(PyObject*, visitproc, void*)’:
pyk4a/pyk4a.cpp:187:44: error: ‘PyModule_GetState’ was not declared in this scope
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
^
/usr/include/python2.7/objimpl.h:341:13: note: in definition of macro ‘Py_VISIT’
if (op) { \
^~
pyk4a/pyk4a.cpp:209:18: note: in expansion of macro ‘GETSTATE’
Py_VISIT(GETSTATE(m)->error);
^~~~~~~~
pyk4a/pyk4a.cpp:187:44: note: suggested alternative: ‘PyModule_GetName’
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
^
/usr/include/python2.7/objimpl.h:341:13: note: in definition of macro ‘Py_VISIT’
if (op) { \
^~
pyk4a/pyk4a.cpp:209:18: note: in expansion of macro ‘GETSTATE’
Py_VISIT(GETSTATE(m)->error);
^~~~~~~~
In file included from /usr/include/python2.7/Python.h:83:0,
from pyk4a/pyk4a.cpp:1:
pyk4a/pyk4a.cpp: In function ‘int pyk4a_clear(PyObject*)’:
pyk4a/pyk4a.cpp:187:44: error: ‘PyModule_GetState’ was not declared in this scope
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
^
/usr/include/python2.7/object.h:816:13: note: in definition of macro ‘Py_CLEAR’
if (op) { \
^~
pyk4a/pyk4a.cpp:215:18: note: in expansion of macro ‘GETSTATE’
Py_CLEAR(GETSTATE(m)->error);
^~~~~~~~
pyk4a/pyk4a.cpp:187:44: note: suggested alternative: ‘PyModule_GetName’
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
^
/usr/include/python2.7/object.h:816:13: note: in definition of macro ‘Py_CLEAR’
if (op) { \
^~
pyk4a/pyk4a.cpp:215:18: note: in expansion of macro ‘GETSTATE’
Py_CLEAR(GETSTATE(m)->error);
^~~~~~~~
pyk4a/pyk4a.cpp: At global scope:
pyk4a/pyk4a.cpp:219:31: error: variable ‘PyModuleDef moduledef’ has initializer but incomplete type
static struct PyModuleDef moduledef =
^~~~~~~~~
pyk4a/pyk4a.cpp:221:9: error: ‘PyModuleDef_HEAD_INIT’ was not declared in this scope
PyModuleDef_HEAD_INIT,
^~~~~~~~~~~~~~~~~~~~~
pyk4a/pyk4a.cpp:221:9: note: suggested alternative: ‘PyObject_HEAD_INIT’
PyModuleDef_HEAD_INIT,
^~~~~~~~~~~~~~~~~~~~~
PyObject_HEAD_INIT
pyk4a/pyk4a.cpp: In function ‘void PyInit_k4a_module()’:
pyk4a/pyk4a.cpp:239:28: error: ‘PyModule_Create’ was not declared in this scope
PyObject *module = PyModule_Create(&moduledef);
^~~~~~~~~~~~~~~
pyk4a/pyk4a.cpp:239:28: note: suggested alternative: ‘_PyModule_Clear’
PyObject *module = PyModule_Create(&moduledef);
^~~~~~~~~~~~~~~
_PyModule_Clear
In file included from /usr/include/c++/7/cstddef:50:0,
from /home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/k4a/k4atypes.h:12,
from /home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/k4a/k4a.h:16,
from pyk4a/pyk4a.cpp:4:
pyk4a/pyk4a.cpp:231:26: error: return-statement with a value, in function returning 'void' [-fpermissive]
#define INITERROR return NULL
^
pyk4a/pyk4a.cpp:242:13: note: in expansion of macro ‘INITERROR’
INITERROR;
^~~~~~~~~
pyk4a/pyk4a.cpp:187:44: error: ‘PyModule_GetState’ was not declared in this scope
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
^
pyk4a/pyk4a.cpp:243:35: note: in expansion of macro ‘GETSTATE’
struct module_state *st = GETSTATE(module);
^~~~~~~~
pyk4a/pyk4a.cpp:187:44: note: suggested alternative: ‘PyModule_GetName’
#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
^
pyk4a/pyk4a.cpp:243:35: note: in expansion of macro ‘GETSTATE’
struct module_state *st = GETSTATE(module);
^~~~~~~~
pyk4a/pyk4a.cpp:245:72: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
st->error = PyErr_NewException("pyk4a_module.Error", NULL, NULL);
^
In file included from /usr/include/c++/7/cstddef:50:0,
from /home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/k4a/k4atypes.h:12,
from /home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/k4a/k4a.h:16,
from pyk4a/pyk4a.cpp:4:
pyk4a/pyk4a.cpp:231:26: error: return-statement with a value, in function returning 'void' [-fpermissive]
#define INITERROR return NULL
^
pyk4a/pyk4a.cpp:249:13: note: in expansion of macro ‘INITERROR’
INITERROR;
^~~~~~~~~
pyk4a/pyk4a.cpp:251:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
return module;
^~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hqYnRx/pyk4a/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext -I/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ -L/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/include/:/home/nixi/Projects/Azure_Kinect/Azure-Kinect-Sensor-SDK/build/src/sdk/include/ install --record /tmp/pip-8stf3r-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-hqYnRx/pyk4a/
(Kinect_env) nixi@nixis-laptop:~/Projects/Azure_Kinect/pyk4a/example$
I did also run it as root, same outcome.
The same 5 steps I did on my Jetson Nano which has no Conda environment running, a different architecture and a linux system derived from Ubuntu.
There the error massages are alike to the try above.
I would really appreciate help on that.
it did not work, when i use k4a.save_calibration_json function.
Exception has occurred: AttributeError
'PyK4A' object has no attribute 'save_calibration_json'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.