1. Why should I introduce the HSI color model?
< Span style= "Font-size:16px;margin:0px;padding:0px;line-height:1.8;color:rgb (68,68,68); Background-color:rgb ( 0,176,80); " > hue
saturation and the larger the more vivid);
Brightness : is a subjective factor, which is actually not measurable (brightness and image grayscale is the luminance of the color).
In general, the RGB model is more suitable for image color generation, and the HSI model is suitable for image description.
2. Conversion from RGB to HSI
The component of the RGB mode is defined as a cell on a cube, and the HSI model is defined in a color triangle as follows.
For a primary RGB color image, each RGB pixel can be used as the following formula to find the HSI component:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8C/1A/wKioL1hiTX2TNk7yAAKtepdcILU607.jpg-wh_500x0-wm_3 -wmp_4-s_2981022360.jpg "title=" RGB turn hsi.jpg "width=" "height=" 299 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width : 500px;height:299px; "alt=" Wkiol1hitx2tnk7yaaktepdcilu607.jpg-wh_50 "/>
HSI Color space Model:
650) this.width=650; "Src=" https://imgsa.baidu.com/baike/w%3D268/sign=6c97aaeb8418367aad8978db16718b68/ F603918fa0ec08fa8dfb74655bee3d6d54fbda7d.jpg "alt=" f603918fa0ec08fa8dfb74655bee3d6d54fbda7d "/>
Code 1-1-1:HSV Channel Separation
//converted to HSI
Cv::mat img_h, img_s, Img_v, IMGHSV ;
Std::vector<cv::mat> Hsv_vec;
Cv::cvtcolor (SRCIMAGE,IMGHSV, CV_BGR2HSV);
Cv::imshow ("HSV", IMGHSV);
Cv::waitkey (0);
//split HSV Channel
Cv::split (Imghsv,hsv_vec);
IMG_H=HSV_VEC[0];
Img_s=hsv_vec[1];
Img_v=hsv_vec[2];
//Conversion channel data type
Img_h.convertto (img_h,cv_32f);
Img_s.convertto (img_s,cv_32f);
Img_v.convertto (img_v,cv_32f);
//Calculate the maximum value for each channel
double max_h,max_s,max_v;
Cv::minmaxidx (Img_h,0,&max_h);
Cv::minmaxidx (img_s,0,&max_s);
Cv::minmaxidx (IMG_V,0,&MAX_V);
//Each channel normalized
Img_h/=max_h;
img_s/=max_s;
Img_v/=max_v;
Conclusion: The H, S and I components are calculated by the formula to obtain the image. The above image (car license plate recognition) can be analyzed, compared to the original RGB image, HSI Image Color Information utilization is higher, more suitable for target analysis and target segmentation and other scenarios.
This article is from the "Joe Tech" blog, so be sure to keep this source http://joekeji.blog.51cto.com/12424130/1886663
The introduction of HSI color model and RGB turn HSI?