How to make regular triangle mesh in opencv? - python

I've searched without getting any success.
Is it possible create a regular triangle mesh in opencv ?

You could use cv::Subdiv2D for triangulation. Here is a link to C++ and Python examples.
But I think this implementation cannot handle holes, if I remember correctly.
I would also suggest that you check out the C-library Triangle. It allows you to specify holes besides many other useful things. Apparently, several wrappers for Python exist for it (but I have never used them).

Related

Plot vertex as image in Igraph

I'm wondering if it is possible to plot a vertex as image (loaded from a file or directly) in Igraph. Any ideas?
This is definitley possible in the R version of iGraph using the raster function, however a brief search did not reveal any implementation of this function in Python (it's not in the igraph documentation anyway).
If this is essential to your work, then I would consider switching to R, or possibly another tool such as Gephi. For Python, however, you might consider using something like pyvis. This package is small but powerful in terms of visualization. I've been playing around with it over the past few days and its very easy to display a graph with pictures as nodes, and it comes with the added benefit of providing interactive functioning. Take a look at the tutorial here, which will highlight what this package can provide.

Software or python package to draw and plot simple objects in 3D?

I am looking for a software package, or even better, a python package that allows me to draw objects by inputing parameters, for example: I want a circle at position x,y, radius r, thickness t, color c and then look at it at different angles.
I know that I could use stuff like blender, but I feel that this is overkill and it would take a long time to learn it sufficiently.
I just need this to do some ncie looking plots in my thesis.
thx.
I would recommend OpenSCad. It is a software to create 3D objects by writing code. Although it isn't a python package, it is quite lightweight, has a nice view and the commands are really easy to learn - take a look at their Cheat Sheet. The projects can be shared as text files or exported in various 3D formats, to get a prettier view from other software.
And I you want to do the same but stick with Python you can combine OpenSCAD with SolidPython.

Detection of symmetries in Python

I want to detect symmetries (rotation, translation, etc) of a simple figure or a shape in a image. That is, if I find one symmetry I want to replicate my original figure with it.
Are there any function or module?
I have thought in python-opencv, but I did not find nothing.
Let me just throw some packages at you: OpenCV for Python Cookbook might be a good start. A search for "opencv" on the Python Package Index yields several bindings of OpenCV for Python.
Concerning the detection of symmetries: The answer to question how to detect simple geometric shapes using OpenCV? might be a good start. After you find similar objects, check their orientation. Replacing then should be a piece of cake.

What would you use to create an interactive geometry program with python?

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

Detect marker with opencv and python

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.

Categories

Resources