获取图像的 X Y 坐标
Get X Y coordinates of image
我需要找出如何将获得的坐标形式的图像放入矩阵并保存它。
clc
clear all
k=imread('l.jpg');
for i=1:4
figure(1),imshow(k)
axis on
hold on
title(i)
[x,y]=ginput(1)
pause
end
正如评论所建议的那样,这是一种通过索引数组 x
和 y
使用和索引变量 i
将值存储到数组中的方法,该变量 i
在每个数组中递增循环迭代。您可能知道必须按下任何 Key 才能继续循环。本例使用MATLAB自带的镜像'tire.tif'
clc;
clear;
Image = imread('tire.tif');
imshow(Image);
axis on
Number_Of_Coordinates = 4;
x = zeros(1,Number_Of_Coordinates);
y = zeros(1,Number_Of_Coordinates);
for i = 1: Number_Of_Coordinates
title( i)
[x(i),y(i)] = ginput(1);
fprintf("Coordinates Stored: (%f,%f) -> Press and key to continue\n",x(i),y(i));
pause
end
我需要找出如何将获得的坐标形式的图像放入矩阵并保存它。
clc
clear all
k=imread('l.jpg');
for i=1:4
figure(1),imshow(k)
axis on
hold on
title(i)
[x,y]=ginput(1)
pause
end
正如评论所建议的那样,这是一种通过索引数组 x
和 y
使用和索引变量 i
将值存储到数组中的方法,该变量 i
在每个数组中递增循环迭代。您可能知道必须按下任何 Key 才能继续循环。本例使用MATLAB自带的镜像'tire.tif'
clc;
clear;
Image = imread('tire.tif');
imshow(Image);
axis on
Number_Of_Coordinates = 4;
x = zeros(1,Number_Of_Coordinates);
y = zeros(1,Number_Of_Coordinates);
for i = 1: Number_Of_Coordinates
title( i)
[x(i),y(i)] = ginput(1);
fprintf("Coordinates Stored: (%f,%f) -> Press and key to continue\n",x(i),y(i));
pause
end