Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

imgca

Get current axes containing image

Syntax

h = imgca
h = imgca(fig)

Description

h = imgca returns the current axes that contains an image. The current axes can be in a regular figure window or in an Image Tool window.

If no figure contains an axes that contains an image, imgca creates a new axes.

h = imgca(fig) returns the current axes that contains an image in the specified figure. (It need not be the current figure.)

Note

imgca can be useful in returning the axes object in the Image Tool. You cannot retrieve this axes using gca.

Examples

Compute the centroid of each coin, and superimpose its location on the image. View the results using imtool and imgca.

I = imread('coins.png');
figure, imshow(I)

Original Image

bw = im2bw(I, graythresh(getimage));
figure, imshow(bw)

Binary Image

bw2 = imfill(bw,'holes');
s  = regionprops(bw2, 'centroid');
centroids = cat(1, s.Centroid);

Display original image I and superimpose centroids:

imtool(I)
hold(imgca,'on')
plot(imgca,centroids(:,1), centroids(:,2), 'r*')
hold(imgca,'off')

Centroids of Coins

See also

gca, gcf, imgcf, imhandles

Introduced before R2006a

Was this topic helpful?