Map (image) to Graph

Converting an input map (image) into a Graph
503 Downloads
Updated 31 Aug 2017

View License

% THIS CODE IS DEVELOPED BY REZA JAVANMARD ALITAPPEH BY THE HELP OF KOSSAR
% JEDDISARAVI AND ADRIANO, WE ALSO USED A GRAPH LIBRARY FROM Carnegie Mellon University
%
% E-MAIL: RezaJavanmard64@gmail.com
% 31/08/2018
%
% THE CODE GETS AN INPUT IMAGE AND CONVERTS INTO A GRAPH; THE NODES IN THIS
% GRAPH ARE MEETPOINTS AND ENDPOINT IN THE GVD
% AND THE OUTPUT IS TWO GRAPHS IN FORM OF: PIXEL PATH AND QUADRATIC CURVES
%
%------------------------------------------------------------------------------------
%
% PARAMETERS:
%
% INPUTS:---------------------------------------
% ** INPUT IMAGE: i.e. InputImage='Map8_2.jpg';
% THE INPUT IMAGE CAN BE .JPG OR .PNG OR .BMP ETC
%
% ** RADIUS: IT IS RADIUS OF THE ROBOT, THIS PARAMETER IS USED TO COMPUTE CONFIGURATION
% FREE SPACE, IN CASE IF THE GRAPH IS DISCONNECTED IT MEANS ROBOT'S RADIUS
% IS BIG AND IT CAN NOT PASS THROUGH A NARROW CORRIDOR OR DOOR IN THE
% MAP
%
% ** resolution: THIS PARAMETER IS USED TO CONVERT IMAGE SPACE INTO REAL
% SPAEC I.E. METER
%
% OUTPUTS:--------------------------------------
% ** GRAPH: CONTAINS NODES AND PATH BETWEEN NODES(IN PIXEL)
% path : n*2 matrix for x and y
% from : the corresponding start node
% to : the corresponding end node
%
% ** QUADGRAPH: CONTAINS THE GRAPH IN THE FORM OF QUADRATIC FUNCTION FOR
% EACH EDGE
% number_nodes: number of nodes in the constructed graph
% node_list: location of the nodes
% edge_matrix: Adjacency matrix of the graph
% path_matrix: The Path between all the nodes
% w_s : size of the work space
% Pol_coefs: coefficent of the quadratic form of the edges
% --------------------------------------------
% NOTES:
%
% * for the sake of clarity the function SHOWGRAPH shows how you can
% access tot the structures (GRAPH, QUADGRAPH)
% * If you work in other languages i.e Python, you can easily save the
% output in .Mat file and load it in Python.
%------------------------------------------------------------------------------------

Cite As

Reza Javanmard (2025). Map (image) to Graph (https://se.mathworks.com/matlabcentral/fileexchange/64296-map-image-to-graph), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Convert Image Type in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0

A photo