profile_line(image, src, dst, linewidth=1, order=None, mode=None, cval=0.0, *, reduce_func=<function mean at 0x0000000>)
The image, either grayscale (2D array) or multichannel (3D array, where the final axis contains the channel information).
The coordinates of the start point of the scan line.
The coordinates of the end point of the scan line. The destination point is included in the profile, in contrast to standard numpy indexing.
Width of the scan, perpendicular to the line
The 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.
How to compute any values falling outside of the image.
If :None:None:`mode`
is 'constant', what constant value to use outside the image.
Function used to calculate the aggregation of pixel values perpendicular to the profile_line direction when :None:None:`linewidth`
> 1. If set to None the unreduced array will be returned.
The intensity profile along the scan line. The length of the profile is the ceil of the computed length of the scan line.
Return the intensity profile of an image measured along a scan line.
>>> x = np.array([[1, 1, 1, 2, 2, 2]])This example is valid syntax, but we were not able to check execution
... img = np.vstack([np.zeros_like(x), x, x, x, np.zeros_like(x)])
... img array([[0, 0, 0, 0, 0, 0], [1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [0, 0, 0, 0, 0, 0]])
>>> profile_line(img, (2, 1), (2, 4)) array([1., 1., 2., 2.])This example is valid syntax, but we were not able to check execution
>>> profile_line(img, (1, 0), (1, 6), cval=4) array([1., 1., 1., 2., 2., 2., 4.])
The destination point is included in the profile, in contrast to standard numpy indexing. For example:
This example is valid syntax, but we were not able to check execution>>> profile_line(img, (1, 0), (1, 6)) # The final point is out of bounds array([1., 1., 1., 2., 2., 2., 0.])This example is valid syntax, but we were not able to check execution
>>> profile_line(img, (1, 0), (1, 5)) # This accesses the full first row array([1., 1., 1., 2., 2., 2.])
For different reduce_func inputs:
This example is valid syntax, but we were not able to check execution>>> profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.mean) array([0.66666667, 0.66666667, 0.66666667, 1.33333333])This example is valid syntax, but we were not able to check execution
>>> profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.max) array([1, 1, 1, 2])This example is valid syntax, but we were not able to check execution
>>> profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.sum) array([2, 2, 2, 4])
The unreduced array will be returned when :None:None:`reduce_func`
is None or when :None:None:`reduce_func`
acts on each pixel value individually.
>>> profile_line(img, (1, 2), (4, 2), linewidth=3, order=0,This example is valid syntax, but we were not able to check execution
... reduce_func=None) array([[1, 1, 2], [1, 1, 2], [1, 1, 2], [0, 0, 0]])
>>> profile_line(img, (1, 0), (1, 3), linewidth=3, reduce_func=np.sqrt) array([[1. , 1. , 0. ], [1. , 1. , 0. ], [1. , 1. , 0. ], [1.41421356, 1.41421356, 0. ]])See :
The following pages refer to to this document either explicitly or contain code examples using this.
skimage.measure.profile.profile_line
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them