Generic 2D image generator.
Generates a pattern from a Python Imaging Library image object.
Subclasses should override the _get_image method to produce the
image object.
The background value is calculated as an edge average: see edge_average().
Black-bordered images therefore have a black background, and
white-bordered images have a white background. Images with no
border have a background that is less of a contrast than a white
or black one.
At present, rotation, scaling, etc. just resample; it would be nice
to support some interpolation options as well.
|
|
|
|
|
function(self,
params)
Function to draw a pattern that will then be scaled and rotated. |
source code
|
|
|
|
|
|
|
__getstate__(self)
Return the object's state (as in the superclass), but replace
the '_image' attribute's Image with a string representation. |
source code
|
|
|
|
__setstate__(self,
state)
Load the object's state (as in the superclass), but replace
the '_image' string with an actual Image object. |
source code
|
|
|
Inherited from base.patterngenerator.PatternGenerator:
__call__
Inherited from param.parameterized.Parameterized:
__init__,
__repr__,
__str__,
debug,
defaults,
force_new_dynamic_value,
get_param_values,
get_value_generator,
inspect_value,
message,
print_param_values,
script_repr,
set_dynamic_time_fn,
state_pop,
state_push,
verbose,
warning
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__
|
|
|
__abstract = True
bool(x) -> bool
|
|
|
output_fn = param.ClassSelector(OutputFn, default= IdentityOF())
Optional function to apply to the pattern array after it has been created.
|
|
|
aspect_ratio = param.Number(default= 1.0, bounds= (0.0, None),...
Ratio of width to height; size*aspect_ratio gives the width.
|
|
|
size = param.Number(default= 1.0, bounds= (0.0, None), softbou...
Height of the image.
|
|
|
size_normalization = param.Enumeration(default= 'fit_shortest'...
How to scale the initial image size relative to the default area of 1.0.
|
|
|
whole_image_output_fn = param.ClassSelector(OutputFn, default=...
Function applied to the whole, original image array (before any cropping).
|
|
|
pattern_sampler_type = param.Parameter(default= PatternSampler...
The type of PatternSampler to use to resample/resize the image.
|
|
|
cache_image = param.Boolean(default= True, doc= ...
If False, discards the image after drawing the pattern each time,
to make it possible to use very large databases of images without
running out of memory.
|
|
Inherited from base.patterngenerator.PatternGenerator:
bounds,
mask,
mask_shape,
offset,
orientation,
position,
scale,
x,
xdensity,
y,
ydensity
Inherited from param.parameterized.Parameterized:
name,
print_level
|