14 #define ENABLE_FLOAT_PRECISION
24 #define RGB2GRAY(R, G, B) \
25 ((unsigned char)((5120L*(long)B+(((long)G)<<14)+11264L*(long)R)>>15))
29 #define DEFAULT_GAMMA 2.2f
34 #define RGB_WHITE_PT 255.0f
37 #define LAB_F(x) ((x > 0.008856f) ? (float)pow(x, 1.0/3.0) : \
38 7.787f*x+16.0f/116.0f)
43 #define XYZ_00 0.4124f
44 #define XYZ_01 0.3576f
45 #define XYZ_02 0.1805f
47 #define XYZ_10 0.2126f
48 #define XYZ_11 0.7152f
49 #define XYZ_12 0.0722f
51 #define XYZ_20 0.0193f
52 #define XYZ_21 0.1192f
53 #define XYZ_22 0.9505f
61 void BGR2Gray(
unsigned char* pInBuf,
unsigned char* pOutBuf,
62 const int& Width,
const int& Height);
70 void BGR2LAB(
float* pInBuf,
float* pOutBuf,
71 const int& Width,
const int& Height,
74 void BGR2L(
unsigned char* pInBuf,
float* pOutBuf,
75 const int& Width,
const int& Height,
84 #ifdef ENABLE_FLOAT_PRECISION
85 void BGR2Srg(
float* pInBuf,
float* pOutBuf,
86 const int& Width,
const int& Height);
88 void BGR2Srg(
unsigned char* pInBuf,
float* pOutBuf,
89 const int& Width,
const int& Height);
98 const int& Width,
const int& Height) {
99 T *pI = pIn, *pO1 = pOut1, *pO2 = pOut2, *pO3 = pOut3;
100 for (
int y = 0; y < Height; y++) {
101 for (
int x = 0;
x < Width;
x++) {
102 *pO1++ = *pI++; *pO2++ = *pI++; *pO3++ = *pI++;
void BGR2Srg(float *pInBuf, float *pOutBuf, const int &Width, const int &Height)
Definition: colorconv.cpp:149
void BGR2LAB(float *pInBuf, float *pOutBuf, const int &Width, const int &Height, const float &Gamma=DEFAULT_GAMMA)
Definition: colorconv.cpp:46
x
Definition: APPgetLargeConnectedEdges.m:100
void BGR2Gray(unsigned char *pInBuf, unsigned char *pOutBuf, const int &Width, const int &Height)
Definition: colorconv.cpp:30
void Interleaved2Planar(T *pIn, T *pOut1, T *pOut2, T *pOut3, const int &Width, const int &Height)
Definition: colorconv.h:97
#define DEFAULT_GAMMA
Definition: colorconv.h:29
void BGR2L(unsigned char *pInBuf, float *pOutBuf, const int &Width, const int &Height, const float &Gamma=DEFAULT_GAMMA)
Definition: colorconv.cpp:101