############################## # Example PDL script to generate the warped Shuttle images for the PDL # web page use PDL::Transform; ########## Load in the original image as an NxMx3 RGB image $a=rim('shuttlemir_nasa_big.jpg'); ########## Define coordinate transforms: $t maps to azimuthal space; $ts is a # linear scale for the movie frames $t = ( t_offset([-3.14159,0]) x t_radial(r0=>100) x t_linear(pre=>[-250,-200],rot=>90) ); $ts = t_linear(scale=>0.33333); ########## Sub to make movie frames $s = sub { $method=shift; for $i(0..359){ print "$i..."; $b = $a->map( !$t x t_linear(rot=>$i) x $t x $ts, [500,400], {pix=>1, method=>$method, bound=>'m', big=>5 } ); print "wim"; wim($b,sprintf("frame-$method-%3.3d.png",$i)); } }; ########## Make the sampled frames (fast) &$s('sample'); ########## Make the anti-aliased frames (Warning: quite slow because 'big' has # a ludicrously large value, to render the points near "infinity". &$s('gauss'); ########## Make sample frames - larger resolution. $s2 = sub { my ($r,$name) = @_; ($n1 = $name)=~s/\.jpg/-big.jpg/; my $tt = !$ts x !$t x t_linear(rot=>$r) x $t x $ts wim( $a->map( $tt, [1500,1200], {pix=>1,m=>'g',b=>'m',big=>5} ) , $n1 ); wim( $a->map( $tt, [188,150], {pix=>1,m=>'g',b=>'m',big=>5} ) , $name ); }; &$s2(180, 'inside-out.jpg'); &$s2(-90, 'max-warp.jpg'); &$s2(-20, 'some-warp.jpg');