calculate parallel trajectory on a GIS map - latitude-longitude

I have some way points with longitudes and latitudes which builds a trajectory and I want to calculate a parallel trajectory at a specific distance!
I would appreciate any help!
Best regards,
Tara

You can use the Dijkstra's algorithm.
More explanation here:
http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

If you want that both the trajectory and the parallel trajectory will be composed of geodesics - you can't.
The path between two points is usually defined by a geodesic. Geodesic is a generalization of the notion of a straight line, or a straight line segment to curved spaces. Geodesic is the shortest route between two points on the Earth's surface, namely, a segment of a great circle.
Great circles divide the sphere in two equal hemispheres and all great circles intersect each other. Therefore, there are no parallel geodesics.

Related

Compute road plane normal with an embedded camera

I am developing some computer vision algorithms for vehicle applications.
I am in front of a problem and some help would be appreciated.
Let say we have a calibrated camera attached to a vehicle which captures a frame of the road forward the vehicle:
Initial frame
We apply a first filter to keep only the road markers and return a binary image:
Filtered image
Once the road lane are separated, we can approximate the lanes with linear expressions and detect the vanishing point:
Objective
But what I am looking for to recover is the equation of the normal n into the image without any prior knowledge of the rotation matrix and the translation vector. Nevertheless, I assume L1, L2 and L3 lie on the same plane.
In the 3D space the problem is quite simple. In the 2D image plane, since the camera projective transformation does not keep the angle properties more complex. I am not able to find a way to figure out the equation of the normal.
Do you have any idea about how I could compute the normal?
Thanks,
Pm
No can do, you need a minimum of two independent vanishing points (i.e. vanishing points representing the images of the points at infinity of two different pencils of parallel lines).
If you have them, the answer is trivial: express the image positions of said vanishing points in homogeneous coordinates. Then their cross product is equal (up to scale) to the normal vector of the 3D plane said pencils define, decomposed in camera coordinates.
Your information is insufficient as the others have stated. If your data is coming from a video a common way to get a road ground plane is to take two or more images, compute the associated homography then decompose the homography matrix into the surface normal and relative camera motion. You can do the decomposition with OpenCV's decomposeHomographyMatmethod. You can compute the homography by associating four or more point correspondences using OpenCV's findHomography method. If it is hard to determine these correspondences it is also possible to do it with a combination of point and line correspondences paper, however this is not implemented in OpenCV.
You do not have sufficient information in the example you provide.
If you are wondering "which way is up", one thing you might be able to do is to detect the line on the horizon. If K is the calibration matrix then KTl will give you the plane normal in 3D relative to your camera. (The general equation for backprojection of a line l in the image to a plane E through the center of projection is E=PTl with a 3x4 projection matrix P)
A better alternative might be to establish a homography to rectify the ground-plane. To do so, however, you need at least four non-collinear points with known coordinates - or four lines, no three of which may be parallel.

Mesh to mesh. Mesh fitting (averaging). Mesh comparison.

I have 3 sets of point cloud that represent one surface. I want to use these point clouds to construct triangular mesh, then use the mesh to represent the surface. Each set of point cloud is collected in different ways so their representation to this surface are different. For example, some sets can represent the surface with smaller "error". My questions are:
(1) What's the best way to evaluate such mesh-to-surface "error"?
(2) Is there a mature/reliable way to convert point cloud to triangular mesh? I found some software doing this but most requests extensive manual adjustment.
(3) After the conversion I get three meshes. I want to use a fourth mesh, namely Mesh4, to "fit" the three meshes, and get an "average" mesh of the three. Then I can use this Mesh4 as a representation of the underlying surface. How can I do/call this "mesh to mesh" fitting? Is it a mature technique?
Thank you very much for your time!
Please find below my answers for point 1 and 2:
as a metric for mesh-to-surface error you can use Hausdorff distance. For example, you could use Libigl to compare two meshes.
To obtain a mesh from a point cloud, have a look at PCL

Need a suggestion on curve processing (curve-fitting, interpolation)

I have a set of points which form some curve, see picture. This curve consists of straight and curved sections and I do not know exactly where they start or end. In the presented picture I know at least five pieces: two straight sections, one section with a constant radius, two other types of curves. I want to be able to recognise those sections, to separate them from each other and to work with them as with separate curves.
Update.
In my opinion splines would not work in the way I want, and not surely Besier. I was thinking about Non-linear Least Squares but was not sure if it suits this case. If I am able to separate the parts, then I can use Linear Least Squares for straights and some non-linear for other parts. Otherwise, I need some universal method which will work for all types of curves: 1, 2 and 3 power.
Please share your thoughts.
Thank you.
For a bent tube I would suggest multidimensional spline fitting. Your tube does not look like a composition of of straight and curved sections, but curves smoothly all the way.
http://en.wikipedia.org/wiki/Spline_interpolation
This is the starting point if you want to read further.
Taking a guess I suppose you are not experienced with splines, so if you could put out the dataset in table form me or some other reader could interpolate the given data with a 3D spline curve.

How to generate isolines (contour lines) at specific values from irregular data?

I have an array of sample points with their (X, Y, Z) coordinates. I use Delaunay Triangulation to generate an irregular network from them and then I use linear interpolation to plot contour lines at fixed values (e.g. 90, 95, 100, 105). The problem is that I need smooth contour lines to be generated with another algorithm. I've searched for some time now and found out that I need to use something like Kriging but I'm not that good at math to implement the algorithm from pure mathematical relations. Also I can't seem to find an implementation or explanation of the algorithm anywhere. Can anyone help me find one? Also, am I right with the chosen algorithm? Is there another one that can be easier to implement? Note that I don't care about precision.
https://dl.dropbox.com/u/15926260/ex.png
P.S. I've done a plot in Surfer showing the results that I'm looking for. On the right side is what I have done using triangulation and linear interpolation and on the left side is what I need to plot using a different algorithm (Kriging was used in Surfer).
Sorry for the spelling mistakes but I'm not a native language speaker.
Thank you!
You can try a regular (weighted) delaunay triangulation. In weighted delaunay triangulation triangle areas are more equal. IMO the kriging algorithm seems also to produce more equally contours. Weighted delaunay triangulation is also used to make smoother meshes.

Why compute geodistance with lat/lon instead of caching cartesean points?

When researching on how to do the classic "get POI in range" problem I've found that the most used algorithms are Haversine and if you need real accuracy then Vincenty's formula. I went the first one because high accuracy wasn't an issue. However, it got me thinking on something that hits me as odd, why is that I found no references to caching the Cartesean coordinates on the database instead of using the haversine formula with the lat/lon?
The issue here is, of course, performance. The haversine formula requires a ton of cos/sin function calls, but wouldn't it be simpler to store the projected X, Y and Z of a lat/lon point on the database and apply the dot product directly? That would require a single arccos call unless I'm mistaken.
Because any given Cartesian projection will only give the correct answer for certain points - a projection which gives the right distance between two points on one particular circle around a sphere will distort distances along another particular circle.
Formulas such as Haversine are independent of the relative locations of the various points on the sphere; they return the correct distance regardless.
No, you are not mistaken. Two things, though. First, obviously, your performance benefits will depend on the nature of your application. If you need to use the same points many times in your calculations, you will improve performance by doing what you suggest.
Second, the formula you use is not the issue here. If you precompute and store sin and cos of lat/lon and use haversine, you will get the exact same performance improvements.
Calculating the distance between two X,Y,Z coordinates will give you the straight line distance (as the arrow flies). The Haversine formula gives the shortest path on the surface of the curved earth (spherical distance). Most geographic software applications need to compute the distance across the earth's surface, thus the Haversine or similar spherical trigonometry algorithms are used.