make gridlines and enter the x and y coordinates of an object to change its position on the page.
2 ビュー (過去 30 日間)
古いコメントを表示
Grishelda Athallah
2020 年 10 月 13 日
コメント済み: Image Analyst
2020 年 10 月 14 日
Hi, I have an image that I need to trace and know the position of its x-y coordinates.
So far I have been able to trace and get the x-y coordinate information from the results of the traced image. But after the coordinates came out, the location of the point was not what I wanted.
Is there a way to enter the x -y values to change its position? And maybe I was wondering if there is a way to make gridlines so its easier when i trace the image.
Thank you!

2 件のコメント
採用された回答
Image Analyst
2020 年 10 月 13 日
You can overlay gridlines on the image with xline() and yline()
[rows, columns, numColors] = size(rgbImage)
for row = 1 : 20 : rows
yline(row, 'Color', 'r', 'LineWidth', 2);
end
for col = 1 : 20 : columns
xline(col, 'Color', 'r', 'LineWidth', 2);
end
If you want to edit/change the x and y values you can do that by double clicking the array in the workspace panel to bring it up in the Variable Editor, then you can just type in the values you want. Or of course you can just do it from the command line if you want:
x(9) = 100; % Change point #9
y(9) = 800;
or whatever.
2 件のコメント
Image Analyst
2020 年 10 月 14 日
You must have an old version of MATLAB. You blew right past that part when you originally posted where it asked you for your version number for some reason. Why did you not fill out the entire form when you posted?
Anyway, you can replace yline with this:
[rows, columns, numColors] = size(rgbImage)
hold on;
for row = 1 : 20 : rows
plot([1, columns], [row, row], 'Color', 'r', 'LineWidth', 2);
end
for col = 1 : 20 : columns
plot([col, col], [1, rows], 'Color', 'r', 'LineWidth', 2);
end
hold off;
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!