[iabwlp] [Up] [iaramp] | Image Creation |
Creates a binary image with dimensions given by s, radius given by r and center given by c. The pixels inside the circle are one and outside zero.
>>> F = iacircle([5,7], 2, [2,3])
>>> print F
[[0 0 0 1 0 0 0] [0 0 1 1 1 0 0] [0 1 1 1 1 1 0] [0 0 1 1 1 0 0] [0 0 0 1 0 0 0]]
>>> F = iacircle([200,300], 90, [100,150])
>>> iashow(F)
(200, 300) Min= 0 Max= 1 Mean=0.424 Std=0.49
F |
def iacircle(s, r, c): rows, cols = s[0], s[1] y0, x0 = c[0], c[1] x, y = iameshgrid(range(cols), range(rows)) g = (x - x0)**2 + (y - y0)**2 <= r**2 return g
iarectangle | Create a binary rectangle image. |
[iabwlp] [Up] [iaramp] | |