man PDL::ImageRGB () - PDL::ImageRGB -- some utility functions for RGB image data handling
NAME
PDL::ImageRGB -- some utility functions for RGB image data handling
DESCRIPTION
Collection of a few commonly used routines involved in handling of RGB, palette and grayscale images. Not much more than a start. Should be a good place to exercise some of the thread/map/clump PP stuff.
Other stuff that should/could go here:
- * color space conversion
- * common image filters
- * image rebinning
SYNOPSIS
use PDL::ImageRGB;
FUNCTIONS
cquant
quantize and reduce colours in 8-bit images
($out, $lut) = cquant($image [,$ncols]);
This function does color reduction for <=8bit displays and accepts 8bit RGB and 8bit palette images. It does this through an interface to the ppm_quant routine from the pbmplus package that implements the median cut routine which intellegently selects the 'best' colors to represent your image on a <= 8bit display (based on the median cut algorithm). Optional args: CW$ncols sets the maximum nunmber of colours used for the output image (defaults to 256). There are images where a different color reduction scheme gives better results (it seems this is true for images containing large areas with very smoothly changing colours).
Returns a list containing the new palette image (type PDL_Byte) and the RGB colormap.
interlrgb
Make an RGB image from a palette image and its lookup table.
$rgb = $palette_im->interlrgb($lut)
Input should be of an integer type and the lookup table (3,x,...). Will perform the lookup for any N-dimensional input pdl (i.e. 0D, 1D, 2D, ...). Uses the index command but will not dataflow by default. If you want it to dataflow the dataflow_forward flag must be set in the CW$lut piddle (you can do that by saying CW$lut->set_dataflow_f(1)).
rgbtogr
Converts an RGB image to a grey scale using standard transform
$gr = $rgb->rgbtogr
Performs a conversion of an RGB input image (3,x,....) to a greyscale image (x,.....) using standard formula:
Grey = 0.301 R + 0.586 G + 0.113 B
bytescl
Scales a pdl into a specified data range (default 0-255)
$scale = $im->bytescl([$top])
By default CW$top=255, otherwise you have to give the desired top value as an argument to CWbytescl. Normally CWbytescl doesn't rescale data that fits already in the bounds 0..$top (it only does the type conversion if required). If you want to force it to rescale so that the max of the output is at CW$top and the min at 0 you give a negative CW$top value to indicate this.
BUGS
This package doesn't yet contain enough useful functions!
AUTHOR
Copyright 1997 Christian Soeller <c.soeller@auckland.ac.nz> All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file.