[iapad] [Up] [iaind2sub] Image Information and Manipulation

iatile
Replicate the image until reach a new size.

Synopsis

g = iatile( f, new_size )

Implemented in Python.

Input

f Image. Gray-scale (uint8 or uint16) or binary image (logical).

input image.

new_size Image. Gray-scale (uint8 or uint16) or binary image (logical).

[rows cols], output image dimensions.

Output

g Image. Gray-scale (uint8 or uint16) or binary image (logical).

Examples

>>> f=[[1,2],[3,4]]

              
>>> print f
[[1, 2], [3, 4]]
>>> g = iatile(f, (3,6))

              
>>> print g
[[1 2 1 2 1 2]
 [3 4 3 4 3 4]
 [1 2 1 2 1 2]]

Source Code

def iatile(f, new_size):
    from Numeric import asarray, NewAxis, resize, transpose
    f = asarray(f)
    if len(f.shape) == 1: f = f[NewAxis,:]
    aux = resize(f, (new_size[0], f.shape[1]))
    aux = transpose(aux)
    aux = resize(aux, (new_size[1], new_size[0]))
    g = transpose(aux)
    return g
    
[iapad] [Up] [iaind2sub] http://www.python.org