Giter Site home page Giter Site logo

Comments (10)

KonstantinosAng avatar KonstantinosAng commented on July 2, 2024

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.

jdyjjj avatar jdyjjj commented on July 2, 2024

image

from pykinect2-mapper-functions.

jdyjjj avatar jdyjjj commented on July 2, 2024

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.

KonstantinosAng avatar KonstantinosAng commented on July 2, 2024

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.

jdyjjj avatar jdyjjj commented on July 2, 2024

Thank you for your answer. I try your method to remove inf, but this method will make a new error that in this picture:
image

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 2, 2024

try removing the option axis=1

color2depth_points = color2depth_points[np.all(color2depth_points != float('-inf'))] # remove -inf

from pykinect2-mapper-functions.

jdyjjj avatar jdyjjj commented on July 2, 2024

This is bug now, but I really don't know why this error occurs.

image

image

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 2, 2024

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.

KonstantinosAng avatar KonstantinosAng commented on July 2, 2024

run git pull and try again without the:

color2depth_points = color2depth_points[np.all(color2depth_points != float('-inf'))] # remove -inf

from pykinect2-mapper-functions.

jdyjjj avatar jdyjjj commented on July 2, 2024

from pykinect2-mapper-functions.

Related Issues (13)

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.