It's all in the title: I would like to make red-cyan anaglyphs (you know, these pictures you use coloured glasses to see in 3D) of simple shapes (like points3d plots) with Mayavi. Is there such a feature? Otherwise, would you have any advice for implementing it?
EDIT : Okay, that was simple: just hit '3' in the interactive window and this sets the stereoscopic mode on. However I'd be interested in ways to configure this option, which does not seem to be documented.
Yes the interactive renderer is very poorly documented. A lot of mayavi is very badly documented, but at the least the code is often well written to figure stuff out.
Programatically you can adjust it by editing scene.render_window.stereo_render.
The source code of tvtk InteractiveRenderStyle has the following comment, also:
Some systems support crystal Eyes LCD stereo glasses; you have to invoke
set_stereo_type_to_crystal_eyes() on the rendering window.
For more configuration, you'd probably have to read the tvtk source.
Related
I've been playing around with pythreejs, and, while it seems to be a good solution to the problem of visualizing 3D graphics in a jupyter notebook, I haven't been able to find any documentation about what jupyter is actually doing under the hood or what API exists for managing the widget. Currently, when I make a pythreejs plot (e.g., by calling display() on a pythreejs.Renderer object), I get a tiny little output window. How can I edit the size (and other properties) of this window? How can I see what the properties are?
Thanks!
I discovered by experimentation that this can be controlled by passing the width and height parameters to the pythreejs.Renderer constructor. I would, however, appreciate any answer that points me toward better documentation for pythreejs or some philosophy regarding why/how certain aspects of the three.js API were modified for Python's API.
What libraries/modules would you recommend for creating an interactive geometry program?
What I have found includes: Pyglet, Pygame, Pycairo, Sympy
I'll illustrate the basic requirements with an example:
Create two Point objects by clicking two locations on a canvas.
Create two intersecting Circle objects based on those two Points.
Detect the two circles and calculate their intersections.
I would like to work with a canvas that supports anti-aliasing.
I would also like the ability to produce(export) an image with a transparent background.
If you have a bit of experience with OpenGL I would seriously recommend pyglet. Very customizable. If you don't, get it, because in Python there doesn't really exist a game/rendering library that has a "canvas-style" interface, except, to a certain point, pygame. But pygame...
Stay away from pygame. Stay away. pygame has horrendous design, documentation, code written with it and performance.
I have no experience with the two others (or any others, for that fact). There aren't many options for this domain in Python sadly (this also is the reason why I started a project like this, but it's still too unstable and WIP). Most notably the built-in support for things like anti-aliasing, primitives and intersection calculating is non-existent.
I have created a library for interactive geometry board using tkinter.
http://bitbucket.org/zambu/pygraph
I have a wx.ScrolledWindow where is drawn on using cairo. I have implemented a zoom-functionality which right now redraws the whole content.
But as there will be up to 200 curves to draw I should consider a more performant solution.
I have thought of these:
Buffering images for the zoom factors -1/+1 (Memory consuming)
Using librsvg and buffer an SVG image (I have read something about this. Does librsvg work under Windows too?)
Storing the cairo.Context after drawing groups of curves, and on zoom restoring it (just an idea.. is that possible?)
Are there other possibilities, and: what is the best solution?
Thanks a lot
Not really a concrete answer to your question, but I was faced with the same problem and just switched to matplotlib where a zoom and pan function is already implemented. I am not sure though if it is super performant. I have the feeling my program was running more smoothly before.
I also tried out floatcanvas and floatcanvas2 but was not really happy with both of them.
If you're double-buffering anyway, why not do a quick bitmap scale as a "preview" while waiting for the newly redrawn vector image? I confess I don't know how to do this. But if you can make it work, it should work! :)
I'm wandering what the best way is to send a fully scaled (1:1) dxf drawing to a cad plotter using python. Has anyone here ever done this?
For those who want to know why:
I've written a program for my employer that automates the drawing of detailed
schematics, apparently so our engineering dept can spend more time doing nothing. The issue now is that they would like to completely eliminate acad since it's only used to plot the finished drawing.
Mind you these drawings are used for non-trivial things like checking the dimensions of critical components used in commercial jetliners.
In case anyone else runs into this problem (pretty unlikely) I though I'd post briefly what I did in the end:
1.) Wrote a short script to capture the dxf as a BMP (basicaly just a screen grab that appends the scale to the drawing)
2.) Wrote a print dialog with PyQt4 that's a clone of Autocads plot window except that it has to pull the scaling info from the BMP.
My python skills are awfull so there's likely better solutions but this worked.
I am trying to detect a marker in a webcam video feed and overlay it with a 3d object - pretty much exactly like this: http://www.morethantechnical.com/2009/06/28/augmented-reality-with-nyartoolkit-opencv-opengl/
I know artoolkit is the best module for this, but I was hoping to just use opencv in python since I dont know nearly enough c/c++ to be able to use artoolkit. I am hoping someone will be able to get me on the right track towards detecting the marker and determining its location and orientation etc since I have no idea how best to go about this or what functions I should be using.
OpenCV doesn't have marker detection / tracking functionality out of box. However it provides all algorithms needed so it's fairly easy to implement your own one.
The article you are referring to uses OpenCV only for video grabbing. The marker detection is done by NyARToolkit which is derived from ARToolkit. NyARToolkit have versions for Java, C# and ActionScript.
ARToolkit is mostly written in plain C without using fancy C++ features. It's probably easier to use than you thought. The documentation contains well explained tutorials. e.g http://www.hitl.washington.edu/artoolkit/documentation/devstartup.htm
The introductory documentation can help you understand the process of marker detection even if you decide not to use ARToolkit.
I think the most used way to perform marker detection using python and open CV is to use SURF Descriptors.
I have found very useful this video and the linked code you can find in this page. Here you can download the code. I don't know how to overlay it with a 3d object but I'm sure you can do something with pygame or matplotlib.