Main Content

Get Handle to Target Image

This example shows several ways to get the handle to the image displayed in a figure window, referred to as the target image. This can be useful when creating apps with the modular interactive tools.

Get the handle when you initially display the image in a figure window using the imshow syntax that returns a handle.

hfig = figure;
himage = imshow('moon.tif')

Figure contains an axes object. The hidden axes object contains an object of type image.

himage = 
  Image with properties:

           CData: [537x358 uint8]
    CDataMapping: 'scaled'

  Use GET to show all properties

Get the handle after you have displayed the image in a figure window using the imhandles function. You must specify a handle to the figure window as a parameter.

himage2 = imhandles(hfig)
himage2 = 
  Image with properties:

           CData: [537x358 uint8]
    CDataMapping: 'scaled'

  Use GET to show all properties

See Also

Related Topics