![]() |
Leptonica
1.83.1
Image processing and image analysis suite
|
#include <string.h>
#include <math.h>
#include "allheaders.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_HISTO 0 |
#define | SLOW_CUBE_ROOT 0 |
Functions | |
static l_float32 | lab_forward (l_float32 v) |
static l_float32 | lab_reverse (l_float32 v) |
PIX * | pixConvertRGBToHSV (PIX *pixd, PIX *pixs) |
PIX * | pixConvertHSVToRGB (PIX *pixd, PIX *pixs) |
l_ok | convertRGBToHSV (l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *phval, l_int32 *psval, l_int32 *pvval) |
l_ok | convertHSVToRGB (l_int32 hval, l_int32 sval, l_int32 vval, l_int32 *prval, l_int32 *pgval, l_int32 *pbval) |
l_ok | pixcmapConvertRGBToHSV (PIXCMAP *cmap) |
l_ok | pixcmapConvertHSVToRGB (PIXCMAP *cmap) |
PIX * | pixConvertRGBToHue (PIX *pixs) |
PIX * | pixConvertRGBToSaturation (PIX *pixs) |
PIX * | pixConvertRGBToValue (PIX *pixs) |
PIX * | pixMakeRangeMaskHS (PIX *pixs, l_int32 huecenter, l_int32 huehw, l_int32 satcenter, l_int32 sathw, l_int32 regionflag) |
PIX * | pixMakeRangeMaskHV (PIX *pixs, l_int32 huecenter, l_int32 huehw, l_int32 valcenter, l_int32 valhw, l_int32 regionflag) |
PIX * | pixMakeRangeMaskSV (PIX *pixs, l_int32 satcenter, l_int32 sathw, l_int32 valcenter, l_int32 valhw, l_int32 regionflag) |
PIX * | pixMakeHistoHS (PIX *pixs, l_int32 factor, NUMA **pnahue, NUMA **pnasat) |
PIX * | pixMakeHistoHV (PIX *pixs, l_int32 factor, NUMA **pnahue, NUMA **pnaval) |
PIX * | pixMakeHistoSV (PIX *pixs, l_int32 factor, NUMA **pnasat, NUMA **pnaval) |
l_ok | pixFindHistoPeaksHSV (PIX *pixs, l_int32 type, l_int32 width, l_int32 height, l_int32 npeaks, l_float32 erasefactor, PTA **ppta, NUMA **pnatot, PIXA **ppixa) |
PIX * | displayHSVColorRange (l_int32 hval, l_int32 sval, l_int32 vval, l_int32 huehw, l_int32 sathw, l_int32 nsamp, l_int32 factor) |
PIX * | pixConvertRGBToYUV (PIX *pixd, PIX *pixs) |
PIX * | pixConvertYUVToRGB (PIX *pixd, PIX *pixs) |
l_ok | convertRGBToYUV (l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pyval, l_int32 *puval, l_int32 *pvval) |
l_ok | convertYUVToRGB (l_int32 yval, l_int32 uval, l_int32 vval, l_int32 *prval, l_int32 *pgval, l_int32 *pbval) |
l_ok | pixcmapConvertRGBToYUV (PIXCMAP *cmap) |
l_ok | pixcmapConvertYUVToRGB (PIXCMAP *cmap) |
FPIXA * | pixConvertRGBToXYZ (PIX *pixs) |
PIX * | fpixaConvertXYZToRGB (FPIXA *fpixa) |
l_ok | convertRGBToXYZ (l_int32 rval, l_int32 gval, l_int32 bval, l_float32 *pfxval, l_float32 *pfyval, l_float32 *pfzval) |
l_ok | convertXYZToRGB (l_float32 fxval, l_float32 fyval, l_float32 fzval, l_int32 blackout, l_int32 *prval, l_int32 *pgval, l_int32 *pbval) |
FPIXA * | fpixaConvertXYZToLAB (FPIXA *fpixas) |
FPIXA * | fpixaConvertLABToXYZ (FPIXA *fpixas) |
l_ok | convertXYZToLAB (l_float32 xval, l_float32 yval, l_float32 zval, l_float32 *plval, l_float32 *paval, l_float32 *pbval) |
l_ok | convertLABToXYZ (l_float32 lval, l_float32 aval, l_float32 bval, l_float32 *pxval, l_float32 *pyval, l_float32 *pzval) |
FPIXA * | pixConvertRGBToLAB (PIX *pixs) |
PIX * | fpixaConvertLABToRGB (FPIXA *fpixa) |
l_ok | convertRGBToLAB (l_int32 rval, l_int32 gval, l_int32 bval, l_float32 *pflval, l_float32 *pfaval, l_float32 *pfbval) |
l_ok | convertLABToRGB (l_float32 flval, l_float32 faval, l_float32 fbval, l_int32 *prval, l_int32 *pgval, l_int32 *pbval) |
PIX * | pixMakeGamutRGB (l_int32 scale) |
Colorspace conversion between RGB and HSV PIX *pixConvertRGBToHSV() PIX *pixConvertHSVToRGB() l_int32 convertRGBToHSV() l_int32 convertHSVToRGB() l_int32 pixcmapConvertRGBToHSV() l_int32 pixcmapConvertHSVToRGB() PIX *pixConvertRGBToHue() PIX *pixConvertRGBToSaturation() PIX *pixConvertRGBToValue() Selection and display of range of colors in HSV space PIX *pixMakeRangeMaskHS() PIX *pixMakeRangeMaskHV() PIX *pixMakeRangeMaskSV() PIX *pixMakeHistoHS() PIX *pixMakeHistoHV() PIX *pixMakeHistoSV() PIX *pixFindHistoPeaksHSV() PIX *displayHSVColorRange() Colorspace conversion between RGB and YUV PIX *pixConvertRGBToYUV() PIX *pixConvertYUVToRGB() l_int32 convertRGBToYUV() l_int32 convertYUVToRGB() l_int32 pixcmapConvertRGBToYUV() l_int32 pixcmapConvertYUVToRGB() Colorspace conversion between RGB and XYZ FPIXA *pixConvertRGBToXYZ() PIX *fpixaConvertXYZToRGB() l_int32 convertRGBToXYZ() l_int32 convertXYZToRGB() Colorspace conversion between XYZ and LAB FPIXA *fpixaConvertXYZToLAB() PIX *fpixaConvertLABToXYZ() l_int32 convertXYZToLAB() l_int32 convertLABToXYZ() static l_float32 lab_forward() static l_float32 lab_reverse() Colorspace conversion between RGB and LAB FPIXA *pixConvertRGBToLAB() PIX *fpixaConvertLABToRGB() l_int32 convertRGBToLAB() l_int32 convertLABToRGB() Gamut display of RGB color space PIX *pixMakeGamutRGB()
Definition in file colorspace.c.
l_ok convertHSVToRGB | ( | l_int32 | hval, |
l_int32 | sval, | ||
l_int32 | vval, | ||
l_int32 * | prval, | ||
l_int32 * | pgval, | ||
l_int32 * | pbval | ||
) |
[in] | hval,sval,vval | HSV input |
[out] | prval,pgval,pbval | comparable RGB values |
Notes: (1) See convertRGBToHSV() for valid input range of HSV values and their interpretation in color space.
Definition at line 337 of file colorspace.c.
Referenced by displayHSVColorRange(), and pixcmapConvertHSVToRGB().
l_ok convertLABToRGB | ( | l_float32 | flval, |
l_float32 | faval, | ||
l_float32 | fbval, | ||
l_int32 * | prval, | ||
l_int32 * | pgval, | ||
l_int32 * | pbval | ||
) |
[in] | flval,faval,fbval | input lab |
[out] | prval,pgval,pbval | equivalent rgb values |
Notes: (1) For values of lab that are out of gamut for rgb, the rgb components are set to the closest valid color.
Definition at line 2334 of file colorspace.c.
References convertLABToXYZ(), and convertXYZToRGB().
l_ok convertLABToXYZ | ( | l_float32 | lval, |
l_float32 | aval, | ||
l_float32 | bval, | ||
l_float32 * | pxval, | ||
l_float32 * | pyval, | ||
l_float32 * | pzval | ||
) |
[in] | lval,aval,bval | input lab |
[out] | pxval,pyval,pzval | equivalent xyz values |
Definition at line 2096 of file colorspace.c.
Referenced by convertLABToRGB(), and fpixaConvertLABToXYZ().
l_ok convertRGBToHSV | ( | l_int32 | rval, |
l_int32 | gval, | ||
l_int32 | bval, | ||
l_int32 * | phval, | ||
l_int32 * | psval, | ||
l_int32 * | pvval | ||
) |
[in] | rval,gval,bval | RGB input |
[out] | phval,psval,pvval | comparable HSV values |
Notes: (1) The range of returned values is: h [0 ... 239] s [0 ... 255] v [0 ... 255] (2) If r = g = b, the pixel is gray (s = 0), and we define h = 0. (3) h wraps around, so that h = 0 and h = 240 are equivalent in hue space. (4) h has the following correspondence to color: h = 0 magenta h = 40 red h = 80 yellow h = 120 green h = 160 cyan h = 200 blue
Definition at line 277 of file colorspace.c.
Referenced by pixcmapConvertRGBToHSV().
l_ok convertRGBToLAB | ( | l_int32 | rval, |
l_int32 | gval, | ||
l_int32 | bval, | ||
l_float32 * | pflval, | ||
l_float32 * | pfaval, | ||
l_float32 * | pfbval | ||
) |
[in] | rval,gval,bval | rgb input |
[out] | pflval,pfaval,pfbval | equivalent lab values |
Notes: (1) These conversions are for illuminant D65 acting on linear sRGB values.
Definition at line 2299 of file colorspace.c.
References convertRGBToXYZ(), and convertXYZToLAB().
l_ok convertRGBToXYZ | ( | l_int32 | rval, |
l_int32 | gval, | ||
l_int32 | bval, | ||
l_float32 * | pfxval, | ||
l_float32 * | pfyval, | ||
l_float32 * | pfzval | ||
) |
[in] | rval,gval,bval | rgb input |
[out] | pfxval,pfyval,pfzval | equivalent xyz values |
Notes: (1) These conversions are for illuminant D65 acting on linear sRGB values.
Definition at line 1836 of file colorspace.c.
Referenced by convertRGBToLAB().
l_ok convertRGBToYUV | ( | l_int32 | rval, |
l_int32 | gval, | ||
l_int32 | bval, | ||
l_int32 * | pyval, | ||
l_int32 * | puval, | ||
l_int32 * | pvval | ||
) |
[in] | rval,gval,bval | RGB input |
[out] | pyval,puval,pvval | equivalent YUV values |
Notes: (1) The range of returned values is: Y [16 ... 235] U [16 ... 240] V [16 ... 240]
Definition at line 1551 of file colorspace.c.
Referenced by pixcmapConvertRGBToYUV().
l_ok convertXYZToLAB | ( | l_float32 | xval, |
l_float32 | yval, | ||
l_float32 | zval, | ||
l_float32 * | plval, | ||
l_float32 * | paval, | ||
l_float32 * | pbval | ||
) |
[in] | xval,yval,zval | input xyz |
[out] | plval,paval,pbval | equivalent lab values |
Definition at line 2058 of file colorspace.c.
Referenced by convertRGBToLAB(), and fpixaConvertXYZToLAB().
l_ok convertXYZToRGB | ( | l_float32 | fxval, |
l_float32 | fyval, | ||
l_float32 | fzval, | ||
l_int32 | blackout, | ||
l_int32 * | prval, | ||
l_int32 * | pgval, | ||
l_int32 * | pbval | ||
) |
[in] | fxval,fyval,fzval | |
[in] | blackout | 0 to output nearest color if out of gamut; 1 to output black |
[out] | prval,pgval,pbval | 32 bpp rgb values |
Notes: (1) For values of xyz that are out of gamut for rgb, at least one of the r, g or b components will be either less than 0 or greater than 255. For that situation: * if blackout == 0, the individual component(s) that are out of gamut will be set to 0 or 255, respectively. * if blackout == 1, the output color will be set to black
Definition at line 1876 of file colorspace.c.
Referenced by convertLABToRGB().
l_ok convertYUVToRGB | ( | l_int32 | yval, |
l_int32 | uval, | ||
l_int32 | vval, | ||
l_int32 * | prval, | ||
l_int32 * | pgval, | ||
l_int32 * | pbval | ||
) |
[in] | yval,uval,vval | YUV input |
[out] | prval,pgval,pbval | equivalent RGB values |
Notes: (1) The range of valid input values is: Y [16 ... 235] U [16 ... 240] V [16 ... 240] (2) Conversion of RGB --> YUV --> RGB leaves the image unchanged. (3) The YUV gamut is larger than the RBG gamut; many YUV values will result in an invalid RGB value. We clip individual r,g,b components to the range [0, 255], and do not test input.
Definition at line 1597 of file colorspace.c.
Referenced by pixcmapConvertYUVToRGB().
PIX* displayHSVColorRange | ( | l_int32 | hval, |
l_int32 | sval, | ||
l_int32 | vval, | ||
l_int32 | huehw, | ||
l_int32 | sathw, | ||
l_int32 | nsamp, | ||
l_int32 | factor | ||
) |
[in] | hval | hue center value; in range [0 ... 240] |
[in] | sval | saturation center value; in range [0 ... 255] |
[in] | vval | max intensity value; in range [0 ... 255] |
[in] | huehw | half-width of hue range; > 0 |
[in] | sathw | half-width of saturation range; > 0 |
[in] | nsamp | number of samplings in each half-width in hue and sat |
[in] | factor | linear size of each color square, in pixels; > 3 |
Notes: (1) The total number of color samplings in each of the hue and saturation directions is 2 * nsamp + 1.
Definition at line 1353 of file colorspace.c.
References convertHSVToRGB(), pixCreate(), pixDestroy(), pixExpandReplicate(), and pixSetRGBPixel().
[in] | fpixa | three fpix: l,a,b |
Notes: (1) The lab image is stored in three fpix.
Definition at line 2243 of file colorspace.c.
References fpixaGetCount(), fpixaGetFPixDimensions(), and pixCreate().
[in] | fpixas | lab |
Notes: (1) The input [l,a,b] and output [x,y,z] values are stored as float values, each set in three fpix.
Definition at line 1999 of file colorspace.c.
References convertLABToXYZ(), fpixaAddFPix(), fpixaCreate(), fpixaGetCount(), fpixaGetData(), fpixaGetFPixDimensions(), fpixCreate(), fpixGetWpl(), and L_INSERT.
[in] | fpixas | xyz |
Notes: (1) The input [x,y,z] and output [l,a,b] values are stored as float values, each set in three fpix. (2) The CIE LAB color space was invented in 1976, as an absolute reference for specifying colors that we can perceive, independently of the rendering device. It was invented to align color display and print images. For information, see: http://www.brucelindbloom.com/ http://en.wikipedia.org/wiki/Lab_color_space
Definition at line 1935 of file colorspace.c.
References convertXYZToLAB(), fpixaAddFPix(), fpixaCreate(), fpixaGetCount(), fpixaGetData(), fpixaGetFPixDimensions(), fpixCreate(), fpixGetWpl(), and L_INSERT.
[in] | fpixa | three fpix: x,y,z |
Notes: (1) The xyz image is stored in three fpix. (2) For values of xyz that are out of gamut for rgb, the rgb components are set to the closest valid color.
Definition at line 1780 of file colorspace.c.
References fpixaGetCount(), fpixaGetFPixDimensions(), and pixCreate().
l_ok pixcmapConvertHSVToRGB | ( | PIXCMAP * | cmap | ) |
[in] | cmap |
Notes: ~ in-place transform ~ See convertRGBToHSV() for def'n of HSV space. ~ replaces: h --> r, s --> g, v --> b
Definition at line 455 of file colorspace.c.
References convertHSVToRGB(), pixcmapGetColor(), pixcmapGetCount(), and pixcmapResetColor().
l_ok pixcmapConvertRGBToHSV | ( | PIXCMAP * | cmap | ) |
[in] | cmap |
Notes: ~ in-place transform ~ See convertRGBToHSV() for def'n of HSV space. ~ replaces: r --> h, g --> s, b --> v
Definition at line 424 of file colorspace.c.
References convertRGBToHSV(), pixcmapGetColor(), pixcmapGetCount(), and pixcmapResetColor().
l_ok pixcmapConvertRGBToYUV | ( | PIXCMAP * | cmap | ) |
[in] | cmap |
Notes: ~ in-place transform ~ See convertRGBToYUV() for def'n of YUV space. ~ replaces: r --> y, g --> u, b --> v
Definition at line 1643 of file colorspace.c.
References convertRGBToYUV(), pixcmapGetColor(), pixcmapGetCount(), and pixcmapResetColor().
l_ok pixcmapConvertYUVToRGB | ( | PIXCMAP * | cmap | ) |
[in] | cmap |
Notes: ~ in-place transform ~ See convertRGBToYUV() for def'n of YUV space. ~ replaces: y --> r, u --> g, v --> b
Definition at line 1674 of file colorspace.c.
References convertYUVToRGB(), pixcmapGetColor(), pixcmapGetCount(), and pixcmapResetColor().
[in] | pixd | can be NULL; if not NULL, must == pixs |
[in] | pixs |
Notes: (1) For pixs = pixd, this is in-place; otherwise pixd must be NULL. (2) The user takes responsibility for making sure that pixs is in our HSV space. The definition of our HSV space is given in convertRGBToHSV(). (3) The h, s and v values are stored in the same places as the r, g and b values, respectively. Here, they are explicitly placed in the 3 MS bytes in the pixel.
Definition at line 204 of file colorspace.c.
[in] | pixd | can be NULL; if not NULL, must == pixs |
[in] | pixs |
Notes: (1) For pixs = pixd, this is in-place; otherwise pixd must be NULL. (2) The definition of our HSV space is given in convertRGBToHSV(). (3) The h, s and v values are stored in the same places as the r, g and b values, respectively. Here, they are explicitly placed in the 3 MS bytes in the pixel. (4) Normalizing to 1 and considering the r,g,b components, a simple way to understand the HSV space is: ~ v = max(r,g,b) ~ s = (max - min) / max ~ h ~ (mid - min) / (max - min) [apart from signs and constants] (5) Normalizing to 1, some properties of the HSV space are: ~ For gray values (r = g = b) along the continuum between black and white: s = 0 (becoming undefined as you approach black) h is undefined everywhere ~ Where one component is saturated and the others are zero: v = 1 s = 1 h = 0 (r = max), 1/3 (g = max), 2/3 (b = max) ~ Where two components are saturated and the other is zero: v = 1 s = 1 h = 1/2 (if r = 0), 5/6 (if g = 0), 1/6 (if b = 0) (6) Dividing each component by a constant c > 1 reduces the brightness v, but leaves the saturation and hue invariant.
Definition at line 142 of file colorspace.c.
[in] | pixs | 32 bpp RGB, or 8 bpp with colormap |
Notes: (1) The conversion to HSV hue is in-lined here. (2) If there is a colormap, it is removed. (3) If you just want the hue component, this does it at about 10 Mpixels/sec/GHz, which is about 2x faster than using pixConvertRGBToHSV()
Definition at line 488 of file colorspace.c.
References pixGetDimensions().
[in] | pixs | 32 bpp rgb |
Notes: (1) The [l,a,b] values are stored as float values in three fpix that are returned in a fpixa.
Definition at line 2188 of file colorspace.c.
[in] | pixs | 32 bpp RGB, or 8 bpp with colormap |
Notes: (1) The conversion to HSV sat is in-lined here. (2) If there is a colormap, it is removed. (3) If you just want the saturation component, this does it at about 12 Mpixels/sec/GHz.
Definition at line 562 of file colorspace.c.
References pixGetDimensions().
[in] | pixs | 32 bpp RGB,or 8 bpp with colormap |
Notes: (1) The conversion to HSV sat is in-lined here. (2) If there is a colormap, it is removed. (3) If you just want the value component, this does it at about 35 Mpixels/sec/GHz.
Definition at line 625 of file colorspace.c.
References pixGetDimensions().
[in] | pixs | 32 bpp rgb |
Notes: (1) The [x,y,z] values are stored as float values in three fpix that are returned in a fpixa. (2) The XYZ color space was defined in 1931 as a reference model that simulates human color perception. When Y is taken as luminance, the values of X and Z constitute a color plane representing all the hues that can be perceived. This gamut of colors is larger than the gamuts that can be displayed or printed. For example, although all rgb values map to XYZ, the converse is not true. (3) The value of the coefficients depends on the illuminant. We use coefficients for converting sRGB under D65 (the spectrum from a 6500 degree K black body; an approximation to daylight color). See, e.g., http://www.cs.rit.edu/~ncs/color/t_convert.html For more general information on color transforms, see: http://www.brucelindbloom.com/ http://user.engineering.uiowa.edu/~aip/Misc/ColorFAQ.html http://en.wikipedia.org/wiki/CIE_1931_color_space
Definition at line 1723 of file colorspace.c.
[in] | pixd | can be NULL; if not NULL, must == pixs |
[in] | pixs |
Notes: (1) For pixs = pixd, this is in-place; otherwise pixd must be NULL. (2) The Y, U and V values are stored in the same places as the r, g and b values, respectively. Here, they are explicitly placed in the 3 MS bytes in the pixel. (3) Normalizing to 1 and considering the r,g,b components, a simple way to understand the YUV space is: ~ Y = weighted sum of (r,g,b) ~ U = weighted difference between Y and B ~ V = weighted difference between Y and R (4) Following video conventions, Y, U and V are in the range: Y: [16, 235] U: [16, 240] V: [16, 240] (5) For the coefficients in the transform matrices, see eq. 4 in "Frequently Asked Questions about Color" by Charles Poynton, //http://user.engineering.uiowa.edu/~aip/Misc/ColorFAQ.html
Definition at line 1427 of file colorspace.c.
[in] | pixd | can be NULL; if not NULL, must == pixs |
[in] | pixs |
Notes: (1) For pixs = pixd, this is in-place; otherwise pixd must be NULL. (2) The user takes responsibility for making sure that pixs is in YUV space. (3) The Y, U and V values are stored in the same places as the r, g and b values, respectively. Here, they are explicitly placed in the 3 MS bytes in the pixel.
Definition at line 1488 of file colorspace.c.
l_ok pixFindHistoPeaksHSV | ( | PIX * | pixs, |
l_int32 | type, | ||
l_int32 | width, | ||
l_int32 | height, | ||
l_int32 | npeaks, | ||
l_float32 | erasefactor, | ||
PTA ** | ppta, | ||
NUMA ** | pnatot, | ||
PIXA ** | ppixa | ||
) |
[in] | pixs | 32 bpp; HS, HV or SV histogram; not changed |
[in] | type | L_HS_HISTO, L_HV_HISTO or L_SV_HISTO |
[in] | width | half width of sliding window |
[in] | height | half height of sliding window |
[in] | npeaks | number of peaks to look for |
[in] | erasefactor | ratio of erase window size to sliding window size |
[out] | ppta | locations of max for each integrated peak area |
[out] | pnatot | integrated peak areas |
[out] | ppixa | [optional] pixa for debugging; NULL to skip |
Notes: (1) pixs is a 32 bpp histogram in a pair of HSV colorspace. It should be thought of as a single sample with 32 bps (bits/sample). (2) After each peak is found, the peak is erased with a window that is centered on the peak and scaled from the sliding window by erasefactor. Typically, erasefactor is chosen to be > 1.0. (3) Data for a maximum of npeaks is returned in pta and natot. (4) For debugging, after the pixa is returned, display with: pixd = pixaDisplayTiledInRows(pixa, 32, 1000, 1.0, 0, 30, 2);
Definition at line 1231 of file colorspace.c.
PIX* pixMakeGamutRGB | ( | l_int32 | scale | ) |
[in] | scale | default = 4 |
Notes: (1) This is an image that has all RGB colors, divided into 2^15 cubical cells with 8x8x8 = 512 pixel values. Each of the 32 subimages has a constant value of B, with R and G varying over their gamut in 32 steps of size 8. (2) The scale parameter determines the replication in both x and y of each of the 2^15 colors. With a scale factor of 4, the output image has 4 * 4 * 2^15 = 0.5M pixels. (3) This useful for visualizing how filters, such as pixMakeArbMaskFromRGB(), separate colors into sets.
Definition at line 2378 of file colorspace.c.
References composeRGBPixel(), L_INSERT, pixaAddPix(), pixaCreate(), pixaDestroy(), pixaDisplayTiledInColumns(), pixCreate(), and pixSetPixel().
[in] | pixs | HSV colorspace |
[in] | factor | subsampling factor; integer |
[out] | pnahue | [optional] hue histogram |
[out] | pnasat | [optional] saturation histogram |
Notes: (1) pixs is a 32 bpp image in HSV colorspace; hue is in the "red" byte, saturation is in the "green" byte. (2) In pixd, hue is displayed vertically; saturation horizontally. The dimensions of pixd are w = 256, h = 240, and the depth is 32 bpp. The value at each point is simply the number of pixels found at that value of hue and saturation.
Definition at line 972 of file colorspace.c.
[in] | pixs | HSV colorspace |
[in] | factor | subsampling factor; integer |
[out] | pnahue | [optional] hue histogram |
[out] | pnaval | [optional] max intensity (value) histogram |
Notes: (1) pixs is a 32 bpp image in HSV colorspace; hue is in the "red" byte, max intensity ("value") is in the "blue" byte. (2) In pixd, hue is displayed vertically; intensity horizontally. The dimensions of pixd are w = 256, h = 240, and the depth is 32 bpp. The value at each point is simply the number of pixels found at that value of hue and intensity.
Definition at line 1061 of file colorspace.c.
[in] | pixs | HSV colorspace |
[in] | factor | subsampling factor; integer |
[out] | pnasat | [optional] sat histogram |
[out] | pnaval | [optional] max intensity (value) histogram |
Notes: (1) pixs is a 32 bpp image in HSV colorspace; sat is in the "green" byte, max intensity ("value") is in the "blue" byte. (2) In pixd, sat is displayed vertically; intensity horizontally. The dimensions of pixd are w = 256, h = 256, and the depth is 32 bpp. The value at each point is simply the number of pixels found at that value of saturation and intensity.
Definition at line 1142 of file colorspace.c.
PIX* pixMakeRangeMaskHS | ( | PIX * | pixs, |
l_int32 | huecenter, | ||
l_int32 | huehw, | ||
l_int32 | satcenter, | ||
l_int32 | sathw, | ||
l_int32 | regionflag | ||
) |
[in] | pixs | 32 bpp rgb |
[in] | huecenter | center value of hue range |
[in] | huehw | half-width of hue range |
[in] | satcenter | center value of saturation range |
[in] | sathw | half-width of saturation range |
[in] | regionflag | L_INCLUDE_REGION, L_EXCLUDE_REGION |
Notes: (1) The pixels are selected based on the specified ranges of hue and saturation. For selection or exclusion, the pixel HS component values must be within both ranges. Care must be taken in finding the hue range because of wrap-around. (2) Use regionflag == L_INCLUDE_REGION to take only those pixels within the rectangular region specified in HS space. Use regionflag == L_EXCLUDE_REGION to take all pixels except those within the rectangular region specified in HS space.
Definition at line 692 of file colorspace.c.
PIX* pixMakeRangeMaskHV | ( | PIX * | pixs, |
l_int32 | huecenter, | ||
l_int32 | huehw, | ||
l_int32 | valcenter, | ||
l_int32 | valhw, | ||
l_int32 | regionflag | ||
) |
[in] | pixs | 32 bpp rgb |
[in] | huecenter | center value of hue range |
[in] | huehw | half-width of hue range |
[in] | valcenter | center value of max intensity range |
[in] | valhw | half-width of max intensity range |
[in] | regionflag | L_INCLUDE_REGION, L_EXCLUDE_REGION |
Notes: (1) The pixels are selected based on the specified ranges of hue and max intensity values. For selection or exclusion, the pixel HV component values must be within both ranges. Care must be taken in finding the hue range because of wrap-around. (2) Use regionflag == L_INCLUDE_REGION to take only those pixels within the rectangular region specified in HV space. Use regionflag == L_EXCLUDE_REGION to take all pixels except those within the rectangular region specified in HV space.
Definition at line 789 of file colorspace.c.
PIX* pixMakeRangeMaskSV | ( | PIX * | pixs, |
l_int32 | satcenter, | ||
l_int32 | sathw, | ||
l_int32 | valcenter, | ||
l_int32 | valhw, | ||
l_int32 | regionflag | ||
) |
[in] | pixs | 32 bpp rgb |
[in] | satcenter | center value of saturation range |
[in] | sathw | half-width of saturation range |
[in] | valcenter | center value of max intensity range |
[in] | valhw | half-width of max intensity range |
[in] | regionflag | L_INCLUDE_REGION, L_EXCLUDE_REGION |
Notes: (1) The pixels are selected based on the specified ranges of saturation and max intensity (val). For selection or exclusion, the pixel SV component values must be within both ranges. (2) Use regionflag == L_INCLUDE_REGION to take only those pixels within the rectangular region specified in SV space. Use regionflag == L_EXCLUDE_REGION to take all pixels except those within the rectangular region specified in SV space.
Definition at line 885 of file colorspace.c.