PDL::Transform#

📦 stdpdl

Coordinate transformations as objects, and the resampling of images through them.

use PDL;
use PDL::Transform;
my $t = t_linear(scale => 2, pre => pdl(1, 0));
print $t->apply(pdl(1, 1)), " ", $t->invert(pdl(4, 2)), "\n";     # [4 2] [1 1]
print sequence(3, 3)->map(t_linear(rot => 90), { method => 'sample' })->slice(':,(0)'), "\n";
# [2 5 8]

A transformation is made by a constructor - t_linear (scale, rotation, offset, matrix), t_scale, t_offset, t_rot, t_identity, t_lookup (a table), t_fits (the world coordinates of a FITS header), t_code (your own subs), t_cylindrical, t_radial, t_spherical, t_quadratic, t_cubic, t_quartic, t_projective - and combined: $a x $b or t_compose applies $b first, !$t or t_inverse reverses, $t ** $n repeats, t_wrap conjugates. $t->apply($coords) and $t->invert($coords) transform coordinates (the first dimension runs over the axes). $image->map($t, ...) resamples an image through a transformation and unmap through its inverse, with the interpolation method (sample, linear, cubic, fft, the anti-aliasing jacobian, hanning, gaussian) and the boundary condition among their options.

This is PDL::Transform of PDL 2.106: upstream’s Perl, unchanged, over PDL’s own kernels run by pperl’s engine.

Modules#