本示例显示了几种获取图形窗口中显示的图像(称为目标 图像)的句柄的方法。使用模块化交互式工具创建应用程序时,这很有用。
最初使用imshow
返回句柄的语法在图形窗口中显示图像时获取句柄。
hfig = figure;
himage = imshow('moon.tif')
himage =
Image with properties:
CData: [537x358 uint8]
CDataMapping: 'scaled'
Show all properties
使用imhandles
函数在图形窗口中显示图像后获取手柄。您必须指定图形窗口的句柄作为参数:
himage2 = imhandles(hfig)
himage2 =
Image with properties:
CData: [537x358 uint8]
CDataMapping: 'scaled'
Show all properties
注:本文根据MATLAB官网内容修改而成。
欢迎您进一步了解以下MATLAB系列文章:
吃小羊:MATLAB作图实例:00:索引zhuanlan.zhihu.com