Pixel-value cross-sections along line segments

`improfile`

improfile(n)

improfile(I,xi,yi)

improfile(I,xi,yi,n)

c = improfile(___)

[cx,cy,c] = improfile(I,xi,yi,n)

[cx,cy,c,xi,yi] = improfile(I,xi,yi,n)

[___] = improfile(x,y,I,xi,yi)

[___] = improfile(x,y,I,xi,yi,n)

[___] = improfile(___,method)

`improfile`

retrieves the intensity values
of pixels along a line or a multiline path in the grayscale, binary,
or RGB image in the current axes and displays a plot of the intensity
values. If the specified path consists of a single line segment, `improfile`

creates
a two-dimensional plot of intensity values versus the distance along
the line segment. If the path consists of two or more line segments, `improfile`

creates
a three-dimensional plot of the intensity values versus their *x*-
and *y*-coordinates.

With this syntax, you specify the line or path using the mouse,
by clicking points in the image. Press **Backspace** or **Delete** to
remove the previously selected point. To finish selecting points,
adding a final point, press shift-click, right-click, or double-click.
To finish selecting points without adding a final point, press **Return**.

`improfile(n)`

retrieves the intensity values,
where `n`

specifies the number of points to include.
If you do not provide this argument, `improfile`

chooses
a value for `n`

, roughly equal to the number of pixels
the path traverses.

`improfile(I,xi,yi)`

retrieves pixel intensity
values, where `I`

specifies an image, and `xi`

and `yi`

are
equal-length vectors specifying the spatial coordinates of the endpoints
of the line segments.

`improfile(I,xi,yi,n)`

returns pixel intensity
values, where `n`

specifies the number of points
to include.

`c = improfile(___)`

returns
the intensity values in `c`

, an `n`

-by-1
vector, if the input is a grayscale intensity image, or an `n`

-by-1-by-3
array if the input is an RGB image.

`[cx,cy,c] = improfile(I,xi,yi,n)`

additionally
returns the spatial coordinates of the pixels, `cx`

and `cy`

,
of length `n`

.

`[cx,cy,c,xi,yi] = improfile(I,xi,yi,n)`

additionally
returns two equal-length vectors specifying the spatial coordinates
of the endpoints of the line segments. `xi`

and `yi`

.

`[___] = improfile(x,y,I,xi,yi)`

enables
the definition of a nondefault spatial coordinate system by specifying
two, 2-element vector, `x`

and `y`

,
containing the image `XData`

and `YData`

.

`[___] = improfile(x,y,I,xi,yi,n)`

defines
a nondefault spatial coordinate system and specifies the number of
points to include, `n`

.

`[___] = improfile(___,method)`

specifies
the interpolation method:

`'nearest'`

— Nearest-neighbor interpolation (the default)`'bilinear'`

— Bilinear interpolation`'bicubic'`

— Bicubic interpolation

The input image can be `uint8`

, `uint16`

, `int16`

, `single`

, `double`

,
or `logical`

. All other inputs and outputs must be `double`

.

Was this topic helpful?