from skimage.draw import circle, circle_perimeter, ellipse_perimeter, ellipse
rr1, cc1 = circle_perimeter(50,50,50)
rr2, cc2 = circle(50,50,50)
rr2 = rr2[::2]
cc2 = cc2[::2]
from matplotlib.patches import PathPatch, Path, Patch, Polygon, RegularPolygon
from matplotlib.collections import PatchCollection
from __future__ import division
from math import atan2
import math
def rint(x): return int(round(x,0))
def norm(xy):
x,y = xy
cx, cy = 50,50
nx, ny = x-cx, y-cy
return atan2(ny, nx)
z2, z1 = zip(rr2, cc2), zip(rr1, cc1)
z2.sort(key=norm)
z1.sort(key=norm)
p1 = Path(z1)
p2 = Path(z2)
patch1 = PathPatch(p1, facecolor='green')
patch2 = PathPatch(p2, facecolor='white', lw=5)
from skimage.data import moon
from skimage.io import imread
patches = [patch2]#, patch1]
fig, ax = plt.subplots(figsize=(12,12))
ax.imshow(moon(), plt.cm.flag)
colors = [.1]
#colors = ['r', 'b','g']
p = PatchCollection(patches, cmap=plt.cm.Blues, alpha=1)
p.set_array(np.array(colors))
ax.add_collection(p)
#plt.colorbar(p)
plt.xlim(0,100)
plt.ylim(0,100)
plt.show()
image=np.zeros((101,101))
rr_cc_2 = (rr2,cc2)
image[(rr_cc_2)]=1
imshow(image)
<matplotlib.image.AxesImage at 0x49bc590>