mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-15 11:25:53 +08:00
Add example to set_color drawing function
This commit is contained in:
@@ -131,6 +131,24 @@ def set_color(img, coords, color):
|
||||
img : (M, N, D) ndarray
|
||||
The updated image.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from skimage.draw import line, set_color
|
||||
>>> img = np.zeros((10, 10), dtype=np.uint8)
|
||||
>>> rr, cc = line(1, 1, 20, 20)
|
||||
>>> set_color(img, (rr, cc), 1)
|
||||
>>> img
|
||||
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1]], dtype=uint8)
|
||||
|
||||
"""
|
||||
|
||||
rr, cc = coords
|
||||
|
||||
Reference in New Issue
Block a user