mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-01 20:41:08 +08:00
Fix aliasing and update docstring
This commit is contained in:
@@ -78,8 +78,9 @@ def _line_profile_coordinates(src, dst, linewidth=1):
|
||||
|
||||
Returns
|
||||
-------
|
||||
return_value : array
|
||||
The coordinates of the profile along the scan line. The length of the profile is the ceil of the computed length of the scan line. The array is of the form (2, length, linewidth).
|
||||
coords : array, shape (2, N, C), float
|
||||
The coordinates of the profile along the scan line. The length of the
|
||||
profile is the ceil of the computed length of the scan line.
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
@@ -159,7 +159,11 @@ class LineProfile(PlotPlugin):
|
||||
if width > 1:
|
||||
rp, cp = measure.profile._line_profile_coordinates(
|
||||
*end_points[:, ::-1], linewidth=width)
|
||||
line_image[rp.astype(int), cp.astype(int)] = 128
|
||||
# the points are aliased, so create a polygon using the corners
|
||||
yp = np.rint(rp[[0, 0, -1, -1],[0, -1, -1, 0]]).astype(int)
|
||||
xp = np.rint(cp[[0, 0, -1, -1],[0, -1, -1, 0]]).astype(int)
|
||||
rp, cp = draw.polygon(yp, xp, line_image.shape)
|
||||
line_image[rp, cp] = 128
|
||||
(x1, y1), (x2, y2) = end_points.astype(int)
|
||||
rr, cc = draw.line(y1, x1, y2, x2)
|
||||
line_image[rr, cc] = 255
|
||||
|
||||
Reference in New Issue
Block a user