Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to get branch point/graph from skeleton without using MATLAB functions

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: mat001

Date: 3 Jun, 2011 10:05:05

Message: 1 of 9

I have skeleton which is a binary image. Now i want a graph out of that skeleton.
So I want to know the theory behind that.
How to calculate the graph or branch point without MATLAB function.

Regards,

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: ImageAnalyst

Date: 3 Jun, 2011 11:10:24

Message: 2 of 9

On Jun 3, 6:05 am, "mat001 " <priya.biom...@yahoo.co.in> wrote:
> I have skeleton which is a binary image. Now i want a graph out of that skeleton.
> So I want to know the theory behind that.
> How to calculate the graph or branch point without MATLAB function.
>
> Regards,

------------------------------------------------
What is the reason you don't want to use bwmorph() to locate the
intersection (node) points?

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: mat001

Date: 3 Jun, 2011 12:25:04

Message: 3 of 9

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <57075904-db74-4192-b6de-1bc95ce6cfe4@j23g2000yqc.googlegroups.com>...
> On Jun 3, 6:05 am, "mat001 " <priya.biom...@yahoo.co.in> wrote:
> > I have skeleton which is a binary image. Now i want a graph out of that skeleton.
> > So I want to know the theory behind that.
> > How to calculate the graph or branch point without MATLAB function.
> >
> > Regards,
>
> ------------------------------------------------
> What is the reason you don't want to use bwmorph() to locate the
> intersection (node) points?


Just to have more clear view, so that later on I can Implement in c++ for large input data .

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: ImageAnalyst

Date: 3 Jun, 2011 12:54:24

Message: 4 of 9

To find intersection points is fairly obvious. Just scan with a
window looking for a pattern in the 9 pixels that indicates a
crossing. For example, the middle pixel is 1 and at least three of
the 8 neighbor pixels are also 1 provided that they have a zero in
between. E.g. this is a crossing

0 0 1
0 1 0
1 0 1

this is not
0 0 1
0 1 0
0 1 1

You can get all 256 possible patterns of the 8 neighbors and decide
which ones are crossings and which ones are not and make a 256 element
lookup table. At each pixel location, convert the neighbors into a
number between 0 and 256 based on their binary pattern, then look up
in the lookup table whether to classify it as a crossing or not.

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: mat001

Date: 6 Jun, 2011 11:08:02

Message: 5 of 9

Thank you.

But i found one problem after i have checked branchpoint and endpoint

input image


imgd = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0,
     0, 0, 1, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1,
    1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {0,
     0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 1, 0,
    0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0,
     0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0,
    1, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0,
    0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0,
     0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};


output image

{{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, {0., 0.,
  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, {0., 0., 1., 0.,
  0., 0., 0., 0., 0., 0., 0., 1., 0., 0.}, {0., 0., 0., 0., 0., 0.,
  0., 0., 0., 0., 0., 0., 0., 0.}, {0., 0., 0., 0., 1., 1., 0., 0.,
  1., 1., 0., 0., 0., 0.}, {0., 0., 0., 0., 1., 0., 0., 0., 0., 1.,
  0., 0., 0., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
  0., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
  0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, {0.,
  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, {0., 0., 0.,
  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, {0., 0., 0., 0., 1.,
  0., 0., 0., 0., 1., 0., 0., 0., 0.}, {0., 0., 0., 0., 1., 1., 0.,
  0., 1., 1., 0., 0., 0., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0.,
  0., 0., 0., 0., 0.}, {0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.,
  1., 0., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
  0.}, {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}}

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <0348ad90-e02c-4a79-995f-396a2c7cdafe@s9g2000yqm.googlegroups.com>...
> To find intersection points is fairly obvious. Just scan with a
> window looking for a pattern in the 9 pixels that indicates a
> crossing. For example, the middle pixel is 1 and at least three of
> the 8 neighbor pixels are also 1 provided that they have a zero in
> between. E.g. this is a crossing
>
> 0 0 1
> 0 1 0
> 1 0 1
>
> this is not
> 0 0 1
> 0 1 0
> 0 1 1
>
> You can get all 256 possible patterns of the 8 neighbors and decide
> which ones are crossings and which ones are not and make a 256 element
> lookup table. At each pixel location, convert the neighbors into a
> number between 0 and 256 based on their binary pattern, then look up
> in the lookup table whether to classify it as a crossing or not.

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: ImageAnalyst

Date: 6 Jun, 2011 12:16:34

Message: 6 of 9

And what is that problem?
And why are your "images" cell arrays of cells, instead of regular
numerical arrays? Can you even display those with imshow()?

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: mat001

Date: 6 Jun, 2011 13:26:04

Message: 7 of 9

problem has been solved.

Thanks once again.

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: mat001

Date: 21 Jun, 2011 11:14:06

Message: 8 of 9


I again come to same thing for 3d.

 how to define branchpoint 3d?

Subject: how to get branch point/graph from skeleton without using MATLAB functions

From: Eric Zhang

Date: 17 Jul, 2012 20:40:27

Message: 9 of 9

Hi,
I have a similar problem here.
I have implemented the intersection finding method according to your reply here("Just scan with a window looking for a pattern in the 9 pixels that indicates a crossing" and "make a 256 element lookup table"). But the width of the lines in my skeletionized image is larger than 1 pixel (about 5 pixels). It is easier for human visual inspection of the skeleton image but difficult to get the number of intersections using this method. I screenshot a small part of my skeletionized image and make it thinner using "bwmorph" function to 1 pixel wide and all lines are connected. This method works well. But when I tried to make the whole image thinner, part of the curve gets so thin that some lines are parted where they are supposed to be connected.
I am thinking about implementing a similar method using maybe 25(5X5) or 36(6X6) pixels to indicate a intersection. But it is very complex and I am not sure what is the condition to make it a intersection.
BTW, when trying to compare my image to the lookup table, I found that when I use it like this "blockproc(img_matrix,[3 3],fun)" , it cannot go through all the 3X3 blocks in img_matrix. I mean, if the img_matrix is like this,
img_matrix=
[
0 0 0 0 0 0
0 1 0 0 2 0
0 0 0 0 0 0
0 0 0 0 0 0
0 3 0 0 4 0
0 0 0 0 0 0
]
it can only apply function "fun" to blocks like
[0 0 0
 0 1 0
 0 0 0]
and
[0 0 0
 0 2 0
 0 0 0], etc.
If the block (row1 to row3, and column2 to column4 is what I am interested in,
[0 0 0
 1 0 0
 0 0 0],
this function will not apply "fun" to this block.
Do you have any suggestions about the problems?

Best regards,
Eric

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <0348ad90-e02c-4a79-995f-396a2c7cdafe@s9g2000yqm.googlegroups.com>...
> To find intersection points is fairly obvious. Just scan with a
> window looking for a pattern in the 9 pixels that indicates a
> crossing. For example, the middle pixel is 1 and at least three of
> the 8 neighbor pixels are also 1 provided that they have a zero in
> between. E.g. this is a crossing
>
> 0 0 1
> 0 1 0
> 1 0 1
>
> this is not
> 0 0 1
> 0 1 0
> 0 1 1
>
> You can get all 256 possible patterns of the 8 neighbors and decide
> which ones are crossings and which ones are not and make a 256 element
> lookup table. At each pixel location, convert the neighbors into a
> number between 0 and 256 based on their binary pattern, then look up
> in the lookup table whether to classify it as a crossing or not.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us