Douglas Hunt > PDL-Planet-0.12 > planet.pd

Download:
PDL-Planet-0.12.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

new

Create a new PDL::Planet object.

Arguments: none.

Returns: PDL::Planet object, used to call object methods

  my $pl = PDL::Planet->new;

close

Get rid of a PDL::Planet object

Arguments: none.

Returns: none.

  $pl->close;

read

Read in an image

Arguments:

  File name to read in.  

Supports GIF, JPEG, PNG, BMP (limited support), TIFF, PNM.

Returns: PDL::Planet object.

  my $pl = PDL::Planet->new->read('planet.jpg');

create

Create an image from an external PDL.

Arguments:

  PDL to use to create image (planet) object.

Returns: PDL::Planet object.

  my $pl = PDL::Planet->new->create($rgbpdl);

write

Write an image to a file.

Arguments:

  File name to write out.  The suffix specified tells the
  format.  

Supports GIF, JPEG, PNG, BMP (limited support), TIFF, PNM.

Returns: PDL::Planet object.

  my $pl = PDL::Planet->new->read('planet.jpg')->write('planet.gif');

write_png

Convert an image to a perl scalar containing a PNG.

Arguments:

  Input PDL::Planet object with an image in it.

Returns: A perl scalar containing a PNG image

  my $png = PDL::Planet->new->read('planet.jpg')->write_png;

resize

Resize an image.

Arguments:

  X size, Y size

Returns: PDL::Planet object.

  my $pl = PDL::Planet->new->read('planet.jpg')->resize(400,400)->write('planet.gif');

terminator

Show the day/night terminator for a given time.

Arguments:

  Julian time

Returns: PDL::Planet object.

  my $pl = PDL::Planet->new->read('planet.jpg')->terminator(2453908)->write('planet.gif');

crop

Crop an image.

Arguments:

  X size, Y size
  X offset, Y offset (lower left corner of crop)

Returns: PDL::Planet object.

  my $pl = PDL::Planet->new->read('planet.jpg')->crop(500,500,250,0)->write('planet.gif');

transform

Perform a transformation on an image. Currently supported transformations: -- Orthographic

Arguments:

  Options list:
    TYPE    => 'Orthographic'
    CENTER  => [lat, lon]  # center of orthographic projection    
    SIZE    => [maxx, maxy]       # Size in pixels of resultant projection (defaults to input size)
    SHRINK  => shrink_factor, 0-1 # Controls how much the Earth fills the window
    SUNTIME => julian_time # Turns on drawing of the terminator. 
                           # Computes the sun location at the input time.
    SUNPOS  => [lat, lon]  # Turns on drawing of the terminator with the sun sub point at the
                           # input location

Returns: PDL::Planet object with transformation done.

  my $pl = PDL::Planet->new->read('planet.jpg')->transform(TYPE => Orthographic, CENTER => [40,-105])->write('planet.gif');

llh2xy

Convert lat, lon, height triples to X and Y coordinates according to the transform used currently in the object.

Arguments:

  $lat -- latitude, deg N
  $lon -- longitude, deg E
  $height -- height, m

Returns: $x $y

  my $pl = PDL::Planet->new->read('planet.jpg')->transform(TYPE => Orthographic, CENTER => [40,-105]);
  my ($lat, $lon, $height) = ...
  my ($x, $y) = $pl->llh2xy($lat, $lon, $height);

paste

Paste small images into the current image.

Arguments:

  $image -- Small image to paste into current image (a PDL::Planet object)
  $x     -- PDL of X coordinates of large image to paste the smaller image to
  $y     -- PDL of Y coordinates of large image to paste the smaller image to
  $maskColor -- Number from 0 to 255 (defaults to 255).  The color in the
                smaller image which will be blended into the larger one.
                Defaults to white.  For a small image with a black background, 
                set to 0.
Returns:
  PDL::Planet object with pasting done.
  my $planet  = PDL::Planet->new->read('planet.jpg')->transform(TYPE => Orthographic, CENTER => [40,-105]);
  my $glyph   = PDL::Planet->new->read('satellite.gif');
  my ($lat, $lon, $height) = ...
  my ($x, $y) = $planet->llh2xy($lat, $lon, $height);
  $planet->paste ($glyph, $x, $y)->write('sats.jpg');

Note: The pasted image ($glyph) may have a white (255,255,255) background. This will be blended with the image and not appear in the final result.

rgb

Return a (3, X, Y) PDL of the image with (0,0) in the lower left. The normal orientation of the image is (3,X,Y) with (0,0) in the upper left, but this returns the Y axis flipped because plplot likes it this way.

Arguments:

  PDL::Planet object.

Returns: RGB PDL image.

  my $pl = PDL::Planet->new->read('planet.jpg')->rgb;
syntax highlighting: