[iacircle] [Up] [iacos] Image Creation

iaramp
Create an image with vertical bands of increasing gray values.

Synopsis

g = iaramp( s, n, range )

Implemented in Python.

Input

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

[H W], height and width output image dimensions.

n Double. Non-negative integer.

number of vertical bands.

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

[kmin, kmax], minimum and maximum gray scale values.

Output

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

Description

Creates a gray scale image with dimensions given by s, with n increasing gray scale bands from left to right with values varying from the specified range.

Examples

>>> F = iaramp([5,7], 3, [4,10])

              
>>> print F
[[ 4  4  4  7  7 10 10]
 [ 4  4  4  7  7 10 10]
 [ 4  4  4  7  7 10 10]
 [ 4  4  4  7  7 10 10]
 [ 4  4  4  7  7 10 10]]

>>> F = iaramp([200,300], 10, [0,255])

              
>>> iashow(F)
(200, 300) Min= 0 Max= 255 Mean=127.200 Std=81.37
F

Equation

Source Code

def iaramp(s, n, range):
    from Numeric import arange
    rows, cols = s[0], s[1]
    x, y = iameshgrid(arange(cols), arange(rows))
    g = x*n/cols * (range[1]-range[0]) / (n-1) + range[0]
    return g
    

See also

iacircle Create a binary circle image.
[iacircle] [Up] [iacos] http://www.python.org