Comments (9)
I guess I'm luckier, I have the unit at home... :)
Got it, makes sense. And I'm not keeping images indefinitely... after some investigation, it seems to be an issue with K4A, not about freeing buffers.
See here : microsoft/Azure-Kinect-Sensor-SDK#1187
I will try to investigate the work to not using BGRA as a format in the capture, or at least what it means in this python package. I'm not super familiar with C/C++ so it might be a bit challenging for me but I can take a stab if I can't mitigate the issue.
from pyk4a.
I have never seen this. @etiennedub ?
from pyk4a.
It's happening under conditions that I noticed is around low amount of RAM. In fact, I'm doing video analytics and running the k4adevice.get_capture(...)
function in a continuous loop. How are we freeing RAM that is required to be freed by the C SDK? I'm no C expert nor python to C bindings, so... how does one free this manually? Or ensure it's not dangling? My process is taking huge amounts of memory and while I suspect I may be doing something not efficient in Python myself, I'm curious about this part...
if (K4A_RESULT_SUCCEEDED == res) {
res = k4a_image_to_numpy(depth_image_transformed, &np_depth_image);
}
if (K4A_RESULT_SUCCEEDED == res) {
return PyArray_Return(np_depth_image);
}
else {
free(depth_image_transformed);
return Py_BuildValue("");
}
In particular, in this snippet... shouldn't the free(depth_image_transformed)
work when there is a success too?... I guess I'm thinking async here, because once it returned... perhaps this is all handled by python's garbage collector?
from pyk4a.
The free is not used on success because this is handled in the capsule_cleanup function, which is called when your Python code garbage collects the images. So you have to make sure you aren't storing images in a list forever or similar. We do it this way because we must call k4a_release everytime we stop using a capture frame (this does the freeing internally, if the reference count to the capture is zero). By having the garbage collector call the k4a_free function we make sure users don't need to bother with releasing the captures themselves.
Can you confirm the transform function is problematic? If you do not transform, do you still have the problem after a while?
I have doubts about the buffer to k4a function. Maybe it does copy the buffer content and we need to free it. (edit: it should be fine. It reuses the buffer directly. There is an option for a callback to release. We do not need this if our buffer comes from python.)
My Kinect is at the University lab and I can't access for a while to test myself. But I am happy to help debug the problem. This is probably the most complicated part of our wrapper.
Could you create a minimal example file to reproduce the bug?
from pyk4a.
microsoft/Azure-Kinect-Sensor-SDK#1187 is closed, is there still an issue with pyk4a?
In the future it would be nice to support MJPEG
from pyk4a.
There is a patch that is addressing the issue but using my container, I have another depth sensor issue when I use the new .so file that fixes the issue. In fact, the issue is that it's now throwing a warning versus an error when the underlying decoder, libjpeg-turbo
returns certain errors that can be ignored. It should not matter to the rest but somehow when I change the so
file in my container, I see another error that I'm not sure what to do about. I'll wait that the package is pushed out to the repos to retry it using the python wrapper. For now it works because I keep the CPU/memory usage to a lower amount by restricting other docker containers from competing too much on resources.
from pyk4a.
Reopen if pyk4a is the problem!
from pyk4a.
from pyk4a.
Hey if MJPEG decoding is still a problem, you can try directly getting compressed MJPEG color images now: #38
from pyk4a.
Related Issues (20)
- pip install fails on Ubuntu 20.04.4 with "k4a/k4a.h: No such file or directory" HOT 4
- Error installing the py4ak lib HOT 4
- How to record multiple azure kinects HOT 1
- Get Exposure and ISO values in playback HOT 6
- Function "color_image_to_depth_camera" not working HOT 2
- errors when config the depth_mode of the pyk4a as WFOV_UNBINNED HOT 2
- TypeError using with statement to read PyK4APlayback HOT 3
- pyk4a raises an error when Depth mode is set to 0 (Depth is off) HOT 1
- Question about Library HOT 1
- Who knows about [depth_image_to_color_camera_custom]? HOT 1
- Color camera not working with get_capture() in any configuration HOT 12
- How can I get the intrinsic parameters of depth sensor ? HOT 2
- quality of color point cloud HOT 1
- Getting depth information of RGB-Pixels HOT 1
- How do I read captures from two kinects connect to my computer with pyk4a? HOT 1
- convert_2d_to_3d produces Value Errors HOT 6
- sdist build fails with modern setuptools HOT 1
- Depth Value Discrepancies HOT 3
- Increment None object
- --external-sync flag in pyk4a HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyk4a.