bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / measure / profile / profile_line
function
skimage.measure.profile:profile_line
source: /dev/scikit-image/src/skimage/measure/profile.py :7
Signature
def profile_line ( image , src , dst , linewidth = 1 , order = None , mode = reflect , cval = 0.0 , * , reduce_func = <function mean at 0x0000> ) Summary
Return the intensity profile of an image measured along a scan line.
Parameters
image: ndarray, shape (M, N[, C])The image, either grayscale (2D array) or multichannel (3D array, where the final axis contains the channel information).
src: array_like, shape (2,)The coordinates of the start point of the scan line.
dst: array_like, shape (2,)The coordinates of the end point of the scan line. The destination point is included in the profile, in contrast to standard numpy indexing.
linewidth: int, optionalWidth of the scan, perpendicular to the line
order: {0, 1, 2, 3, 4, 5}, optionalThe order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
mode: {'constant', 'nearest', 'reflect', 'mirror', 'wrap'}, optionalHow to compute any values falling outside of the image.
cval: float, optionalIf
modeis 'constant', what constant value to use outside the image.reduce_func: callable, optionalFunction used to calculate the aggregation of pixel values perpendicular to the profile_line direction when
linewidth> 1. If set to None the unreduced array will be returned.
Returns
return_value: arrayThe intensity profile along the scan line. The length of the profile is the ceil of the computed length of the scan line.
Examples
x = np.array([[1, 1, 1, 2, 2, 2]]) img = np.vstack([np.zeros_like(x), x, x, x, np.zeros_like(x)]) img profile_line(img, (2, 1), (2, 4)) profile_line(img, (1, 0), (1, 6), cval=4)✓
profile_line(img, (1, 0), (1, 6)) # The final point is out of bounds profile_line(img, (1, 0), (1, 5)) # This accesses the full first row✓
profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.mean) profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.max) profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.sum)✓
profile_line(img, (1, 2), (4, 2), linewidth=3, order=0, reduce_func=None) profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.sqrt)✓
Aliases
-
skimage.measure.profile_line