I have multiple gpx files from walking routes which I combined to one big gpx file so it displays a collection of all the routes of a certain area. I want to use the file in MATLAB and perform Dijkstra's shortest path algorithm on it. Can anyone recommend a way to do this?
Should I convert the gpx data in order to make it possible, or are there ways to make these calculations on the data itself?
Recent MATLAB version has functions to read GPX files
https://www.mathworks.com/help/map/ref/gpxread.html
and the File Exchange has few contributions for Dijkstra's Shortest Path Algorithm
Joseph Kirk (2021). Dijkstra's Shortest Path Algorithm https://www.mathworks.com/matlabcentral/fileexchange/12850-dijkstra-s-shortest-path-algorithm and Another here https://www.mathworks.com/matlabcentral/fileexchange/36140-dijkstra-algorithm
Related
I am working on a small project in Matlab just because of my interest in image processing and I have not studied a degree or a course related to image processing.
I want to understand a small concept about feature extraction and feature vectors. I have read some articles about that and in general I can understand that, but my question is:
For example, I want to extract some information from different objects of a binary image, the information is about length, width and distance between the objects. In one application I want to extract the features on which I want to apply some algorithms to compute width of all the objects and ignore the length and distance. Can we name this as feature extraction regarding the width? And storing them in different vectors as Feature Vectors?
It makes me think that, I might be complicating the simple things. Should I use some other terminologies for this instead of feature extraction and feature vectors?
Please suggest me if I am going in the right direction or not?
Thank you!
Feature extraction is the process of computing numerical values on regions/objects/shapes/blobs detected in an image. [Sometimes the detection itself can be called extraction and the features need not be numbers.]
The feature values can indeed be stored in vectors, usually they fill a table. Sometimes they are structured in a more complicated way (such as a graph f.i.). Most of the time they are used for classification/recognition purposes or they can just be the output of the process on hand.
I'm now working on my undergraduate thesis about shortest path in Netlogo using Dijkstra algorithm
How nw extensions can be implemented in Dijkstra Algorithm coding?
Thank you. .
Not sure I understand your question, but the NW extension uses Dijsktra's algorithm to do its shortest path calculations. The algorithm has been modified so as to save as much information as possible while running. You can read more about that here: https://github.com/NetLogo/NW-Extension#performance
If you're asking about using NW in order to write your own implementation of Dijkstra's algorithm, NW doesn't really help you. It already has Dijkstra's built-in! You can implement Dijkstra's in NetLogo since all you really need is a way to get the links connected to a node and a data structure to store them in that makes it easy to grab the shortest one, called a heap. The connected link calculation is easy (just my-links or link-neighbors; other-end is useful too). The heap is harder. NetLogo doesn't have a built-in heap, nor a good way of creating your own data structures, but you can build heaps just out of lists. You can also just use a list that remains sorted the whole time, but that will hurt the computational complexity.
My research is about find a shortest path between an origin and a destination predefined. Both (origin and destination) were located using the GIS extension, because they were obtained by a shape file. I used the command ask patches gis:intersecting shapefile to create a person in an origin and a school in the destination.
I have 10 origins and for each I have a specify destination. I noticed that when I use the Dijsktra's algorithm to find the shortest path, for certain origin the destination isn't the respective point but the closest destination.
So, my doubt is: Is the Dijsktra's the best algorithm for my problem or I need to use the A* algorithm?
If the Dijsktra's algorithm is the best, how do I inform the pairs origin and destination in the code?
If the A* algorithm is the best, how do I construct the code in the version 5.0 of Netlogo?
Not sure about netlogo, but since your question doesn't quote it in the tags I'll assume an algorithm oriented answer is ok.
Dijkstra and A* are similar; both look and find the shortest path from one point to another. A* is more effective when you've got a known-in-advance destination as it optimally looks for the shortest possible path through the heuristics, while dijkstra exapnds more nodes in your graph by searching all directions.
If you find that Dijkstra returns a path to a different destination than the one you expect, you should consider verifying the destination detection: you should conclude the dijkstra searcg when you find THAT destination, not ANY destination.
A* doesn't suffer so much of the same since the heuristics will point them towards the correct destination, but can in special cases find the same problem (i.e. shortest path to correct destination passes through a different destination).
TO be more precise, I'd need some code - pseudocode is ok - of your conclusion, or details on the graph.
I have a 2D graph that I have created of frequency vs. amplitude as a way to characterize a signal. I am trying to figure out how to write script that takes the WAV I have already imported into MATLAB, and figure out the peaks, the troughs, and the distance between each one. Can someone please help me with some general guidelines, not a complete code, for a script that will help me do this?
There are several submissions on the file exchange for this. For instance this one, seems applicable (I haven't tested it myself, but it looks good).
Try to search a bit on the file exchange and you will likely find something you can use.
You can also have a look at this question, and this one.
I have started using ELKI for data analysis, but one seemingly simple thing I cannot seem to do is output the calculated convex hull of clusters to a file after running DBSCAN. I am able to visualize the convex hulls via the visualization gui, but I cannot generate the KML file. I am also able to write my clustering results to a folder (using the ResultWriter resulthandler), but no file is generated when I set the KMLOutputHandler. I receive no error message in the log window (even with verbose parameter set to true).
Is there a trick to generating a KML file in ELKI? Could anyone walk through the steps of doing this?
Any help would be appreciated.
(as an aside, is it possible to generate alpha shapes for DBSCAN results with ELKI? If so, which parameter must be adjusted?)
So that is actually a lot of questions in one...
Cunvex hulls: they are used in ELKI for visualization, but not considered part of the output result, so they are not saved to file. A trick you could employ is to save the visualization as SVG and extract them from this file, but they will then be in a different coordinate system.
One of the reasons for this is that the convex hulls are only implemented for 2D Euclidean space - I figure you want to use it for spatial data, where it may actually happen to not return the correct convex hull then due to the curvature of the earth surface. Furthermore, many data sets will be of higher dimensionality.
However, you can of course look at the source code and invoke the convex hull algorithm, then write the result to your favorite output format. In general, just as you will need to spend time on preprocessing, you will also need to customize the output.
Which brings me to the second question. The KMLResultHandler is closely tied to the publication of ELKI 0.4.0: Spatial Outlier Detection: Data, Algorithms, Visualizations.
Which pretty much summarizes what this class does: visualize spatial outlier detection. It currently does not (yet) include code to visualize clusters of spatial data, for example. In order to get an output from the class, you need to ensure a number of restrictions, unfortunately. Essentially, if it finds a Polygon relation and a OutlierResult that it can map to each other, it will output this to KML.
It is not yet a class that could write arbitrary results to KML. It probably needs a lot more of documentation, too. Contributions of a more general output tool would be appreciated; but a customizeable, automatic, general output to KML is really hard to do. In particular, you may also end up having to include projection capabilities then, if someone is not processing Latitude-Longitude data, but e.g. UTM projected data.
As such, I recommend looking at the source code of the class and customizing it to your needs. In my opinion, visualization to KML will always require a lot of customization.
To generate alpha shapes (only the hull, not the extended alpha shape - the optimal visualization of DBSCAN would likely consist of the alpha shape of the core points only, extended by a radius of epsilon, which should then include the border points. This is on the wish list, but not implemented), you just need to set the -hull.alpha parameter to the desired alpha value. Note that this happens in the visualization projection, not at the raw data. If the axes are scaled differently, alpha shapes will look differently. Again, you may be interested in using the class AlphaShape on the raw data vectors, instead of exporting the projected visualization. Then you can easily write the resulting Polygons to your custom visualization.
If you implement such a KML visualization using alpha shapes (or convex hulls) for clusters, I would appreciate if you could contribute this to ELKI to make it available for others as well. Thank you.