Digital Image Processing (1)-image information acquisition and RGB-HSI

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.