How do you plot a line between two coordinates on a binary and color image?

1 次查看(过去 30 天)
new to matlab

回答(1 个)

Image Analyst
Image Analyst 2015-9-16
The image type does not matter. Just put hold on and then call line()
hold on;
line([x1,x2], [y1,y2], 'Color', 'r', 'LineWidth', 3);
Or you can call plot() if you want
hold on;
plot([x1,x2], [y1,y2], 'r-', 'LineWidth', 3);
Or in terms of rows and columns
hold on;
line([col1,col2], [row1,row2], 'Color', 'r', 'LineWidth', 3);
  2 个评论
daniel
daniel 2015-10-5
It does not seem to work,gives this error,error using line Vectors must be the same lengths ,not sure why.
Image Analyst
Image Analyst 2015-10-5
I don't know why either. How could I possibly know? You haven't shared anything helpful. If you want help, post your code and the full error message (everything in red).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by