circle

circle

skimage.draw.circle(r, c, radius, shape=None) [source]

Generate coordinates of pixels within circle.

Parameters:

r, c : double

Centre coordinate of circle.

radius: double

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 : ndarray of int

Pixel coordinates of circle. May be used to directly index into an array, e.g. img[rr, cc] = 1.

Notes

This function is a wrapper for skimage.draw.ellipse()

Examples

>>> from skimage.draw import circle
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc = circle(4, 4, 5)
>>> img[rr, cc] = 1
>>> img
array([[0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
       [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
       [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
       [0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
doc_scikit_image
2017-01-12 17:20:25
Comments
Leave a Comment

Please login to continue.