Note:
The transformation doesn't make a real transformation for each pixel,
but a mesh transformation (see PIL Image.transform).
It will divide the target image into rectangles (a mesh). The
source coordinates for each rectangle vertex will be calculated.
The quadrilateral will then be transformed with the source coordinates
into the destination quad (affine).
This method will perform good transformation results if the number of
quads is high enough (even transformations with strong distortions).
Tests on images up to 1500x1500 have shown that meshes beyond 8x8
will not improve the results.
src quad dst quad
.----. <- coord- .----.
/ / transformation | |
/ / | |
.----. img-transformation -> .----.----
| | |
---------------.
large src image large dst image
|
|
__init__(self,
src_srs,
dst_srs,
resampling=None,
mesh_div=8)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
ImageSource
|
transform(self,
src_img,
src_bbox,
dst_size,
dst_bbox)
Transforms the src_img between the source and destination SRS
of this ImageTransformer instance. |
source code
|
|
|
|
_transform_simple(self,
src_img,
src_bbox,
dst_size,
dst_bbox)
Do a simple crop/extend transformation. |
source code
|
|
|
|
_transform(self,
src_img,
src_bbox,
dst_size,
dst_bbox)
Do a 'real' transformation with a transformed mesh (see above). |
source code
|
|
|
|
| _no_transformation_needed(self,
src_size,
src_bbox,
dst_size,
dst_bbox) |
source code
|
|
|
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|