line-aa

line_aa

skimage.draw.line_aa()

Generate anti-aliased line pixel coordinates.

Parameters:

y0, x0 : int

Starting position (row, column).

y1, x1 : int

End position (row, column).

Returns:

rr, cc, val : (N,) ndarray (int, int, float)

Indices of pixels (rr, cc) and intensity values (val). img[rr, cc] = val.

References

[R72] A Rasterizing Algorithm for Drawing Curves, A. Zingl, 2012 http://members.chello.at/easyfilter/Bresenham.pdf

Examples

>>> from skimage.draw import line_aa
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc, val = line_aa(1, 1, 8, 8)
>>> img[rr, cc] = val * 255
>>> img
array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
       [  0, 255,  56,   0,   0,   0,   0,   0,   0,   0],
       [  0,  56, 255,  56,   0,   0,   0,   0,   0,   0],
       [  0,   0,  56, 255,  56,   0,   0,   0,   0,   0],
       [  0,   0,   0,  56, 255,  56,   0,   0,   0,   0],
       [  0,   0,   0,   0,  56, 255,  56,   0,   0,   0],
       [  0,   0,   0,   0,   0,  56, 255,  56,   0,   0],
       [  0,   0,   0,   0,   0,   0,  56, 255,  56,   0],
       [  0,   0,   0,   0,   0,   0,   0,  56, 255,   0],
       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0]], dtype=uint8)
doc_scikit_image
2017-01-12 17:21:47
Comments
Leave a Comment

Please login to continue.