Finding the coordinates of a line drawn by line function

I have a set of coordinate points set_pts = [ 239 1486 239 1531 239 1567 243 1607 255 1651 279 1615 299 1579 319 1551 351 1527];
Using line function, I could connect them easily on an image.
line(set_pts(:,1),set_pts(:,2));
Now I want to know the coordinates of each point on the line drawn by 'line' function.
How do I get it?

Answers (1)

h=line(set_pts(:,1),set_pts(:,2));
h.XData,
h.YData,

8 Comments

Thank you for your response... but it gives an error Attempt to reference field of non-structure array.
What version of MATLAB do you have? Try
get(h,'XData')
get(h,'YData')
MATLAB Version: 8.1.0.604 (R2013a)
The get(h, 'XData') is returning only the points supplied to 'line' function. I want to know the in between points which made it a continuous line.
What do you mean the "in between points"? There are an infinite number of them on the line segment.
MATLAB doesn't represent the "in between" region of the line as a discrete sequence of points.
by in between points I meant those pixel coordinates which made the line look continuous on the fig. When I zoom in on the fig window, the line seems to be continuous
The pixel coordinates on your computer monitor or would it be enough to analyze an image file? If you want to obtain the figure as a pixelated image, you can use the Save menu option in the figure window or you can use the saveas() command. However, the pixelation of the line will depend on how much you zoom.
In either case, you will need a criterion to decide which image pixels belong to the line and which do not. Matlab's graphics rendering will shade the pixels differently depending on how close they lie to the border of the line.
I think I have not conveyed the problem correctly.

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

Asked:

on 17 Mar 2018

Commented:

on 17 Mar 2018

Community Treasure Hunt

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

Start Hunting!