Gray level profile🔗

Computes the gray-level profile of any rectangular region.


  • image: Input image.

  • startPoint: The location of the first profile point in world coordinates.

  • endPoint: The location of the last profile point in world coordinates.

  • width: The width of the profile line on XY-plane in world coordinates. If the width is zero, the profile will be made of point samples. A non-zero width means that an average over the pixels that span width world units will be calculated.

  • interpolation: If true, improve accuracy by interpolating point samples between pixels along the profile line. If false, round pixel coordinates to the nearest integer. Notice that interpolation is a significantly slower operation than rounding.

  • sampleDistance: The distance between profile samples in world units. Note that the requested sample distance may not be exactly achievable; the tool rounds it so that the last profile point is exactly at endPoint. In addition, the length of the resulting profile vector is limited to 10000. Setting sampleDistance to zero makes the tool to automatically select the sampling distance so that it is close to the distance between adjacent pixels in the image.


  • profile: 1-by-N matrix containing gray-level profile calculated on the specified region.

  • sampleDistance: The distance between profile samples in world coordinates. Since the distance between startPoint and endPoint may not be exactly divisible by the sampleDistance input parameter, this value may be slightly different from it.