mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-26 13:37:17 +08:00
used plt.subplots everywhere
This commit is contained in:
@@ -26,7 +26,8 @@ image = rotate(image, angle=15, order=0)
|
||||
label_img = label(image)
|
||||
regions = regionprops(label_img)
|
||||
|
||||
plt.imshow(image)
|
||||
f, ax = plt.subplots()
|
||||
ax.imshow(image, cmap=plt.cm.gray)
|
||||
|
||||
for props in regions:
|
||||
y0, x0 = props.centroid
|
||||
@@ -36,15 +37,14 @@ for props in regions:
|
||||
x2 = x0 - math.sin(orientation) * 0.5 * props.minor_axis_length
|
||||
y2 = y0 - math.cos(orientation) * 0.5 * props.minor_axis_length
|
||||
|
||||
plt.plot((x0, x1), (y0, y1), '-r', linewidth=2.5)
|
||||
plt.plot((x0, x2), (y0, y2), '-r', linewidth=2.5)
|
||||
plt.plot(x0, y0, '.g', markersize=15)
|
||||
ax.plot((x0, x1), (y0, y1), '-r', linewidth=2.5)
|
||||
ax.plot((x0, x2), (y0, y2), '-r', linewidth=2.5)
|
||||
ax.plot(x0, y0, '.g', markersize=15)
|
||||
|
||||
minr, minc, maxr, maxc = props.bbox
|
||||
bx = (minc, maxc, maxc, minc, minc)
|
||||
by = (minr, minr, maxr, maxr, minr)
|
||||
plt.plot(bx, by, '-b', linewidth=2.5)
|
||||
ax.plot(bx, by, '-b', linewidth=2.5)
|
||||
|
||||
plt.gray()
|
||||
plt.axis((0, 600, 600, 0))
|
||||
ax.axis((0, 600, 600, 0))
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user