PDL::PrimaImage - interface between PDL scalars and Prima images
Converts a 2D or 3D PDL scalar into Prima image and vice versa.
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);
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.
im::Byte
im::Short
im::Long
im::Float
im::Double
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.
image
im::ComplexNumber
float
double
im::DComplex
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.
im::RGB
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.
%OPTIONS
rgb
complex
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.
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.
im::bpp1
im::bpp4
im::bpp8
raw
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.
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 ).
Dmitry Karasik, <dmitry@karasik.eu.org>.
PDL-PrimaImage page, http://www.prima.eu.org/PDL-PrimaImage/
The Prima toolkit, http://www.prima.eu.org/
PDL, Prima, Prima::Image.
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.
1 POD Error
The following errors were encountered while parsing the POD:
Expected text after =item, not a bullet
To install PDL::PrimaImage, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PDL::PrimaImage
CPAN shell
perl -MCPAN -e shell install PDL::PrimaImage
For more information on module installation, please visit the detailed CPAN module installation guide.