Hi monks,
I'm new to perl, as well as PDL. So here's the question..
I have a matrix of size 1800x1800, and only few points have valid data(say 10000). Now, i want to interpolate(bilinear) whole matrix using the available data.
I've already implemented this using pure-perl, but due to complexity issues, i'm trying to do this using PDL
I have a few ideas in mind, but i'm too sure about them, as i don't know if i can implement the same using PDL.
Any suggestions or solutions are appreciated. Thanks in advance.
Monk vr provided the solution in his replies. Very thankful for his responses.
Updated questionHow to rescale a 2-dimensional data by interpolation, using piddles?
Solutionuse PDL; use PDL::Image2D; use PDL::IO::GD; my $data_pdl; #a pdl(289,145) my $interpolated_pdl = zeroes(21600,10800); bilin2n($interpolated_pdl,$data_pdl); my $range1 = ( $x >= 5 ) * ( $x < 10 ); my $range2 = ( $x >= 10 ) * ( $x < 15 ); my $range3 = $x >= 15; my $plotted_pdl = ( $range1 + 2 * $range2 + 3 * $range3 )-> byte; my $palette = byte [ [ 0, 0, 0 ], [ 255, 0, 0 ], [ 0, 255, 0 ], [ 0, 0, 255 ] ]; my $plotted_image = PDL::IO::Image->new_from_pdl($plotted_pdl,$pal +lete); my $gd_image=PDL::IO::GD->new(pdl=>$plotted_image->pixels_to_pdl); #now all kinds of GD operations can be applied.
I'm sure there are much better ways of doing this, like directly generating a PDL::IO::GD object using PDL::IO::GD->new({ pdl => $pdl_var, lut => $lut_piddle }) but the above solution works fine.
In reply to Interpolating data using pdl by karthik248
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |