1ImageRGB(3)           User Contributed Perl Documentation          ImageRGB(3)
2
3
4

NAME

6       PDL::ImageRGB -- some utility functions for RGB image data handling
7

DESCRIPTION

9       Collection of a few commonly used routines involved in handling of RGB,
10       palette and grayscale images. Not much more than a start. Should be a
11       good place to exercise some of the thread/map/clump PP stuff.
12
13       Other stuff that should/could go here:
14
15       * color space conversion
16       * common image filters
17       * image rebinning
18

SYNOPSIS

20        use PDL::ImageRGB;
21

FUNCTIONS

23       cquant
24
25       quantize and reduce colours in 8-bit images
26
27           ($out, $lut) = cquant($image [,$ncols]);
28
29       This function does color reduction for <=8bit displays and accepts 8bit
30       RGB and 8bit palette images. It does this through an interface to the
31       ppm_quant routine from the pbmplus package that implements the median
32       cut routine which intellegently selects the 'best' colors to represent
33       your image on a <= 8bit display (based on the median cut algorithm).
34       Optional args: $ncols sets the maximum nunmber of colours used for the
35       output image (defaults to 256).  There are images where a different
36       color reduction scheme gives better results (it seems this is true for
37       images containing large areas with very smoothly changing colours).
38
39       Returns a list containing the new palette image (type PDL_Byte) and the
40       RGB colormap.
41
42       interlrgb
43
44       Make an RGB image from a palette image and its lookup table.
45
46           $rgb = $palette_im->interlrgb($lut)
47
48       Input should be of an integer type and the lookup table (3,x,...). Will
49       perform the lookup for any N-dimensional input pdl (i.e. 0D, 1D, 2D,
50       ...). Uses the index command but will not dataflow by default. If you
51       want it to dataflow the dataflow_forward flag must be set in the $lut
52       piddle (you can do that by saying $lut->set_dataflow_f(1)).
53
54       rgbtogr
55
56       Converts an RGB image to a grey scale using standard transform
57
58          $gr = $rgb->rgbtogr
59
60       Performs a conversion of an RGB input image (3,x,....) to a greyscale
61       image (x,.....) using standard formula:
62
63          Grey = 0.301 R + 0.586 G + 0.113 B
64
65       bytescl
66
67       Scales a pdl into a specified data range (default 0-255)
68
69               $scale = $im->bytescl([$top])
70
71       By default $top=255, otherwise you have to give the desired top value
72       as an argument to "bytescl". Normally "bytescl" doesn't rescale data
73       that fits already in the bounds 0..$top (it only does the type converā€
74       sion if required).  If you want to force it to rescale so that the max
75       of the output is at $top and the min at 0 you give a negative $top
76       value to indicate this.
77

BUGS

79       This package doesn't yet contain enough useful functions!
80

AUTHOR

82       Copyright 1997 Christian Soeller <c.soeller@auckland.ac.nz> All rights
83       reserved. There is no warranty. You are allowed to redistribute this
84       software / documentation under certain conditions. For details, see the
85       file COPYING in the PDL distribution. If this file is separated from
86       the PDL distribution, the copyright notice should be included in the
87       file.
88
89
90
91perl v5.8.8                       2006-12-02                       ImageRGB(3)
Impressum