Ellipse distance metric for DBSCAN clustering - matlab

I am using the DBSCAN algorithm to determine clusters in a data set obtained by an automotive radar. The paper "Grid-Based DBSCAN for Clustering Extended Objects in Radar Data" from Dominik Kellner, Jens Klappstein and Klaus Dietmayer (link below) proposes a Grid-Based DBSCAN method. Therefore, the search radius epsilon variates in azimuth direction depending on the range. The radius in range direction stays constant. The normal DBSCAN is using Euclidean distance metric to determine the epsilon-neighbourhood where the search radius is the same in both directions. I cannot find out how to have an ellipse-search instead of a circular.
Do you know a distance metric that is working elliptical? Or, can you provide me with a short code that solves my problem? I am using MATLAB but the code can be in your prefered language.
Let's give an example so we talk about the same:
Consider a cartesian coordinate system with range in meters plotted against azimuth angle in degrees. The search distance in the range direction should be three meters (or possible observation points) in both directions from a centre point. In azimuth direction, the search radius should be five points in both directions.
If you cannot think of an elliptical solution, maybe a linear works as well.
Thank you for your help.
https://www.researchgate.net/profile/Dominik_Kellner2/publication/261127945_Grid-based_DBSCAN_for_clustering_extended_objects_in_radar_data/links/57742a7708aead7ba06e60b5.pdf

Related

How to find median trajectory of a spiral movement?

Lets some objects make complex spiral moving in 3D and we have get their trajectories projected on a plane.
How to find a median trajectory of such movements and estimate the amplitudes of spirals?
I assume that this requires averaging the coordinates of the trajectories, then somehow finding the distances from the extreme points of the trajectories to the midline. But I don't know a concrete algorithm for this. Can someone suggest this algorithm?
By median trajectory I mean a line that ges between path waves, something like linew on a picture below.
This is a case for a Kalman filter, but this method is a little complicated.
A simpler one is a moving average, with a number of samples that covers as closes as possible to a full period (which you can estimate visually).
Regarding the distances, you can compute the shortest Euclidean distance of every point to the midline (using a line-to-segment function). This will yield an alternating plot, which you can smoothen with a moving maximum (rather than average) over a period.

Clustering algorithms and Hausdorff distance

I cant figure out this situation.
How the r tree can help to speed up finding close polygons using Hausdorff distance measure.
Tell me please how I can find close polygons for P4?
Compute the minimum distance from P4 to other rectangles.
Prove that this distance is a lower bound for Hausdorff.
Which rectangles can thus contain an answer?

Project GPS coordinates to Euclidean space

There are a lot of similar questions but I can't get a clear answer out of them. So, I want to represent latitude and longitude in a 2D space such that I can calculate the distances if necessary.
There is the equirectangular approach which can calculate the distances but this is not exactly what I want.
There is the UTM but it seems there are many zones and letters. So the distance should take into consideration the changing of zone which is not trivial.
I want to have a representation such that i can deal with x,y as numbers in Euclidean space and perform the standard distance formula on them without multiplying with the diameter of Earth every time I need to calculate the distance between two points.
Is there anything in Matlab that can change lat/long to x,y in Euclidean space?
I am not a matlab speciallist but the answer is not limited to matlab. Generally in GIS when you want to perform calculations in Euclidean space you have to apply 'projection' to the data. There are various types of projections, one of the most popular being Transverse Mercator
The common feature of such projections is the fact you can't precisely represent whole world with it. I mean the projection is based on chosen meridian and is precise enough up to some distance from it (e.g. Gauss Krueger projection is quite accurate around +-500km from the meridian.
You will always have to choose some kind of 'zone' or 'meridian', regardless of what projection you choose, because it is impossible to transform a sphere into plane without any deformations (be it distance, angle or area).
So if you are working on a set of data located around some geographical area you can simply transform (project) the data and treat it as normal Enclidean 2d space.
But if you think of processing data located around the whole world you will have to properly cluster and project it using proper zone.

Calculate angle between 2 geographic coordinates in MATLAB

I'm trying to calculate the angle between 2 geographic (Latitude,Longitude) points in MATLAB. The points are:
(-65.226,125.5) and (-65.236,125.433).
I used the MATLAB function, azimuth, as:
azimuth(-65.226,125.5,-65.236,125.433)
I convert the result to radians, and plotting this using quiver, I get the following plot:
I want the red vector to point from the top right dot to the bottom left dot.
The points are at fairly high latitude (~65S), and the separation of the points is low (about 0.1 degrees). Thus, I can't really understand how the curvature of the earth could affect the azimuth prediction that much..
Does anyone have any experience with azimuth in MATLAB, or have a better suggestion to calculating the angle between the coordinate pairs?
Thanks!
Here you can detailed information and formulae on how to find angle between two latitude-longitude points.

How to determine if a latitude & longitude is within an ellipse

I have data describing a rotated ellipse (the center of the ellipse in latitude longitude coordinates, the lengths of the major and minor axes in kilometers, and the angle that the ellipse is oriented). I do not know the location of the foci, but assume there is a way to figure them out somehow. I would like to determine if a specific latitude longitude point is within this ellipse. I have found a good way to determine if a point is within an ellipse on a Cartesian grid, but don't know how to deal with latitude longitude points.
Any help would be appreciated.
-Cody O.
The standard way of doing this on a Cartesian plane would be with a ray-casting algorithm. Since you're on a sphere, you will need to use great circle distances to accurately represent the ellipse.
EDIT: The standard ray-casting algorithm will work on your ellipse, but its accuracy depends on a) how small your ellipse is, and b) how close to the equator it is. Keep in mind, you'd have to be aware of special cases like the date line, where it goes from 179 -> 180/-180 -> -179.
Since you already have a way to solve the problem on a cartesian grid, I would just convert your points to UTM coordinates. The points and lengths will all be in meters then and the check should be easy. Lots of matlab code is available to do this conversion from LL to UTM. Like this.
You don't mention how long the axes of the ellipse are in the description. If they are very long (say hundreds of km), this approach may not work for you and you will have to resort to thinking about great circles and so on. You will have to make sure to specify the UTM zone to which you are converting. You want all your points to end up in the same UTM zone or you won't be able to relate the points.
After some more research into my problem and posting in another forum I was able to figure out a solution. My ellipse is relatively small so I assumed it was a true (flat) ellipse. I was able to locate the lat lon of the foci of the ellipse then if the sum of the distances from the point of interest to each focus is less than 2a (the major axis radius), then it is within the ellipse. Thanks for the suggestions though.
-Cody