Study Dip 70th Day
Reprint please indicate the source of this article:Http://blog.csdn.net/tonyshengtan , out of respect for the work of the author, reprint please indicate the source! Article code is hosted, Welcome to co-development:Https://github.com/Tony-Tan/DIPpro
The opening crap.
To continue the simple introduction of color image processing related knowledge, today to simply say the histogram enhancement in color image application, gray-scale image histogram enhancement has done the relevant introduction, including its mathematical principles.
For the gray image of some algorithms suitable for direct use of the color image of the various channels, there are some unsuitable, histogram equalization is not suitable for a, if directly on each channel, will cause the image hue changes so that the image is not its original appearance, Today we use the histogram equalization to the I component of the HSI color space, and the histogram balances the luminance components, which are enhanced by the brightness and remain constant in saturation and color upward.
Algorithm principle
The principle of the algorithm is to use the characteristics of the HSI color space, I component represents the image brightness, processing will not change the image hue.
Algorithm steps:
1. Conversion from RGB to HSI
2. Separating the HSI space, I components form a separate grayscale image f i Span style= "Display:inline-block; width:0px; Height:2.347em; " >
3. For f i Span style= "Display:inline-block; width:0px; Height:2.347em; " > Perform histogram equalization
4. Replace the original I component data with the balanced data
5. HSI conversion back to RGB
Code
/*********************************************************************************************************************/void Histequalrgb (RGB*src,rgb *Dst,int width,int height) {HSI *temp= (hsi*) malloc (sizeof (HSI) *width*height);Double *chanel_i= (double *) malloc (sizeof (double) *width*height);rgb2hsi (src, temp, width, height);for (int i=0;i<width*height;i++) {chanel_i[i]= (double) ((int) temp[i].c3); }histogramequalization (chanel_i, chanel_i, width, height);for (int i=0;i<width*height;i++) {Temp[i].c3=chanel_i[i]; }Hsi2rgb (temp, DST, width, height);Free (temp);Free (chanel_i);}/*********************************************************************************************************************/
Effect analysis
Here are some pictures of the above algorithm operation, to observe the effect.
Original:
Original I component:
Histogram of the original I component:
After histogram equalization results:
Histogram equalization after histogram:
Results after processing:
Original:
Original I component:
Histogram of the original I component:
After histogram equalization results:
Histogram equalization after histogram:
Results after processing:
Original:
Original I component:
Histogram of the original I component:
After histogram equalization results:
Histogram equalization after histogram:
Results after processing:
Original:
Original I component:
Histogram of the original I component:
After histogram equalization results:
Histogram equalization after histogram:
Results after processing:
Summarize
Overall, the algorithm is stable, fast computing speed, but this is only one of the simplest color image enhancement method, because has decided to do the identification direction, so the color image related to more in-depth color transformation, smoothing, sharpening, segmentation and so on only to do a simple introduction, we have a lot of communication.
Cond...
Color images-enhancement of image enhancement histogram