circle-perimeter-aa

circle_perimeter_aa

skimage.draw.circle_perimeter_aa()

Generate anti-aliased circle perimeter coordinates.

Parameters:

cy, cx : int

Centre coordinate of circle.

radius: int

Radius of circle.

shape : tuple, optional

Image shape which is used to determine the maximum extent of output pixel coordinates. This is useful for circles which exceed the image size. By default the full extent of the circle are used.

Returns:

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

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

Notes

Wu’s method draws anti-aliased circle. This implementation doesn’t use lookup table optimization.

References

[R70] X. Wu, “An efficient antialiasing technique”, In ACM SIGGRAPH Computer Graphics, 25 (1991) 143-152.

Examples

>>> from skimage.draw import circle_perimeter_aa
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc, val = circle_perimeter_aa(4, 4, 3)
>>> img[rr, cc] = val * 255
>>> img
array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
       [  0,   0,  60, 211, 255, 211,  60,   0,   0,   0],
       [  0,  60, 194,  43,   0,  43, 194,  60,   0,   0],
       [  0, 211,  43,   0,   0,   0,  43, 211,   0,   0],
       [  0, 255,   0,   0,   0,   0,   0, 255,   0,   0],
       [  0, 211,  43,   0,   0,   0,  43, 211,   0,   0],
       [  0,  60, 194,  43,   0,  43, 194,  60,   0,   0],
       [  0,   0,  60, 211, 255, 211,  60,   0,   0,   0],
       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0]], dtype=uint8)
doc_scikit_image
2017-01-12 17:20:26
Comments
Leave a Comment

Please login to continue.