plot and figure windows
5 ビュー (過去 30 日間)
古いコメントを表示
How can use plot function to indicate specific points in the figure window which displays an image?
0 件のコメント
回答 (1 件)
Ayush
2024 年 10 月 21 日
Hi,
To indicate specific points in the figure window which display an image, you can first use “hold on” which will allow you to overlay plots on the current figure without erasing the image. Then define the coordinates of the points you want to indicate on the figure and pass them to the “plot” function. Finally, use “hold off” to release the “hold on” the current figure. Refer to an example code below for better understanding:
% Read the image
img = imread('your_image.jpg');
% Display the image
imshow(img);
hold on; % Hold the current figure
% Define the points you want to plot
x = [50, 100, 150]; % X-coordinates of the points
y = [75, 125, 175]; % Y-coordinates of the points
% Plot the points on the image
plot(x, y, 'r*', 'MarkerSize', 10, 'LineWidth', 2);
% Release the hold on the current figure
hold off;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!