Drawing a line on a logical matrix

9 views (last 30 days)
yerocyt
yerocyt on 17 Mar 2015
Commented: Image Analyst on 17 Mar 2015
Hi im hoping that someone can help, i currently have a binary mask with a circle of 1s and everything else 0s i have found the centroid of the object using moments and have a list of the edge point.
So my question is, given an edge point and the centroid, how do you then draw a line across the whole image in order to split the object into two halves?
any help you could give would be much appreciated.

Answers (1)

Image Analyst
Image Analyst on 17 Mar 2015
See my attached demo.
  2 Comments
yerocyt
yerocyt on 17 Mar 2015
Edited: yerocyt on 17 Mar 2015
That perfectly answers my question of burning the lines into the image. However i would like to automate my process, i have two points, one being the centroid so i can draw a line between those two points, but how do then extend this line to either the edges of the object or the edges of the whole logical image.
Thank yo for the quick reply and the help :-)
Image Analyst
Image Analyst on 17 Mar 2015
Just figure out the endpoints of the line by whatever automatic way you want. I suspect it may involve algebra or even trigonometry to figure out where the ultimate endpoints are. Actually I'm not sure they even have to lie in the image for it to work though - so you might try letting them go beyond the image. Otherwise you'll have to crop them to one of the sides of the image, which is a little bit tricky but not beyond your capabilities.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!