mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 07:44:54 +08:00
Merge pull request #1701 from blink1073/fix-draw-polygon-1700
Allow draw.polygon to take a list or tuple (closes #1700)
This commit is contained in:
@@ -268,6 +268,8 @@ def polygon(y, x, shape=None):
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
|
||||
|
||||
"""
|
||||
x = np.asanyarray(x)
|
||||
y = np.asanyarray(y)
|
||||
|
||||
cdef Py_ssize_t nr_verts = x.shape[0]
|
||||
cdef Py_ssize_t minr = int(max(0, y.min()))
|
||||
|
||||
@@ -122,9 +122,8 @@ def test_line_equal_aliasing_horizontally_vertically():
|
||||
|
||||
def test_polygon_rectangle():
|
||||
img = np.zeros((10, 10), 'uint8')
|
||||
poly = np.array(((1, 1), (4, 1), (4, 4), (1, 4), (1, 1)))
|
||||
|
||||
rr, cc = polygon(poly[:, 0], poly[:, 1])
|
||||
rr, cc = polygon((1, 4, 4, 1, 1), (1, 1, 4, 4, 1))
|
||||
img[rr, cc] = 1
|
||||
|
||||
img_ = np.zeros((10, 10))
|
||||
|
||||
Reference in New Issue
Block a user