neighbors contour length

71 views
Skip to first unread message

Jaime Lopez Carvajal

unread,
Sep 14, 2016, 5:29:30 PM9/14/16
to scikit-image
Hi,

I would like to know if someone could help or suggest any idea how to do this:

First, I am trying to know how many neighbors (objects) one particular object have using its contour.
Second, I need to extract the length of each shared contour with every neighbor,
Third, calculate their respective percentage.

The last step is the easiest, but I dont know how to get the first and second steps. 

Example using attached image:
 
Object of interest: red object 
Neighbors: three neighbors with three shared contours (yellow, green and blue).
Total length contour = lengh(yellow) + lengh(yellow) + lengh(yellow)

Any suggestion how can I get this?  

Thanks in advance, Jaime
object_neighbors.jpg

Juan Nunez-Iglesias

unread,
Oct 1, 2016, 10:48:07 PM10/1/16
to scikit...@googlegroups.com
Hi Jaime,

Sorry, it seems your message got lost in our flooded inboxes...

What does your source image look like? If the objects are segmented into different labels, that is, you have an image where all the pixels of object 1 have value 1, all those of object 2 have value 2, etc., then you can build a *region adjacency graph*, or RAG, with the right values to get what you need. This function in scikit-image master gets you the contour lengths between different objects, from which it should be easy to get the information you want:


By looking at the source code you might get even simpler code for your problem, because you just need the `count_matrix` sparse matrix. It should be super-fast to generate and compute the values you need.

Juan.

--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/191cefe6-7274-45f7-b266-41bb92d64428%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jaime Lopez Carvajal

unread,
Oct 3, 2016, 12:11:47 PM10/3/16
to scikit-image
Hi Juan,

Thank you for suggestion, I am going to take a look, but maybe I need a different approach because the contour (list) of every object in image, which were extracted after an image segmentation process.

So, I would like to know if there is a way to compare contours (comparing lists) between objects to find shared coordinates, but I think this is not possible because I have the inner contours of every object, so I will not find any coordinates coincidence between pair of objects.

I hope this make my issue clearer. 

Any other idea?

Thanks, Jaime



On Saturday, October 1, 2016 at 9:48:07 PM UTC-5, Juan Nunez-Iglesias wrote:
Hi Jaime,

Sorry, it seems your message got lost in our flooded inboxes...

What does your source image look like? If the objects are segmented into different labels, that is, you have an image where all the pixels of object 1 have value 1, all those of object 2 have value 2, etc., then you can build a *region adjacency graph*, or RAG, with the right values to get what you need. This function in scikit-image master gets you the contour lengths between different objects, from which it should be easy to get the information you want:


By looking at the source code you might get even simpler code for your problem, because you just need the `count_matrix` sparse matrix. It should be super-fast to generate and compute the values you need.

Juan.
On Thu, Sep 15, 2016 at 7:29 AM, Jaime Lopez Carvajal <jalo...@gmail.com> wrote:
Hi,

I would like to know if someone could help or suggest any idea how to do this:

First, I am trying to know how many neighbors (objects) one particular object have using its contour.
Second, I need to extract the length of each shared contour with every neighbor,
Third, calculate their respective percentage.

The last step is the easiest, but I dont know how to get the first and second steps. 

Example using attached image:
 
Object of interest: red object 
Neighbors: three neighbors with three shared contours (yellow, green and blue).
Total length contour = lengh(yellow) + lengh(yellow) + lengh(yellow)

Any suggestion how can I get this?  

Thanks in advance, Jaime

--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.

Juan Nunez-Iglesias

unread,
Oct 3, 2016, 6:07:45 PM10/3/16
to scikit...@googlegroups.com
If you only have inner contours I think the fastest thing to do is to get back to a labeled dataset, which you could probably do e.g. with watershed. Seems a bit overkill though... You definitely can't get labels upstream in the process?

Stefan van der Walt

unread,
Oct 4, 2016, 5:51:04 PM10/4/16
to scikit...@googlegroups.com
Please continue discussions on the new list.  These replies will not appear in the archive.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
To post to this group, send email to scikit...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages