Matrix of points to suitable Path
Mostrar comentarios más antiguos
I have a 128 by 128 matrix of 0s and 1s, like so

From this I need to generate a single path that starts somewhere at the bottom of the matrix to the highest point of the matrix. So for example the output would be:

I have implementing like a A* path cost flood fill and try to get lowest cost with no luck. Would there be any other methods of doing this? Any recommendations or help would be greatly appreciated !
(The point of this is I need to get a robot to follow the path after converting the pixel coordinates to world coordinates)
2 comentarios
Jan
el 19 de Oct. de 2016
Please explain "no luck" with and details. Perhaps you had a simply typo in your code?
trent cooper
el 19 de Oct. de 2016
Editada: trent cooper
el 20 de Oct. de 2016
Respuestas (2)
Image Analyst
el 20 de Oct. de 2016
0 votos
A* should work. Doesn't look like your code used it though. There are other ways. Like dynamic programming, or the function shortestpath(), etc. Is there a continous path in your dots and just got lost due to subsampling for display? If so, you can use bwdistgeodesic().
2 comentarios
trent cooper
el 20 de Oct. de 2016
Image Analyst
el 20 de Oct. de 2016
I don't think A* is the way to go, given the additional information. You want standard tracking. The Computer Vision system Toolbox has lots of demos on tracking things like vehicles and people: http://www.mathworks.com/products/computer-vision/code-examples.html That is what you'd want to do instead.
Walter Roberson
el 20 de Oct. de 2016
0 votos
bwmorph and 'thicken' just enough to join segments together. Then skeletonize.
Or perhaps you could use alpha shapes to enclose the branches, then fill, then skeletonize
Categorías
Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
