1IM_HISTGR(3) Library Functions Manual IM_HISTGR(3)
2
3
4
6 im_histcum, im_histeq, im_histgr, im_histnD, im_histnorm, im_histspec,
7 im_identity, im_identity_ushort, im_ismonotonic - create, display and
8 process histograms or luts
9
11 #include <vips/vips.h>
12
13 int im_histgr( in, out, bandno)
14 IMAGE *in, *out;
15 int bandno;
16
17 int im_histnD( in, out, bins )
18 IMAGE *in, *out;
19 int bins;
20
21 int im_histcum(hist, lut)
22 IMAGE *hist, *lut;
23
24 int im_histnorm(hist, lut)
25 IMAGE *hist, *lut;
26
27 int im_histeq(hist, lut)
28 IMAGE *hist, *lut;
29
30 int im_histspec(histin, histref, lut)
31 IMAGE *histin, *histref, *lut;
32
33 int im_identity(lut, bands)
34 IMAGE *lut;
35 int bands;
36
37 int im_identity_ushort(lut, bands, sz)
38 IMAGE *lut;
39 int bands;
40 int sz;
41
42 int im_ismonotonic( IMAGE *lut, int *out )
43
44
46 im_histgr(3) writes the histogram of image in to image out. If bandno
47 is zero, then out will have the same number of bands as in, and each
48 band of out will have the histogram of the corresponding band of in.
49 Otherwise, bandno selects the band of the image for which the histogram
50 will be found.
51
52 Image in may be either FMTUCHAR or FMTUSHORT. If in is uchar, then out
53 will have 256 elements, one for each possible pixel value. If in is
54 ushort, then im_histgr(3) finds the maximum of in, and outputs a his‐
55 togram with max + 1 elements.
56
57 For example, suppose you have an image from a 12-bit camera, where each
58 pixel is in the range [0,4095]. Calling im_histgr(3) for this image
59 will make a histogram with at most 4096 elements. If the histogram is
60 smaller than this, then it means that the right hand end of the his‐
61 togram was all zero, and has not been generated.
62
63 Also check im_histnD(3) below for another way to make histograms.
64
65 im_histnD(3) makes a n-dimensional histogram from an n-band image (1, 2
66 and 3 bands only). Because 3D histograms can get very large very
67 quickly, the bins parameter sets the length of each dimension, that is,
68 the number of bins the possible numeric range of the image is divided
69 into.
70
71 Unsigned 8 and 16 bit images only.
72
73 Use im_histplot(3) to graph the histogram for visualisation. See the
74 separate manpage.
75
76 im_histcum(3) forms a cumulative histogram. It works for any unsigned
77 integer format.
78
79 im_histnorm(3) normalises a histogram. The maximum histogram value
80 becomes equal to the number of pixels in the histogram. In effect, the
81 histogram becomes 'square'. Each channel is normalised separately.
82
83 im_histeq(3) takes as input a histogram held by the IMAGE descriptor
84 hist and creates an unsigned char look up table (held by the IMAGE
85 descriptor lut) which when applied on the original image, (with his‐
86 togram held by hist) histogram equalises it. Histogram equalisation is
87 carried out for each band of hist individually.
88
89 im_histspec(3) creates a lut for transforming an image with histogram
90 held by histin according to the pdf (probability density function) of a
91 reference image with histogram held by histref. histin and histref
92 should have the same number of bands.
93
94 im_identity(3) creates an look-up-table with Xsize=256, Ysize=1,
95 Bands=bands, Bbits=BBBYTE, BandFmt=FMTUCHAR, Type=LUT, which is held by
96 the IMAGE descriptor lut. The created image consist a bands linear
97 (ramp) lut and is the basis for building look-up tables.
98
99 im_identity_ushort(3) creates an look-up-table with Xsize=sz, Ysize=1,
100 Bands=bands, Bbits=BBSHORT, BandFmt=FMTUSHORT, Type=LUT, which is held
101 by the IMAGE descriptor lut. The created image consist of a linear
102 (ramp) lut and is the basis for building look-up tables.
103
104 im_ismonotonic(3) sets out to non-zero if the look-up table (or his‐
105 togram) in lut is monotonic, that is, if it's slope is always >0.
106
107
109 All functions return 0 on success and -1 on error.
110
112 im_hist(3), im_hsp(3), im_heq(3), im_maplut(3), im_tone_map(3),
113 im_histplot(3).
114
116 The National Gallery and Birkbeck College, 1991 - 1994.
117
118
119
120 10 May 1991 IM_HISTGR(3)