Comments (10)
Hello, the problem is with int(center_x), int(center_y). you cannot be sure that the Kinect values will always be numeric (float or int). The kinect is susceptible to external noise, such as light and reflections, and its values can overflow and return as '-inf'.
Thus, the error: cannot convert float infinity to int
i suggest you do int(center_x) if center_x != float('-inf') and center_x != float('inf') else center_x, and the same for center_y
or better:
int(center_x) if center_x != float('-inf') and center_x != float('inf') else 0
from pykinect2-mapper-functions.
from pykinect2-mapper-functions.
Thank you for your answering. But the reason for this error is depth_x and depth_y is inf. And center_x and center_y is int.
from pykinect2-mapper-functions.
Then you have to handle their value:
Also numpy can filter these values faster with:
color2depth_points = color2depth_points[np.all(color2depth_points != float('-inf'), axis=1)] # remove -inf
and then do:
depth_x = color2depth_points[color_point[1] * 1920 + color_point[0] - 1].x
depth_y = color2depth_points[color_point[1] * 1920 + color_point[0] - 1].y
from pykinect2-mapper-functions.
Thank you for your answer. I try your method to remove inf, but this method will make a new error that in this picture:
from pykinect2-mapper-functions.
try removing the option axis=1
color2depth_points = color2depth_points[np.all(color2depth_points != float('-inf'))] # remove -inf
from pykinect2-mapper-functions.
This is bug now, but I really don't know why this error occurs.
from pykinect2-mapper-functions.
ok, I think it is better for me to change it in the library than this. I will push the changes in short in this repo
from pykinect2-mapper-functions.
run git pull and try again without the:
color2depth_points = color2depth_points[np.all(color2depth_points != float('-inf'))] # remove -inf
from pykinect2-mapper-functions.
from pykinect2-mapper-functions.
Related Issues (13)
- Typo in depth_img = depth_frame.reshape((kinect.depth_frame_desc.Height, kinect.depth_frame_desc.Width, 4)).astype(np.uint8) HOT 3
- when using function depth_point_2_world_point(), a problem will occur. HOT 3
- Mapping in the Original PyKinect HOT 2
- mapper.py is a slow in converting between color space to depth space HOT 18
- Canwe use mapper functions on already acquired images HOT 4
- Convertted depth image should be an uint16 array HOT 3
- What is the requirement of the Python Version? HOT 2
- About Aligned Image HOT 1
- About Mapper "color_2_depth_space" HOT 1
- Hello!Here is a question about 'color_2_depth_space'. HOT 1
- something wrong in depth map to color, it seems not accuracy HOT 1
- Related to 1.getting same values of pixel in entire columna and 2. frame resolution HOT 1
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 pykinect2-mapper-functions.