How to find pixel coordinates of a line between two points on an image?
3 views (last 30 days)
Show older comments
Hello,
If I have two pixels in an image, let's say (x1, y1) and (x2, y2) and i want to draw a line between them.
I was using line() to do this, but I don't know how many pixels does that line have, or their position and value.
Is there a way of finding out maybe not all of them but a subset of them to which i can perform some verifications?
And if so, how can I get their coordinates?
Thanks a lot.
2 Comments
Monica Roberts
on 17 May 2022
Maybe improfile? https://www.mathworks.com/help/images/ref/improfile.html
Accepted Answer
bkpdilau
on 17 May 2022
Edited: bkpdilau
on 17 May 2022
1 Comment
Casian Filigean
on 17 May 2022
Thank you, this is a very elegant implementation, you must have thought really hard to get such a good and optimised option
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!