gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 06:29:06 29 4
gpt4 key购买 nike

我想在特定点在我的人物顶部叠加一个图像..
例如我想在 600px X 600px 图形的标准化点 [0.20, 0.50] 处绘制“cherry.png”[24px X 24px]。
我可以访问图像处理工具箱,并且知道“imread()”,但是我不清楚如何在特定点进行叠加。我应该查看任何想法/引用资料?

最佳答案

如果您希望 24×24 像素图像以标准化点为中心 (0.2,0.5) (相当于 (120,300) 以像素为单位),那么您可以创建一个 axes object即 24×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 image .如果是 indexed image你必须从 IMREAD 获得额外的颜色映射输出所以你可以 convert the indexed image to an RGB image .

关于image - 在MATLAB中,如何用图像注释图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5668383/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com