determine camera rotation and translation matrix from essential matrix - camera

I am trying to extract rotation matrix and translation matrix from essential matrix.
I took these answers as reference:
Correct way to extract Translation from Essential Matrix through SVD
Extract Translation and Rotation from Fundamental Matrix
Now I've done the above steps applying SVD to essential matrix, but here comes the problem. According to my understanding about this subject, both R and T has two answers, which leads to 4 possible solutions of [R|T]. However only one of the solutions would fit in the physical situation.
My question is how can I determine which one of the 4 solutions is the correct one?
I am just a beginner on studying camera position. So if possible, please make the answer be as clear (but simple) as possible. Any suggestion would be appreciated, thanks.

The simplest is testing a point 3D position using the possible solution, that is, a reconstructed point will be in front of both cameras in only one of the possible 4 solutions.
So assuming one camera matrix is P = [I|0], you have 4 options for the other camera, but only one of the pairs will place such point in front them.
More details in Hartley and Zisserman's multiple view geometry (page 259)
If you can use Opencv (version 3.0+), you count with a function called "recoverPose", this function will do that job for you.
Ref: OpenCV documentation, http://docs.opencv.org/trunk/modules/calib3d/doc/calib3d.html

Related

Make 3D figure of 2D images "projecting information" onto each other

Is there a way to make a z-stack of 2-D images, at the isometric view in 3-D, of points in each 2-D image projecting downwards to the next slice of 2-D images? I am certain there is a technical term for this, but I just don't have the vocabulary to find the most pertinent answer. Would someone be able to point me in the right direction?
Below, I've drawn an "idea" of what this looks like. I'd love to know if this is possible without re-inventing wheels for matplotlib or other Python plotting libraries.
The original question was posed for doing so in Python. After many months of searching, I found a way to do so in TikZ. I cannot consider this my original work, it is largely based on Pascal Seppecher's interaction diagram found here.
To reconstitute my question above, one can use the above template to define:
Agents of different shapes, specify fills
The frame (plane)
which they reside in
Flows of directed edges that communicate
how agents interact with each other in each plane
Inter-plane
interaction flows
https://texample.net/tikz/examples/interaction-diagram/

Paraview: Calculate the surfae area of a3D object

I want to calculate the surface area of a 3D body (binarized: 1=inside, 0=outside so it's "voxelated") using Paraview. I found the filter "integrate variable" that gives me a value and it's reasonable. But I want to know what's the algorithm implemented into Paraview to compute it! It's an open-source software so everything should be open but I cannot find the reference.
Any idea?
Pretty simple: this filter computes the area of each polygon and sums them up. There are quite a few types of polygons supported, so the details of computing the area of each vary. Please consult http://www.paraview.org/gitweb?p=ParaView.git;a=blob;f=ParaViewCore/VTKExtensions/Default/vtkIntegrateAttributes.cxx;h=352155009780b7a45d5b4c00a75178de0f724675;hb=HEAD for details.

interpolation and projection on geo-spatial data

everyone
recently I am trying to solve the location error generated by GPS, so I came up with an idea of projecting the GPS points to the nearest road, as shown bellow [1]. But I know that indeed earth is not a flat plane and general projection method is not adaptive to this problem. What should I do to deal with the projection problem that exists on sphere to get a better precision?
![1]: http://imgur.com/nL7tB7m
Similarly, when it comes to interpolation between two points, same problem emerged. I did once assume two points were closed so I could ignore the flatness
effect, but failed if their distance was long enough. Regular interpolation method won't give me a better-precision result.
![2]: http://imgur.com/rOSu8gk

transform a path along an arc

Im trying to transform a path along an arc.
My project is running on osX 10.8.2 and the painting is done via CoreAnimation in CALayers.
There is a waveform in my project which will be painted by a path. There are about 200 sample points which are mirrored to the bottom side. These are painted 60 times per second and updated to a song postion.
Please ignore the white line, it is just a rotation indicator.
What i am trying to achieve is drawing a waveform along an arc. "Up" should point to the middle. It does not need to go all the way around. The waveform should be painted along the green circle. Please take a look at the sketch provided below.
Im not sure how to achieve this in a performant manner. There are many points per second that need coordinate correction.
I tried coming up with some ideas of my own:
1) There is the possibility to add linear transformations to paths, which, i think, will not help me here. The only thing i can think of is adding a point, rotating the path with a transformation, adding another point, rotating and so on. But this would be very slow i think
2) Drawing the path into an image and bending it would surely lead to image-artifacts.
3) Maybe the best idea would be to precompute sample points on an arc, then save save a vector to the center. Taking the y-coordinates of the waveform, placing them on the sample points and moving them along the vector to the center.
But maybe i am just not seeing some kind of easy solution to this problem. Help is really appreciated and fresh ideas very welcome. Thank you in advance!
IMHO, the most efficient way to go (in terms of CPU usage) would be to use some form of pre-computed approach that would take into account the resolution of the display.
Cleverly precomputed values
I would go for the mathematical transformation (from linear to polar) and combine two facts:
There is no need to perform expansive mathematical computation
There is no need to render two points that are too close from each other
I have no ready-made algorithm for you, but you could use a pre-computed sin or cos table, and match the data range to the display size in order to work with integers.
For instance imagine we have some data ranging from 0 to 1E6 and we need to display the sin value of each point in a 100 pix height rectangle. We can use a pre-computed sin table and work with integers. This way displaying the sin value of a point would be much quicker. This concept can be refined to get a nicer result.
Also, there are some ways to retain only significant points of a curve so that the displayed curve actually looks like the original (see the Ramer–Douglas–Peucker algorithm on wikipedia). But I found it to be inefficient for quickly displaying ever-changing data.
Using multicore rendering
You could compute different areas of the curve using multiple cores (can be tricky)
Or you could use pre-computing using several cores, and one core to do finish the job.

tetrahedrizing a mesh

I am looking for an algorithm that receives a 3d surface mesh (i.e comprised of 3d triangles that are a discretization of some manifold) and generates tetrahedra inside the mesh's volume.
i.e, I want the 3d equivalent to this 2d problem: given a closed curve, triangulate it's interior.
I am sorry if this is unclear, it's the best way I could think of explaining it.
For the 2d case there's Triangle. For a 3d case I could find none.
pygalmesh (a project of mine based on CGAL) can do just that.
pygalmesh-volume-from-surface elephant.vtu out.vtk --cell-size 1.0 --odt
https://github.com/nschloe/pygalmesh/#volume-meshes-from-surface-meshes
I found GRUMMP which seems to answer all the needs mentioned in the question, and more...
I haven't had any experience using GRUMMP, but as far as a 3D version of triangle there is tetgen. If you know the triangle switches it is built to resemble it. It also has fairly decent documentation and a python wrapper for it and triangle.
http://wias-berlin.de/software/tetgen/
http://mathema.tician.de/software/meshpy/