Digital Image Processing Information Acquisition
Struct RGB
{
Unsigned char B;
Unsigned char g;
Unsigned char R;
};
Lpsrc = (unsigned char *) pdoc-> m_pdib-> m_lpimage +
Llinebytes * (lheight-1-point. Y) + point. x * 3;
RGB;
RGB. B = * lpsrc;
RGB. G = * (lpsrc + 1 );
RGB. r = * (lpsrc + 2 );
Brightness
Int gray = (INT) (0.114 * RGB. R + 0.587 * RGB. G + 0.299 * RGB. B)
RGB to HSI Image Information Acquisition
The encoding is as follows:
R = (double) prgb-> r)/255.0;
G = (double) prgb-> G)/255.0;
B = (double) prgb-> B)/255.0;
Sum = R + G + B;
Phsi-> intensity = sum/3.0;
Minvalue = (r <G )? R: G;
Minvalue = (B <minvalue )? B: minvalue;
Maxvalue = (r> G )? R: G;
Maxvalue = (B> maxvalue )? B: maxvalue;
If (phsi-> intensity <0.00001)
Phsi-> saturation = zero_saturation;
Else
Phsi-> saturation = 1.0-(3.0 * minvalue)/sum;
If (minvalue = maxvalue ){
Phsi-> hue = undefined_hue;
Phsi-> saturation = zero_saturation;
Return;
}
Tempdouble1 = (r-g) + (r-B)/2.0 );
Tempdouble2 = (r-g) * (r-g) + (r-B) * (G-B );
Quotient = (tempdouble1/SQRT (tempdouble2 ));
Radians = ACOs (quotient );
Angle = radians * degrees_per_radian;
Phsi-> hue = (B> G )? 360.0-angle: angle;
Digital Image Processing (1)-image information acquisition and RGB-HSI