MATLAB Answers


Line or segment of line that touch all pixels in a structure

Asked by Rizki Ramadhan on 3 Aug 2019
Latest activity Commented on by Image Analyst
on 4 Aug 2019
I have a 2D image represented by pixels. I have the node information for the points indicated in yellow, but I would like to obtain the nodes (green) where if connected by straight lines, all pixels would have been in touch with the generated line. I understand the theory of using bisection method to iterate the dissection of the original line into 2 halves and shift newly identified nodes towards the structure. How would this look like in code?
Many thanks!


Is their any logic of repetion of newly Nodes (green)?
Can you please attach the original image?

Sign in to comment.


1 Answer

Answer by Image Analyst
on 4 Aug 2019

Maybe try bwdistgeodesic().

  1 Comment

What's wrong with just using all the pixels as given by bwdistgeodesic? See Steve's blog at
You might also want to look into "minimum perimeter polygon": and see if that is what you really want.
Why do you need this, though? Why can't you just work off the binary image?
Attach your binary image, and attach the location of the yellow, original nodes, and say how you got those yellow nodes, and explain how you got the green nodes, especially since the green nodes only appear sort of randomly (not at every pixel along the path).

Sign in to comment.