Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

PDL examples?

by impossiblerobot (Deacon)
on Aug 26, 2002 at 14:48 UTC ( #192891=perlquestion: print w/ replies, xml ) Need Help??
impossiblerobot has asked for the wisdom of the Perl Monks concerning the following question:

In response to this node, fglock suggested using the PDL module to resize 2D graphics. Unfortunately, circumstances prevented fglock from providing an example of how this might be done, so I decided to make a request to the Monastery in general.

If anyone has any experience with the Perl Data Language, and is willing to share some code, I would be interested in seeing how useful this (seemingly complex) collection of modules is.

Although I'm primarily interested at this point in 2D graphics transformations, I would also be interested in seeing other practical uses you've made of PDL (since most of the examples I've seen seem fairly obscure).

Impossible Robot

Comment on PDL examples?
Re: PDL examples?
by Zaxo (Archbishop) on Aug 26, 2002 at 15:33 UTC

    The Wolf Book, chapter 7, has a whole series of examples using PDL to represent and modify an image.

    I have used PDL::FFT for signal processing/generation chores. To use PDL, just feed it an array reference in the constructor. An example of mine is at Re: Manipulating Audio Data in Perl.

    Modifying an image file would involve rewriting the image file's headers as well as the data munging itself.

    After Compline,

Re: PDL examples?
by fglock (Vicar) on Aug 26, 2002 at 16:01 UTC

    this is a simple "rescale to 256x256" program. (there are too many "use" statements here - this was cut from a larger program).

    #! /bin/perl use PDL; use PDL::FFT; use PDL::IO::Pic; use PDL::Image2D; use PDL::ImageRGB; use PDL::ImageND; use PDL::Primitive; use PDL::Slices; $real = PDL->rpic('image.pgm'); # read image $display = zeroes(256,256); # new empty image PDL::rescale2d($real, $display); # scale into empty image $display->wpic("test.tif"); # done

    update:Zaxo: PDL::IO::Pic takes care of image headers, compression, etc. for you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://192891]
Approved by shadox
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2015-01-29 19:08 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (244 votes), past polls