Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

imcontour

Create contour plot of image data

Syntax

imcontour(I)
imcontour(I,n)
imcontour(I,v)
imcontour(x,y,...)
imcontour(...,LineSpec)
[C,handle] = imcontour(...)

Description

imcontour(I) draws a contour plot of the grayscale image I, automatically setting up the axes so their orientation and aspect ratio match the image.

imcontour(I,n) draws a contour plot of the grayscale image I, automatically setting up the axes so their orientation and aspect ratio match the image. n is the number of equally spaced contour levels in the plot; if you omit the argument, the number of levels and the values of the levels are chosen automatically.

imcontour(I,v) draws a contour plot of I with contour lines at the data values specified in vector v. The number of contour levels is equal to length(v).

imcontour(x,y,...) uses the vectors x and y to specify the x- and y-axis limits.

imcontour(...,LineSpec) draws the contours using the line type and color specified by LineSpec. Marker symbols are ignored.

[C,handle] = imcontour(...) returns the contour matrix C and a handle to an hggroup object.

Class Support

The input image can be of class uint8, uint16, int16, single, double, or logical.

Examples

collapse all

This example shows how to create a contour plot of an image.

Read grayscale image and display it. The example uses an example image of grains of rice.

I = imread('rice.png');
imshow(I)

Create a contour plot of the image using imcontour .

figure;
imcontour(I,3)

See Also

| |

Introduced before R2006a

Was this topic helpful?