在图像上绘制角度线 - Matlab
Draw angle line over an image - Matlab
为什么我画的角度线不对。我得到的是 315 而不是 45 度?
脚本:
clc;
clear;
url='http://clipart-library.com/images/Bcgrakezi.png';
I = imread(url);
imshow(I);
hold on;
[y1,x1,z1] = size(I);
cy=y1/2;
cx=x1/2;
sz = 50;
scatter(cx,cy,sz,'d')
lineLength = 250;
angle = 45;
xAngleLine(1) = cx;
yAngleLine(1) = cy;
xAngleLine(2) = xAngleLine(1) + lineLength * cosd(angle);
yAngleLine(2) = yAngleLine(1) + lineLength * sind(angle);
plot(xAngleLine, yAngleLine,'g','LineWidth',5);
为什么我画的角度线不对。我得到的是 315 而不是 45 度?
脚本:
clc;
clear;
url='http://clipart-library.com/images/Bcgrakezi.png';
I = imread(url);
imshow(I);
hold on;
[y1,x1,z1] = size(I);
cy=y1/2;
cx=x1/2;
sz = 50;
scatter(cx,cy,sz,'d')
lineLength = 250;
angle = 45;
xAngleLine(1) = cx;
yAngleLine(1) = cy;
xAngleLine(2) = xAngleLine(1) + lineLength * cosd(angle);
yAngleLine(2) = yAngleLine(1) + lineLength * sind(angle);
plot(xAngleLine, yAngleLine,'g','LineWidth',5);