[ialog] [Up] [iarectangle] | Image Creation |
Implemented in Python.
s | Image. Gray-scale (uint8 or uint16) or binary image (logical).
output image dimensions (1-D, 2-D or 3-D). |
delta | Image. Gray-scale (uint8 or uint16) or binary image (logical).
interval between the impulses in each dimension (1-D, 2-D or 3-D). |
offset | Image. Gray-scale (uint8 or uint16) or binary image (logical).
offset in each dimension (1-D, 2-D or 3-D). |
g | Image. Gray-scale (uint8 or uint16) or binary image (logical). |
>>> u1 = iacomb(10, 3, 2)
>>> print u1
[0 0 1 0 0 1 0 0 1 0]
>>> u2 = iacomb((7,9), (3,4), (3,2))
>>> print u2
[[0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 1 0 0]]
>>> u3 = iacomb((7,9,4), (3,4,2), (2,2,1))
>>> print u3[:,:,0]
[[0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0]]
>>> print u3[:,:,1]
[[0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 0]]
>>> print u3[:,:,2]
[[0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0]]
>>> print u3[:,:,3]
[[0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 0]]
def iacomb(s, delta, offset): from Numeric import asarray, product, zeros s = asarray(s) if product(s.shape) == 1: g = zeros(s) g[offset::delta] = 1 elif len(s) >= 2: g = zeros((s[0], s[1])) g[offset[0]::delta[0], offset[1]::delta[1]] = 1 if len(s) == 3: aux = zeros(s) for i in range(offset[2], s[2], delta[2]): aux[:,:,i] = g g = aux return g
iaptrans | Periodic translation. |
[ialog] [Up] [iarectangle] | |