Dynamic Weights Equations for Converting Grayscale Image to RGB Image

The method of converting color images from the RGB color system to grayscale images is a simple operation by using the fixed weights method of conversion, but using the same weights to restore the color of the same images is not an effective operation of all types of images because the grayscale image contains little information and it isn't worthy of conversion operation. The basic idea in this paper is to employ the mathematics equations which extracted from grayscale image in conversion operation, this paper presents the method of coloring the grayscale image by using the weights derived from the characteristics of the grayscale image. Skewness, Mean and Standard deviation moments have been extracted from the features of grayscale images and its adoption the determine weights of the RGB color system. This method proved its success in coloring images compared to the traditional method adoption of fixed weights for coloring images because it relies on fixed weights for converting all grayscale images.


Introduction
Colorizing old image (black and white) can be defined as a computer-assisted operation of adding color to monochrome image or movie [1].The color addition to the greyscale images to enhance the visible attraction of the images, such as old black and white image, classic movies or scientific clarification.As well as, the features content of some scientific images can be enhanced with color by utilizing the difference in chromaticity and the luminance in image [2].
While, the color addition isn't easy to do by using hand.The selection of appropriate software to do the colorization process is very important.Many techniques have been found to colorize grayscale image.Software capable of efficiently colorizing a grayscale image given minimal user interaction has been an interesting topic of recent research [3].
The process of "colorizing" a greyscale image achieves appoint three-bands values of one (RGB) pixel to an image which differ along only one band (luminance or intensity).Since various colors may have the same luminance value but change in hue or saturation.The process of colorizing greyscale images has no inseparable "correct" solution [2], [ 4].
Actually, the ways in which grayscale images converted to color images are usually different in results due to the large variation in the percentage of errors that appear in the final result on the one hand or from the person's intervention directly by choosing the colors that are not necessarily identical to the original colors of the image.On the other hand, the features generally utilized to distinguish one color from another are: brightness, hue and saturation.Brightness indicates to intensity [5].

Literature Review
Many ideas and attempts to compete for the most accurate results in order to convert gray images to their original colors.Each method has its advantages and disadvantages, but the method of colorizing the images using the characteristics of the image itself can be considered a new idea.Reinhard et al. [6] utilize a soft statistical analysis to drive one image's color features on another.In this research, achieve color correction by choosing an appropriate source image and apply its features to another image.Levin et al. [1] depends on easy premise: neighboring pixels in space-time that have similar intensities should have similar colors.This premise which built using a quadratic cost function and obtain an optimization problem that can be solved efficiently by using standard techniques.Olsen et al. [3] offers a mathematical framework for recovering color information from multiple images sources.Such sources could include either black and white negatives or plates.
The research based on some studies of inverse process (converting color (RGB) image to grayscale image) using fixed weighs equations.These studies are successful in converting process.Such that, Shi et al. [7] presents a maximum entropy algorithm, a new color-to-gray conversion, based on the just noticeable difference (JND).Bala et al. [8] represent the process of converting color business graphics to grayscale in a manner that preserves discriminability.Firstly, the original lightness values sorted According to the colors.They are then spaced equally in gray, or spaced according to their three bands color difference from colors adjacent to them along the lightness.Kumar et al. [9] in this model is based on Cartesian coordinate system.Images represented in RGB color model consist of three component images.One for each primary, when fed into an RGB monitor, these three images combines on the phosphor screen to produce a composite color image.

Implementation
The proposed system is based on building a model of coloring grayscale image without human intervention using characteristics extracted from the features of grayscale image.Characteristics are extracted directly from the grayscale image.Which are: Mean, Standard deviation, and Skewness, then uses these features to calculate weights of color image (RGB color system).Thus, the basic steps to implement the model are illustrated as follows:

Convert from RGB to Grayscale
In fact, the color composed of a three-bands represent by the visual characteristics, which it's: lightness, chroma, and hue.The process of convert from color to grayscale reducing from three bands to a one bands, therefore it consider lossly process.In the most common methods, the lightness information is keep while the chroma and hue information is ignored.Mathematical formula of the conversion is [7]: Where: Weight= summation of all three weights (R, G, and B) which must equal 1 Assuming that the R, G, and B are values of monochrome colors (Red, Green, and Blue) of RGB color image which are linear in luminance, Wr is the coefficient (fixed weight) of red color which is 0.299, Wg is the coefficient (fixed weight) of green color which is 0.587, and Wb is the coefficient (fixed weight) of blue color which is 0.114.This equation is essentially a calculation of luminance, which is relative to lightness.With this formula, colors with small lightness variances but high variances in hue or chroma will be indistinguishable in the grayscale image, even though they were quite distinguishable in the original color input [8]. Figure 1(b) show the image after converting to grayscale image.

Extraction Weights
Colorizing the grayscale image to be colored in RGB color system required the weights of converting would be found.The traditional method used the same coefficients (Wr, Wg, Wb) in equation (1) as converting weights of three monochrome colors (R, G, and B).Where G image is the values of pixels in grayscale image.Thus, the equation of RGB color image is composed of the three colors equations in (3,4,5) as: This equation of fixed weights will be suitable for all images but with different effect.Sometimes use of this method gives bad results and make the color of image goes away from reality, as shown in Figure 1(c).
Thus, the building system used a novel method to compute weights depending on characteristics extracted from the grayscale image.These characteristics are statistical measurement, which are Mean, standard deviations and Skewness along of the grayscale image.Then from these measures the weights equations calculated to be used in coloring the image, this equation is different from one image to another depends on their characteristics, and it is suitable to this image only.
Experimentally found that values of these measurements effect on color in image.Each statistical measurement value determined with threshold value, these thresholds extracted by multi experiments.Thus, the spatial algorithm will be implemented to computes weights.Notice, these weights would have been possible to be increase or decrease to ensure that summation of these weights is always equal to one [7].
The first statistical measure is Mean which is represent as the summation of intensity values pixels divided by the count of pixels in the grayscale image.Mean gives the information of the texture properties that represent the brightness of the image.Mean measures the average value of the intensity values dark.The mean can be defined [10], [11] as:

…………………….…… (7)
Where I (i, j) is the pixel intensity at position (i, j) and N represents the total number of pixels of image.
The second statistical measurement is Standard deviation, it is used to describe the spread of gray level around the mean.The low value of the standard deviation indicates low contrast and the high value shows the high contrast of the image.This can be computed [10], [11] as:

…..………………….… (8)
The third statistical measurement is Skewness represent the measure of symmetry and asymmetry of the graylevel values around the mean.It is the measurement of the variance of the intensity level distribution round the mean.The value of the skewness will be in one case from three cases: positive, negative or zero.The positive value refers that the left part of mean contain the large number of intensity values, while the skewness of the intensity values tail is towards the right part of the distribution that mean the right part tail is longer than the left part tail.The negative value refers that the right part of mean contain the large number of intensity values, while the skewness of the intensity values tail is towards the left part of the distribution that mean the left part tail is longer than the right part tail.The zero value refers that the two parts of the mean contain similar distribution of the intensity values.The skewness1 can be defined [10], [11] as:

……………….… (9)
In the proposed method the weights extracted in three probabilities depend on the three statistical measurements values, these possibilities have been appeared experimentally: The first probability achieved if the Mean value more than 0.3985.In this case the Skewness value checked to be positive value.Hence, the weights of blue color will be active and distinctive in the image, thus the weights formulas are:

Performance measure
In this paper, the Root Mean Squared Error (RMSE) is used to measure the similarity between the coloring image and the original color image [13].RMSE is very commonly used and makes an excellent general purpose error metric for numerical predictions, it is used to measure the quality of images [13].First, it measured RMSE between the image colorizing by traditional method fixed weights (FWC) and the original color image, then measured RMSE between the image colorizing by proposed method dynamic weights (DWC) and the original color image.The results obtained from this error measure observed that purposed method (DWC) have the small value of RMSE of the two methods, thus, indicates that proposed method have a large similarity.Table (1) appears the RMSE of two methods and the values of difference between the values of two methods.Chart in Figure 2(a,b) analyze these results, from these results showed that 37 of tested image have given a good results of proposed method of colorizing while only 3 images did not give good results to the proposed method (DWC) with little difference from the traditional method (FWC).Thus, the chart in Figure 2

Conclusion
This paper used a novel technique to color grayscale image based on found weighs of converting images depended on characteristics extracted from the image.In general, each image has characteristics different from other image.This feature has made the image coloring process a dynamic process.The proposed method compared to the traditional method is more efficient, more reliable and closer to reality.Our technique can be made applicable to a variety classes of images and gave a good result, thus these results appeared that 92.5% of tested image gave acceptable results of proposed method compared with only 7.5% images that wouldn't gave the target result.

Figure 1 -
Figure 1-(a) Original color images, (b) Grayscal images, (c) FEW RGB color images, (d) DWE RGB color images (a) shows the difference of RMSE between the two methods (FWE and DEW), and Figure 2(b) shows the difference in calculation error ratio of RMSE.