Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
i'm looking for a 3d math library in python or with python bindings.
it needs to handle rotation, translation, perspective projection, everything basically.
what im NOT looking for is a library aimed at drawing on the screen, googling for hours only led to 3d libraries bent on rendering something to the screen. i dont want any visualization whatsoever, all i need is to be able feed a library x,y,z coordinates and recieve the x,y screen coordinates.
i dont mind if its a visualization library, as long as it can be used without rendering anything to the screen.
is there anything like this for python?
Edit:
please dont recommend scipy/numpy as they arent aimed at 3d math but at math in general, they look like great tools if i wanted to build the library myself, which i dont. thanks.
OpenCV - Python Interface can handle all the operations you've mentioned.
I hear SciPy's excellent for this as well, but I've only used OpenCV.
transformations.py
A library for calculating 4x4 matrices for translating, rotating, reflecting,
scaling, shearing, projecting, orthogonalizing, and superimposing arrays of
3D homogeneous coordinates as well as for converting between rotation matrices,
Euler angles, and quaternions. Also includes an Arcball control object and
functions to decompose transformation matrices.
Authors:
Christoph Gohlke http://www.lfd.uci.edu/~gohlke/
Laboratory for Fluorescence Dynamics, University of California, Irvine
Try gameobjects -- it's a math library that includes Python classes for matrices and vectors, along with methods for transformations. I think it will provide most (if not all) of what you need, plus it's pure Python so you can modify it if you need to.
is SAGE any use to you?
http://vnoel.wordpress.com/2008/05/03/bye-matlab-hello-python-thanks-sage/
http://www.sagemath.org/
I'm working on one now.
https://github.com/adamlwgriffiths/Pyrr
It uses numpy for speed.
The aim is to provide a pure python 3D maths lib.
I'm avoiding external libs because I'm sick of having to follow complex software installs. Python should be easy.
python-math3d is another good 3D mathematic library which is object oriented
https://github.com/mortlind/pymath3d
import math3d as m3d
v = m3d.Vector(1,2,3) # A vector object
o = m3d.Orientation.new_euler((1,0,0), "ZYX") # An Orientation object from one type of euler angles
t = m3d.Transform(o, v) # A Transform object created using the vector and orientation
t2 = m3d.Transform()# Another Transform object (Identity)
t2.orient.rotate_x(3) # rotate the transformation around x
res = t * t2 #Matrix multiplication
What about PyGame? I never used it, but it may contain what you're looking for.
I would suggest MayaVi. Please take a look at the given link. It does almost everything you mentioned.
http://cgkit.sourceforge.net/doc/index.html
The implementation isn't always the best, but it includes quaternions as well as the standard matrix and vector types. I've used it for tools on a couple commercial game projects.
Related
I have a video of a road/building and I want to create a 3D model out of it. The scene I am looking at is rigid and the drone is moving. I assume not having any extra info like camera pose, accelerations or GPS position. I would love to find a python implementation that I can adapt to my liking.
So far, I have decided to use the OpenCV calcOpticalFlowFarneback() for optical flow, which seems reasonably fast and accurate. With it, I can get the Fundamental Matrix F with findFundamentalMat(). So far so good.
Now, according to the tutorial I am following here, I am supposed to magically have the Calibration Matrix of the camera, which I obviously don't have nor plan to have available in the future app I am developing.
After some long research, I have found a paper (Self-calibration of a moving camera from point correspondences and
fundamental matrices) from 1997 that defines what I am looking for (with a nice summary here). I am looking for the simplest/easiest implementation possible, and I am stuck with these problems:
If the camera I am going to use changes exposure and focus automatically (no zoom), are the intrinsic parameters of the camera going to change?
I am not familiar with the Homotopy Continuation Method for solving equations numerically, plus they seem to be slow.
I intend to use the Extended Kalman Filter, but do not know where to start, knowing that a bad initialization leads to non-convergence.
Digging some more I found a Multi Camera Self Calibration toolbox open-source written for Octave with a Python wrapper. My last resort will be to break down the code and write it in Python directly. Any other options?
Note: I do not want to use the a chess board nor the planarity constraint.
Is there any other way to very accurately self-calibrate my camera? After 20 years of research since 1997, has anyone come up with a more straightforward method??
Is this a one-shot thing, or are you developing an app to process lots videos like these automatically?
If the former, I'd rather use an integrated tool like Blender. Look up one of the motion tracking (or "matchmoving") tutorials on youtube to get an idea of it, for example this one.
I've been trying to read through the Stackoverflow questions for generating point clouds (x,y,z) coordinates from a left and right stereo image pair.
I haven't come to any definite solution, and I'm asking the community here for some help.
Problem statement: Given two stereo images, generate 3D (x,y,z) cartesian coordinate point clouds from those and do so in a way that lends itself to completing this point-cloud generation in a way that could work over a large set (thousands) of pairs of stereo images
My programming language experience lends itself to MATLAB, but I've dabbled in Python, and C++ is limited, but I may be able to work in that as well.
Speed is a factor here, so the the idea is to find a quick method of successively going through these pairs and generating the point cloud.
NOTE: I am not asking for the BEST as to avoid comparative solutions, I'm just asking for solutions.
Thank you very much!
Edit: After being recommended to utilize the Stereo Block Matching implementation in OpenCV, I may steer away from this method, as there is a wide variation in regards to texture of the topographical pictures that I'm dealing with.
What you probably want is called "Stereo Block Matching". If you don't feel like writing it yourself, OpenCV has an implementation ready to go (even a CUDA accelerated version).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
i'm looking for a 3d math library in python or with python bindings.
it needs to handle rotation, translation, perspective projection, everything basically.
what im NOT looking for is a library aimed at drawing on the screen, googling for hours only led to 3d libraries bent on rendering something to the screen. i dont want any visualization whatsoever, all i need is to be able feed a library x,y,z coordinates and recieve the x,y screen coordinates.
i dont mind if its a visualization library, as long as it can be used without rendering anything to the screen.
is there anything like this for python?
Edit:
please dont recommend scipy/numpy as they arent aimed at 3d math but at math in general, they look like great tools if i wanted to build the library myself, which i dont. thanks.
OpenCV - Python Interface can handle all the operations you've mentioned.
I hear SciPy's excellent for this as well, but I've only used OpenCV.
transformations.py
A library for calculating 4x4 matrices for translating, rotating, reflecting,
scaling, shearing, projecting, orthogonalizing, and superimposing arrays of
3D homogeneous coordinates as well as for converting between rotation matrices,
Euler angles, and quaternions. Also includes an Arcball control object and
functions to decompose transformation matrices.
Authors:
Christoph Gohlke http://www.lfd.uci.edu/~gohlke/
Laboratory for Fluorescence Dynamics, University of California, Irvine
Try gameobjects -- it's a math library that includes Python classes for matrices and vectors, along with methods for transformations. I think it will provide most (if not all) of what you need, plus it's pure Python so you can modify it if you need to.
is SAGE any use to you?
http://vnoel.wordpress.com/2008/05/03/bye-matlab-hello-python-thanks-sage/
http://www.sagemath.org/
I'm working on one now.
https://github.com/adamlwgriffiths/Pyrr
It uses numpy for speed.
The aim is to provide a pure python 3D maths lib.
I'm avoiding external libs because I'm sick of having to follow complex software installs. Python should be easy.
python-math3d is another good 3D mathematic library which is object oriented
https://github.com/mortlind/pymath3d
import math3d as m3d
v = m3d.Vector(1,2,3) # A vector object
o = m3d.Orientation.new_euler((1,0,0), "ZYX") # An Orientation object from one type of euler angles
t = m3d.Transform(o, v) # A Transform object created using the vector and orientation
t2 = m3d.Transform()# Another Transform object (Identity)
t2.orient.rotate_x(3) # rotate the transformation around x
res = t * t2 #Matrix multiplication
What about PyGame? I never used it, but it may contain what you're looking for.
I would suggest MayaVi. Please take a look at the given link. It does almost everything you mentioned.
http://cgkit.sourceforge.net/doc/index.html
The implementation isn't always the best, but it includes quaternions as well as the standard matrix and vector types. I've used it for tools on a couple commercial game projects.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
A short while I asked for suggestions on choosing a Python-compatible 3D graphics library for robotic motion modelling (using inverse kinematics in Python). After doing a bit of research and redefining my objectives I hope I can ask once again for a bit of assistance.
At the time I thought Blender was the best option - but now I'm having doubts. One key objective I have is the ability integrate the model into a custom GUI (wxPython). Seems like this might be rather difficult (and I'm unsure of the performance requirements).
I think I'm now leaning more towards OpenGL (PyOpenGL + wxglcanvas), but I'm still struggling to to determine if it's the right tool for the job. I'm more of a CAD person, so I have trouble envisioning how to draw complex objects in the API and create motion. I read I could design the object in, say Blender, then import it into OpenGL somehow, but I'm unsure of the process? And how difficult is manipulating motion of objects? For example, if I create a joint between two links, and I move one link, would the other link move dynamically according to the first, or would I need to program each link's movement independently?
Have I missed any obvious tools? I'm not looking for complete robotic modelling packages, I would like to start from scratch so I can incorporate it into my own program. For for learning more than anything. So far I've already looked into vPython, Pyglet, Panda3D, Ogre, and several professional CAD packages.
Thanks
There is a similar project going on that implements a robotic toolbox for matlab and python, it has "Rudimentary 3D graphics", but you can always interface it with blender with a well knit script, it will be less work than reinventing the wheel
If movements can be pre-computed, you can use Blender, hand-craft animations, bake them in some animated file format (cal3d ?), and just render in your wxPython OpenGL window.
If you need to handle user input, you can use a physics engine... I hear Bullet has Python bindings : http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=9&t=4030 (probably still unstable).
Regarding your doubts on Blender/OpenGL : What do you mean by "complex objects" ? How many "robots/whatever" ? How many triangle per robot ? How many articulations per robot ? (I'll edit my answer depending on yours)
Anyway, OpenGL in itself won't do anything else that juste "display triangles" ; everything else has to be done eslewhere.
EDIT
Sorry for the delay, I completely forgot.
So here is what I suggest :
Model your robot in Blender with polygons. You can easily go at >10k polygons, but try to keep the number of objects small (1 object per moving part)
Rig it, i.e. create a skeleton for it. You don't need to animate it.
Export as Collada or X3D
In your own OpenGL app, reimport
Draw your objects at the positions and orientations specified by the skeleton
Modify the angles between the bones just as you would do with real stepper motors
If step #5 was done right, robot should be follow the movements
Optionally add physics ( for instance with Bullet ). The API will be similar in concept to OpenGL, and you will be able to catch objects with your robotic arm.
good luck !
I'm looking for a Python library that would allow me to visualise geometrical data. Nothing extremely complicated, just a bunch of points in the plane or space and a few basic shapes that I would generate.
I had a look at this question and the answers to it, but the focus over there seems to be on computation.
How about Matplotlib/mplot3D?