■ polygon 함수를 사용해 다각형을 그리는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import numpy as np import matplotlib from skimage import io, draw matplotlib.use('TkAgg') io.use_plugin('matplotlib') imageNDArray = np.zeros((100, 100), dtype = np.uint8) xNDArray = np.array([10, 60, 40, 10]) yNDArray = np.array([10, 25, 80, 50]) x, y = draw.polygon(yNDArray, xNDArray) imageNDArray[x, y] = 1 io.imshow(imageNDArray) io.show() |