Sorry, didn't notice the 50% *shrinkage* in the other direction. You'll of course want to use "pdl(0.5,2)" in the bottom example, or add the appropriate line in the top
example.

You may want to play with the different resampling algorithms in map (), to highlight the weirdnesses of the Baker transform -- vertical Fourier components are shoved way, way up above the Nyquist frequency, so you ought to get some interesting effects with the "sample" method, while the "hanning" or "gaussian" methods ought to be more correct but
less interesting.


On Aug 31, 2007, at 8:13 AM, Craig DeForest wrote:

Hi, Hernan,

You can specify scale independently by feeding a vector into the "scale=>" field of the t_linear parameters. More easily, you can use PDL::Transform's
autoscaling features:

        $x = rim("my_image_original.png");
        $xdims = [$x->dims];
        $xdims->[1] *= 2;
        $y = $x->map( t_identity, $xdims );

You can compress the last three lines into one:
        $y = $x->match( [(pdl($x->dims)*pdl(1,2))->list] );

Cheers,
Craig

On Aug 31, 2007, at 7:10 AM, Hernán De Angelis wrote:

Dear listers,

I am trying to write a small program in PDL that performs the "baker"
transformation on a sample image. I am a relatiovely new PDL user and
the objective of this is to learn more  The basic steps, given an
image, are:

1. 100% stretch in the X direction, e.g. from 100 pixels to 200.
2. 50% contract in the Y direction, e.g. from 100 pixels to 50.
3. divide in two halves along X and create a new image by putting the
right halve above the left one (the new image has the same size as the
input one).

I know how to do step number 3, but my attempts to use PDL::Transform
to do steps 1 and 2 have failed. Basically, I cannot figure out how to define a transformation (using t_linear) that applies different scales
to X and Y. Any hint will be appreciated.

Thanks in advance

Hernán


--

Hernán De Angelis
Linux user # 397217

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl




_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to