Image Processing Toolbox    

Intensity Profile

The improfile function calculates and plots the intensity values along a line segment or a multiline path in an image. You can supply the coordinates of the line segments as input arguments, or you can define the desired path using a mouse. In either case, improfile uses interpolation to determine the values of equally spaced points along the path. (By default, improfile uses nearest neighbor interpolation, but you can specify a different method. See Spatial Transformations, for a discussion of interpolation.) improfile works best with intensity and RGB images.

For a single line segment, improfile plots the intensity values in a two-dimensional view. For a multiline path, improfile plots the intensity values in a three-dimensional view.

If you call improfile with no arguments, the cursor changes to a cross hair when it is over the image. You can then specify line segments by clicking on the endpoints; improfile draws a line between each two consecutive points you select. When you finish specifying the path, press Return. improfile displays the plot in a new figure.

In this example, you call improfile and specify a single line with the mouse. The line is shown in red, and is drawn from left to right.

improfile displays a plot of the data along the line.

Figure 10-1: A Plot of Intensity Values Along a Line Segment in an Intensity Image

Notice the peaks and valleys and how they correspond to the light and dark bands in the image.

The example below shows how improfile works with an RGB image. The red line indicates where the line selection was made. Note that the line was drawn from top to bottom.

The improfile function displays a plot with separate lines for the red, green, and blue intensities.

Figure 10-2: A Plot of Intensity Values Along a Line Segment in an RGB Image

Notice how the lines correspond to the colors in the image. For example, the central region of the plot shows high intensities of green and red, while the blue intensity is 0. These are the values for the yellow flower.


  Pixel Selection Image Contours