0

I want to know how to extract the adjacency matrix from an image in matlab.

Let us take this image http://imageshack.us/photo/my-images/593/69363210.png as an example.

The code that I want to write in matlab should take this image as input and construct a graph with 6 vertices(two vertical lines and one horizontal line).It should also provide me the adjacency matrix of the graph.Only image can be given as input.

The logic should also work on any image that is made up of horizontal and vertical lines(need not be alphabets like 'L' or 'T',but some randomly generated images with only horizontal and vertical connections).Is it possible to generalize?

Richardson
  • 3
  • 1
  • 3

1 Answers1

1

Images and adjacency matrices are not interchangeable. You will need to specify your problem with more detail to get some help.

You can also look here

EDIT: Given the comment below, to convert that image into a graph you will need to find endpoints and bifurcations first, and then find their connectivity.

I would suggest first skeletonising the image using bwmorph and then find the bifurcations and endpoints in the skeleton (take a look here). Once you have that you will have to find the connectivity (adjacency matrix) by tracking the skeleton between bifurcations and end points.

Community
  • 1
  • 1
fuyas
  • 129
  • 1
  • 9