1mlib_ImageHistogram2(3MLIB)mediaLib Library Functionsmlib_ImageHistogram2(3MLIB)
2
3
4
6 mlib_ImageHistogram2 - histogram
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageHistogram2(mlib_s32 **histo, const mlib_image *img,
13 const mlib_s32 *numBins, const mlib_s32 *lowValue,
14 const mlib_s32 *highValue, mlib_s32 xStart, mlib_s32 yStart,
15 mlib_s32 xPeriod, mlib_s32 yPeriod);
16
17
19 The mlib_ImageHistogram2() function creates a histogram by scanning an
20 image, counting the number of pixels within a given range for each
21 channel of the image, and then generating a histogram.
22
23
24 The image can have 1, 2, 3 or 4 channels. The data type of the image
25 can be MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, or MLIB_INT. The histogram
26 must have the same number of channels as the image has.
27
28
29 One entry of the histogram, or a bin, is used to accumulate the number
30 of pixels within a certain sub-range. The legal pixel range and the
31 number of bins may be controlled separately.
32
33
34 If binWidth is defined as (highValue - lowValue )/numBins then bin i
35 counts pixel values in the following range:
36
37 lowValue + i*binWidth ≤ x < lowValue + (i + 1)*binWidth
38
39
40
41 The set of pixels scanned may furthermore be reduced by specifying xPe‐
42 riod and yPeriod parameters that specify the sampling rate along each
43 axis.
44
45
46 The set of pixels to be accumulated may be obtained from the following
47 equation:
48
49 x = xStart + p*xPeriod; 0 ≤ p < (w - xStart)/xPeriod
50 y = yStart + q*yPeriod; 0 ≤ q < (h - yStart)/yPeriod
51
52
53
54 It is the user's responsibility to clear the histogram table before
55 this function is called and to ensure that the histogram table supplied
56 is suitable for the source image and the parameters. Otherwise, the
57 result of this function is undefined.
58
59
60 The range from lowValue[k] to (highValue[k] - 1) must be a valid sub‐
61 range of the image type range.
62
64 The function takes the following arguments:
65
66 histo Pointer to histogram. The format of the histogram is
67 histo[channel][index]. The index values for channel i can
68 be 0, 1, ..., numBins[i]-1.
69
70
71 img Pointer to source image.
72
73
74 numBins The number of bins for each channel of the image.
75
76
77 lowValue The lowest pixel value checked for each channel.
78
79
80 highValue The highest pixel value checked for each channel. When
81 counting the pixel values, highValue is not included.
82
83
84 xStart The initial X sample coordinate.
85
86
87 yStart The initial Y sample coordinate.
88
89
90 xPeriod The X sampling rate. xPeriod ≥ 1.
91
92
93 yPeriod The Y sampling rate. yPeriod ≥ 1.
94
95
97 The function returns MLIB_SUCCESS if successful. Otherwise it returns
98 MLIB_FAILURE.
99
101 See attributes(5) for descriptions of the following attributes:
102
103
104
105
106 ┌─────────────────────────────┬─────────────────────────────┐
107 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │Interface Stability │Committed │
110 ├─────────────────────────────┼─────────────────────────────┤
111 │MT-Level │MT-Safe │
112 └─────────────────────────────┴─────────────────────────────┘
113
115 mlib_ImageHistogram(3MLIB), attributes(5)
116
117
118
119SunOS 5.11 2 Mar 2007 mlib_ImageHistogram2(3MLIB)