mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-17 11:32:45 +08:00
pep8
This commit is contained in:
@@ -19,7 +19,7 @@ from skimage.draw import line, polygon, circle, circle_perimeter, \
|
||||
import numpy as np
|
||||
import math
|
||||
|
||||
img = np.zeros((500, 500, 3), 'uint8')
|
||||
img = np.zeros((500, 500, 3), dtype=np.uint8)
|
||||
|
||||
# draw line
|
||||
rr, cc = line(120, 123, 20, 400)
|
||||
@@ -49,11 +49,11 @@ rr, cc = circle_perimeter(120, 400, 15)
|
||||
img[rr, cc, :] = (255, 0, 0)
|
||||
|
||||
# ellipses
|
||||
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=math.pi/4.)
|
||||
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=math.pi / 4.)
|
||||
img[rr, cc, :] = (255, 0, 255)
|
||||
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=-math.pi/4.)
|
||||
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=-math.pi / 4.)
|
||||
img[rr, cc, :] = (0, 0, 255)
|
||||
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=math.pi/2.)
|
||||
rr, cc = ellipse_perimeter(120, 400, 60, 20, orientation=math.pi / 2.)
|
||||
img[rr, cc, :] = (255, 255, 255)
|
||||
|
||||
plt.imshow(img)
|
||||
|
||||
@@ -384,16 +384,16 @@ def ellipse_perimeter(Py_ssize_t cy, Py_ssize_t cx, Py_ssize_t yradius,
|
||||
iyd = int(floor(ya * w + 0.5))
|
||||
|
||||
# Draw the 4 quadrants
|
||||
rr, cc = bezier_segment(iy0+iyd, ix0, iy0, ix0, iy0, ix0+ixd, 1-w)
|
||||
rr, cc = bezier_segment(iy0 + iyd, ix0, iy0, ix0, iy0, ix0 + ixd, 1-w)
|
||||
py.extend(rr)
|
||||
px.extend(cc)
|
||||
rr, cc = bezier_segment(iy0+iyd, ix0, iy1, ix0, iy1, ix1-ixd, w)
|
||||
rr, cc = bezier_segment(iy0 + iyd, ix0, iy1, ix0, iy1, ix1 - ixd, w)
|
||||
py.extend(rr)
|
||||
px.extend(cc)
|
||||
rr, cc = bezier_segment(iy1-iyd, ix1, iy1, ix1, iy1, ix1-ixd, 1-w)
|
||||
rr, cc = bezier_segment(iy1 - iyd, ix1, iy1, ix1, iy1, ix1 - ixd, 1-w)
|
||||
py.extend(rr)
|
||||
px.extend(cc)
|
||||
rr, cc = bezier_segment(iy1-iyd, ix1, iy0, ix1, iy0, ix0+ixd, w)
|
||||
rr, cc = bezier_segment(iy1 - iyd, ix1, iy0, ix1, iy0, ix0 + ixd, w)
|
||||
py.extend(rr)
|
||||
px.extend(cc)
|
||||
|
||||
@@ -401,9 +401,9 @@ def ellipse_perimeter(Py_ssize_t cy, Py_ssize_t cx, Py_ssize_t yradius,
|
||||
|
||||
|
||||
def bezier_segment(Py_ssize_t y0, Py_ssize_t x0,
|
||||
Py_ssize_t y1, Py_ssize_t x1,
|
||||
Py_ssize_t y2, Py_ssize_t x2,
|
||||
double weight):
|
||||
Py_ssize_t y1, Py_ssize_t x1,
|
||||
Py_ssize_t y2, Py_ssize_t x2,
|
||||
double weight):
|
||||
"""Generate Bezier segment coordinates.
|
||||
|
||||
Parameters
|
||||
|
||||
Reference in New Issue
Block a user