在MATLAB中,如何用图像注释图形?

| 我想在特定位置将图像覆盖在图形上方。 例如我希望在600px X 600px图形的归一化点[0.20,0.50]上绘制\“ cherry.png \” [24px X 24px]。 我可以访问“图像处理”工具箱,并且知道\“ imread()\”,但是我不清楚如何在特定位置进行叠加。我应该检查的任何想法/参考吗?     
已邀请:
如果您希望将24 x 24像素的图像居中于标准化点
(0.2,0.5)
(相当于
(120,300)
,以像素为单位),则可以创建一个24 x 24像素并以您的点为中心的轴对象,并添加一个使用IMAGE功能将图像成像到轴上。例如:
img = imread(\'cherry.png\');  %# Read the data from your image file
hFigure = figure(\'Position\',[100 100 600 600]);  %# Make the figure window
hAxes = axes(\'Parent\',hFigure,...          %# Add the axes to the figure
             \'Units\',\'pixels\',...          %#   with units of pixels
             \'Position\',[108 288 24 24]);  %#   so the position is easy to define
hImage = image(img,\'Parent\',hAxes);  %# Plot the image
set(hAxes,\'Visible\',\'off\');          %# Turn the axes visibility off
请注意,当我使用IMREAD加载图像数据时,我假设它是3-D RGB图像。如果它是索引图像,则必须从IMREAD中获取其他颜色图输出,以便将索引图像转换为RGB图像。     

要回复问题请先登录注册