transform.pd (PDL-2.082) | : | transform.pd (PDL-2.083) | ||
---|---|---|---|---|

skipping to change at line 12 | skipping to change at line 12 | |||

pp_addpm({At=>'Top'},<<'+======EOD======'); | pp_addpm({At=>'Top'},<<'+======EOD======'); | |||

=head1 NAME | =head1 NAME | |||

PDL::Transform - Coordinate transforms, image warping, and N-D functions | PDL::Transform - Coordinate transforms, image warping, and N-D functions | |||

=head1 SYNOPSIS | =head1 SYNOPSIS | |||

use PDL::Transform; | use PDL::Transform; | |||

my $t = new PDL::Transform::<type>(<opt>) | my $t = PDL::Transform::<type>->new(<opt>) | |||

$out = $t->apply($in) # Apply transform to some N-vectors (Transform method) | $out = $t->apply($in) # Apply transform to some N-vectors (Transform method) | |||

$out = $in->apply($t) # Apply transform to some N-vectors (PDL method) | $out = $in->apply($t) # Apply transform to some N-vectors (PDL method) | |||

$im1 = $t->map($im); # Transform image coordinates (Transform method) | $im1 = $t->map($im); # Transform image coordinates (Transform method) | |||

$im1 = $im->map($t); # Transform image coordinates (PDL method) | $im1 = $im->map($t); # Transform image coordinates (PDL method) | |||

$t2 = $t->compose($t1); # compose two transforms | $t2 = $t->compose($t1); # compose two transforms | |||

$t2 = $t x $t1; # compose two transforms (by analogy to matrix mult.) | $t2 = $t x $t1; # compose two transforms (by analogy to matrix mult.) | |||

skipping to change at line 58 | skipping to change at line 58 | |||

In keeping with standard practice, but somewhat counterintuitively, | In keeping with standard practice, but somewhat counterintuitively, | |||

the L</map> engine uses the inverse transform to map coordinates | the L</map> engine uses the inverse transform to map coordinates | |||

FROM the destination dataspace (or image plane) TO the source dataspace; | FROM the destination dataspace (or image plane) TO the source dataspace; | |||

hence PDL::Transform keeps track of both the forward and inverse transform. | hence PDL::Transform keeps track of both the forward and inverse transform. | |||

For terseness and convenience, most of the constructors are exported | For terseness and convenience, most of the constructors are exported | |||

into the current package with the name C<< t_<transform> >>, so the following | into the current package with the name C<< t_<transform> >>, so the following | |||

(for example) are synonyms: | (for example) are synonyms: | |||

$t = new PDL::Transform::Radial(); # Long way | $t = PDL::Transform::Radial->new; # Long way | |||

$t = t_radial(); # Short way | $t = t_radial(); # Short way | |||

Several math operators are overloaded, so that you can compose and | Several math operators are overloaded, so that you can compose and | |||

invert functions with expression syntax instead of method syntax (see below). | invert functions with expression syntax instead of method syntax (see below). | |||

=head1 EXAMPLE | =head1 EXAMPLE | |||

Coordinate transformations and mappings are a little counterintuitive | Coordinate transformations and mappings are a little counterintuitive | |||

at first. Here are some examples of transforms in action: | at first. Here are some examples of transforms in action: | |||

skipping to change at line 1412 | skipping to change at line 1412 | |||

input FITS transformation *before* autoscaling the pixels. In the special | input FITS transformation *before* autoscaling the pixels. In the special | |||

case of linear transformations, this preserves the rectangular shape of the | case of linear transformations, this preserves the rectangular shape of the | |||

original pixel grid and makes output pixel coordinate proportional to input | original pixel grid and makes output pixel coordinate proportional to input | |||

coordinate. | coordinate. | |||

=item m, method, Method | =item m, method, Method | |||

This option controls the interpolation method to be used. | This option controls the interpolation method to be used. | |||

Interpolation greatly affects both speed and quality of output. For | Interpolation greatly affects both speed and quality of output. For | |||

most cases the option is directly passed to | most cases the option is directly passed to | |||

L<interpND|PDL::Primitive/interpnd> for interpolation. Possible | L<interpND|PDL::Primitive/interpND> for interpolation. Possible | |||

options, in order from fastest to slowest, are: | options, in order from fastest to slowest, are: | |||

=over 3 | =over 3 | |||

=item * s, sample (default for ints) | =item * s, sample (default for ints) | |||

Pixel values in the output plane are sampled from the closest data value | Pixel values in the output plane are sampled from the closest data value | |||

in the input plane. This is very fast but not very accurate for either | in the input plane. This is very fast but not very accurate for either | |||

magnification or decimation (shrinking). It is the default for templates | magnification or decimation (shrinking). It is the default for templates | |||

of integer type. | of integer type. | |||

skipping to change at line 2223 | skipping to change at line 2223 | |||

+======EOD_t_wrap====== | +======EOD_t_wrap====== | |||

pp_add_exported('t_identity'); | pp_add_exported('t_identity'); | |||

pp_addpm(<<'+======EOD_t_identity======'); | pp_addpm(<<'+======EOD_t_identity======'); | |||

=head2 t_identity | =head2 t_identity | |||

=for usage | =for usage | |||

my $xform = t_identity | my $xform = t_identity | |||

my $xform = new PDL::Transform; | my $xform = PDL::Transform->new; | |||

=for ref | =for ref | |||

Generic constructor generates the identity transform. | Generic constructor generates the identity transform. | |||

This constructor really is trivial -- it is mainly used by the other transform | This constructor really is trivial -- it is mainly used by the other transform | |||

constructors. It takes no parameters and returns the identity transform. | constructors. It takes no parameters and returns the identity transform. | |||

=cut | =cut | |||

skipping to change at line 2281 | skipping to change at line 2281 | |||

interpolation method to be used. The linear scaling stuff is a little | interpolation method to be used. The linear scaling stuff is a little | |||

primitive; if you want more, try composing the linear transform with | primitive; if you want more, try composing the linear transform with | |||

this one. | this one. | |||

The prescribed values in the lookup table are treated as | The prescribed values in the lookup table are treated as | |||

pixel-centered: that is, if your input array has N elements per row | pixel-centered: that is, if your input array has N elements per row | |||

then valid data exist between the locations (-0.5) and (N-0.5) in | then valid data exist between the locations (-0.5) and (N-0.5) in | |||

lookup pixel space, because the pixels (which are numbered from 0 to | lookup pixel space, because the pixels (which are numbered from 0 to | |||

N-1) are centered on their locations. | N-1) are centered on their locations. | |||

Lookup is done using L<interpND|PDL::Primitive/interpnd>, so the boundary condit ions | Lookup is done using L<interpND|PDL::Primitive/interpND>, so the boundary condit ions | |||

and broadcasting behaviour follow from that. | and broadcasting behaviour follow from that. | |||

The indexed-over dimensions come first in the table, followed by a | The indexed-over dimensions come first in the table, followed by a | |||

single dimension containing the column vector to be output for each | single dimension containing the column vector to be output for each | |||

set of other dimensions -- ie to output 2-vectors from 2 input | set of other dimensions -- ie to output 2-vectors from 2 input | |||

parameters, each of which can range from 0 to 49, you want an index | parameters, each of which can range from 0 to 49, you want an index | |||

that has dimension list (50,50,2). For the identity lookup table | that has dimension list (50,50,2). For the identity lookup table | |||

you could use C<cat(xvals(50,50),yvals(50,50))>. | you could use C<cat(xvals(50,50),yvals(50,50))>. | |||

If you want to output a single value per input vector, you still need | If you want to output a single value per input vector, you still need | |||

End of changes. 5 change blocks. | ||||

5 lines changed or deleted | | 5 lines changed or added |