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 5 years ago.
Improve this question
I'm looking to visualize the data, hopefully make it interactive. Right now I'm using NetworkX and Matplotlib, which maxes out my 8gb when I attempt to 'draw' the graph. I don't know what options and techniques exist for handling such a large cluster** of data. If someone could point me in the right direction, that'd be great. I also have a CUDA enabled GFX card if that could be of use.
Right now I'm thinking of drawing only the most connected nodes, say top 5% of vertices with the most edges, then filling in less connected nodes as the user zooms or clicks.
I don't have any experience with it, but tulip seems to be made for that.
Maybe PyOpenGL? It can be used together with wxPython.
Edit: Just tried the performance without any optimization, it takes 0.2s to draw 100k vertices and 4s to draw 1M edges.
You should ask on the official wxPython mailing list. There are people there that can probably help you. I am surprised that matplotlib isn't able to do this though. It may just require you to restructure your code in some way. Right now, the main ways to draw in wxPython are via the various DCs, one of the FloatCanvas widgets or for graphing, wx.Plot or matplotlib.
Have you considered graphviz? Not interactive although it was designed from the outset to handle very large graphs (although 1M edges may be beyond even it's capabilities).
There's a python module (pydot) that makes interacting with graphviz simple. Again, can't say for sure it'll scale to your levels. However, it should be easy to find out: installation of both is simple.
hth.
Have you considered using ParaView or VisIt? These are two interactive plotting programs which are designed to deal with and plot (very!) large data sets. They both also have a Python scripting interface, so you can automate/control your visualizations from within the Python interpreter.
Have you tried Gephi ?
I believe it scales very well.
Related
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 7 years ago.
Improve this question
As part of my UI, I want to display graphs. The requirements are:
The graph must respond to events (e.g. mouse clicks).
If the graph is directed I want nice arrows.
If there are several edges spanning two nodes I want to display several edges.
The layout must be nice.
Now, there are two libraries: networkx and graphviz that can do some of those things. networkx can do 1 and (with some major hacks) 2. graphviz can do 2 and 3. 4 can be done by either library.
I would actually prefer to use graphviz because that would eliminate some dependencies; however, its inability to interact with matplotlib is a major problem.
Therefore, at the moment I am stuck with networkx, have to use a hack for arrows and abandon the idea of parallel edges.
My question is: Is this the state of the art or there is some other approach I could try?
Another question: Is it better to use a different language for graph visualization? For example, would it make sense to move all UI/visualization to JavaScript, while keeping Python only for data analysis?
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 3 years ago.
Improve this question
I am looking for a library, example or similar that allows me to loads a set of 2D projections of an object and then converts it into a 3D volume.
For example, I could have 6 pictures of a small toy and the program should allow me to view it as a 3D volume and eventually save it.
The object I need to convert is very similar to a cylinder (so the program doesn't have to 'understand' what type of object it is).
There are several things you can mean, I think none of which currently exists in free software (but I may be wrong about that), and they differ in how hard they are to implement:
First of all, "a 3D volume" is not a clear definition of what you want. There is not one way to store this information. A usual way (for computer games and animations) is to store it as a mesh with textures. Getting the textures is easy: you have the photographs. Creating the mesh can be really hard, depending on what exactly you want.
You say your object looks like a cylinder. If you want to just stitch your images together and paste them as a texture over a cylindrical mesh, that should be possible. If you know the angles at which the images are taken, the stitching will be even easier.
However, the really cool thing that most people would want is to create any mesh, not just a cylinder, based on the stitching "errors" (which originate from the parallax effect, and therefore contain information about the depth of the pictures). I know Autodesk (the makers of AutoCAD) have a web-based tool for this (named 123-something), but they don't let you put it into your own program; you have to use their interface. So it's fine for getting a result, but not as a basis for a program of your own.
Once you have the mesh, you'll need a viewer (not view first, save later; it's the other way around). You should be able to use any 3D drawing program, for example Blender can view (and edit) many file types.
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 3 years ago.
Improve this question
I am currently working on a project where I generate several images and then transform them into a video.
I am using OpenCV for the whole image processing thing, and especially cv.WriteFrame.
Even though it is working quite well, I would like to add some effects for image transition.
Simple things in fact, I would like the images to blend into each other to avoid the "violent" way it is currently done.
I also have problems with the fps in cv.WriteFrames (which is not accurate).
I searched on the internet without finding any library/utility to do that, so I started thinking about implementing it by myself. It would be quite a hassle though.
Would you know about an option to do such a thing?
I am open to any solution !
Thanks
To have a smooth transition you most likely have to put some extra frames between the 2 images. Those extra frames could be the 2 images progressively adding each other.
Usually opencv addWeighted is used to blend 2 images, it has parameters to set the weights.
addWeighted docs:
http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#addweighted
Well, I've never worked with OpenCV, but if you want to do a fade in or fade out I could envision doing something like creating frames that have progressively more alpha transparency and adding them into the stack thats being written to the video file. Something like that could be done in just a few lines of code with PIL.
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 !
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 7 years ago.
Improve this question
I'm looking for a Python library for creating canvases for manipulating geometric shapes. Specifically I need the ability to create arbitrary polygons and place them on the canvas, the polygons need to have the ability to be transparent/have an alpha channel, I need to be able to edit polygons that are currently on the canvas, and I need to be able to get the actual color of a given pixel(the aggregate of all the transparent piece that are there).
Basically I'm trying to make this: http://alteredqualia.com/visualization/evolve/ in python.
I think cairo will do a lot of what you want. They have python bindings, too.
The one requirement that that won't help you with is modifying previously-drawn polygons, but I don't know of any canvas that will do that for you.
Sounds like a job for OpenGL.
My advice is that, whichever library you choose, you make a data structure for your polygons that suits your algorithms so that they can be more simple and readable rather then try to get these algorithms to manipulate a canvas directly. Then you can write the code that draws them separate (i.e. independent) of the main logic.
This discussion on Stackoverflow has some comparisons and code snippets on various GUI toolkits for Python. I'm pretty sure that the QGraphicsView on QT will do transparency. Nokia (nee Troll) make a demo suite for QT that should give you an idea of its capabilities.
Try pyglet. It is a graphics library for Python with OpenGL. If you've done OpenGL programming before, it is certainly the easiest way to get what you want.
I believe the HTML canvas lets you modify elements
It does not. You can check out my HTML canvas tutorial to see how you draw a moving ball; you wipe the screen and draw a new circle at the spot you want.
You can draw simple shapes to a canvas in all of pyglet, pygame, QT, Tkinter, wxPython and cairo.
Generally, you will have objects called "sprites" or "shapes" that represent objects drawn to the screen, and you'll store them all in a container. Then the library or framework will, at every frame, render them all to the canvas. Thus it will seem to the user (you) that you can modify the objects on screen; you set a ball's x and y coordinates and in the next frame it's rendered there. However, at a low level, everything's being wiped and redrawn again.
For computationally intensive animation, a technique called double-buffering will be employed whereby a bitmap in memory will be modified instead of the one onscreen, and then the drawing process will simply be to copy that bitmap to the screen.
alter the item in the list and then create a new canvas, which seems like it would have a significant overhead.
All of the frameworks mentioned above will give you a nice abstraction for the list of objects to draw, so that you won't need to maintain it manually, and you can program as if the sprites/shapes you've drawn can be directly moved onscreen, even though they really aren't at a low level.
Pygame should be able to do this for you.
See pygame.draw.polygon
I believe the HTML canvas lets you modify elements, which makes me believe there might be another canvas that can as well. However, if there is not that would basically require me to keep a separate list of all the polygons and when I wanted to make a change, alter the item in the list and then create a new canvas, which seems like it would have a significant overhead.
Both Qt and wxWidgets have some canvas drawing abilities (Qt calls it GraphicsView). Quick Google searches will get you a lot of examples so you can see if it fits your requirements.