1ImageRGB(3) User Contributed Perl Documentation ImageRGB(3)
2
3
4
6 PDL::ImageRGB -- some utility functions for RGB image data handling
7
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
17 · common image filters
18
19 · image rebinning
20
22 use PDL::ImageRGB;
23
25 cquant
26 quantize and reduce colours in 8-bit images
27
28 ($out, $lut) = cquant($image [,$ncols]);
29
30 This function does color reduction for <=8bit displays and accepts 8bit
31 RGB and 8bit palette images. It does this through an interface to the
32 ppm_quant routine from the pbmplus package that implements the median
33 cut routine which intellegently selects the 'best' colors to represent
34 your image on a <= 8bit display (based on the median cut algorithm).
35 Optional args: $ncols sets the maximum nunmber of colours used for the
36 output image (defaults to 256). There are images where a different
37 color reduction scheme gives better results (it seems this is true for
38 images containing large areas with very smoothly changing colours).
39
40 Returns a list containing the new palette image (type PDL_Byte) and the
41 RGB colormap.
42
43 interlrgb
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 Converts an RGB image to a grey scale using standard transform
56
57 $gr = $rgb->rgbtogr
58
59 Performs a conversion of an RGB input image (3,x,....) to a greyscale
60 image (x,.....) using standard formula:
61
62 Grey = 0.301 R + 0.586 G + 0.113 B
63
64 bytescl
65 Scales a pdl into a specified data range (default 0-255)
66
67 $scale = $im->bytescl([$top])
68
69 By default $top=255, otherwise you have to give the desired top value
70 as an argument to "bytescl". Normally "bytescl" doesn't rescale data
71 that fits already in the bounds 0..$top (it only does the type
72 conversion if required). If you want to force it to rescale so that
73 the max of the output is at $top and the min at 0 you give a negative
74 $top value to indicate this.
75
77 This package doesn't yet contain enough useful functions!
78
80 Copyright 1997 Christian Soeller <c.soeller@auckland.ac.nz> All rights
81 reserved. There is no warranty. You are allowed to redistribute this
82 software / documentation under certain conditions. For details, see the
83 file COPYING in the PDL distribution. If this file is separated from
84 the PDL distribution, the copyright notice should be included in the
85 file.
86
87
88
89perl v5.28.0 2018-07-23 ImageRGB(3)