NAME
PDL::PrimaImage - interface between PDL scalars and Prima images
DESCRIPTION
Converts a 2D or 3D PDL scalar into Prima image and vice versa.
SYNOPSIS
use PDL;
use Prima;
use PDL::PrimaImage;
my $x = byte([ 10, 111, 2, 3], [4, 115, 6, 7]);
my $i = PDL::PrimaImage::image( $x);
$i-> type( im::RGB);
$x = PDL::PrimaImage::piddle( $i);
image PDL, %OPTIONS
Converts a 2D or 3D piddle into a Prima image. The resulting image pixel format depends on the piddle type and dimension. The 2D array is converted into one of im::Byte
, im::Short
, im::Long
, im::Float
, or im::Double
pixel types.
For the 3D arrays each pixel is expected to be an array of values. image
accepts arrays with 2 and 3 values. For an array with 2 values, the resulting pixel format is complex ( with im::ComplexNumber
bit set), where each pixel contains 2 values, either float
or double
, correspondingly to <im::Complex> and im::DComplex
pixel formats.
For an array with 3 values, the im::RGB
pixel format is assumed. In this format, each image pixel is represented as a single combined RGB value.
To distinguish between degenerate cases, like f ex ([1,2,3],[4,5,6]), where it is impossible to guess whether the piddle is a 3x2 gray pixel image or a 1x2 RGB image, %OPTIONS
hash can be used. When either rgb
or complex
boolean value is set, image
assumes the piddle is a 3D array. If neither option is set, image
favors 2D array semantics.
NB: These hints are neither useful nor are checked when piddle format is explicit, and should only be used for hinting an ambiguous data representation.
piddle IMAGE, %OPTIONS
Converts Prima image into a piddle. Depending on image pixel type, the piddle type and dimension is selected. The following table depicts how different image pixel formats affect the piddle type:
Pixel format PDL type PDL dimension
----------------------------------------
im::bpp1 byte 2
im::bpp4 byte 2
im::bpp8 byte 2
im::Byte byte 2
im::Short short 2
im::Long long 2
im::Float float 2
im::Double double 2
im::RGB byte 3
im::Complex float 3
im::DComplex double 3
im::TrigComplex float 3
im::TrigDComplex double 3
Images in the pixel formats im::bpp1
and im::bpp4
are converted to im::bpp8
before conversion to piddle, so if raw, non-converted data stream is needed, in correspondingly 8- and 2- pixels perl byte format, raw
boolean option must be specified in %OPTIONS
. In this case, the resulting piddle width is aligned to a 4-byte boundary.
Considerations
Prima image coordinate origin is located in lower left corner. That means, that an image created from a 2x2 piddle ([0,0],[0,1]) will contain pixel with value 1 in the upper right corner.
See Prima::Image for more.
Troubleshooting
- Undefinedned symbol "gimme_the_vmt"
-
The symbol is contained in Prima toolkit. Include 'use Prima;' in your code. If the error persists, it is probably Prima error; try to re-install Prima. If the problem continues, try to change manually value in 'sub dl_load_flags { 0x00 }' string to 0x01 in Prima.pm - this flag is used to control namespace export ( see Dynaloader for more ).
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.
SEE ALSO
PDL-PrimaImage page, http://www.prima.eu.org/PDL-PrimaImage/
The Prima toolkit, http://www.prima.eu.org/
PDL, Prima, Prima::Image.
FUNCTIONS
image2piddle
Signature: (data(z,w,h); SV * imagesv; int image2piddle; int mpixel)
info not available
image2piddle does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
TROUBLESHOOTING
- Undefinedned symbol "gimme_the_vmt"
-
The symbol is contained in Prima toolkit. Include 'use Prima;' in your code. If the error persists, it is probably Prima error; try to re-install Prima. If the problem continues, try to change manually value in 'sub dl_load_flags { 0x00 }' string to 0x01 in Prima.pm - this flag is used to control namespace export ( see Dynaloader for more ).
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.
SEE ALSO
PDL-PrimaImage page, http://www.prima.eu.org/PDL-PrimaImage/
The Prima toolkit, http://www.prima.eu.org/
PDL, Prima, Prima::Image.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 200:
Expected text after =item, not a bullet