我在图像上绘制一条线,我希望将线分开/划分5次并得到5点坐标,在脚本中我有线坐标,但我不知道如何继续。我将不胜感激任何帮助。感谢
clc;
clear all;
figure, imshow('pout.tif');
h = imline;
lineEndPoints = wait(h);
x1 = round(lineEndPoints(1,1),2);
y1 = round(lineEndPoints(1,2),2);
x2 = round(lineEndPoints(2,1),2);
y2 = round(lineEndPoints(2,2),2);
答案 0 :(得分:1)
它只是将线分成5个相等的段吗?
>> x = lineEndPoints(1:2,1)
x =
32
327
>> y = lineEndPoints(1:2,2)
y =
48
485
>> a = (0:5)/5
a =
0 0.2000 0.4000 0.6000 0.8000 1.0000
>> x = x(1) + (x(2)-x(1))*a
x =
32 91 150 209 268 327
>> y = y(1) + (y(2)-y(1))*a
y =
48.0000 135.4000 222.8000 310.2000 397.6000 485.0000