ENVIRONMENT ADAPTIVE LIGHTING SYSTEMS FOR SMART HOMES

In this work, an application of adaptive lighting system is proposed for smart homes. In this paper, it is suggested that, an intelligent lighting system with outdoor adaptation can be realized via a real fisheye image. During the implementation of the proposed method, the fuzzy c-means method, which is a commonly used data clustering method, has been used. The input image is divided into three different regions according to its brightness levels. Then, the RGB image is converted to CIE 1931 XYZ color space; and the obtained XYZ values are converted to x and y values. The parameters of x and y values are shown in CIE Chromaticity Diagram for different regions in the sky. Thereafter, the coordinate values are converted to Correlated Color Temperature by using two different formulas. Additionally, the conversion results are examined with respect to actual and estimated CCT values.


INTRODUCTION
The importance of the term of illumination is increasing day by day depending on the developments in lighting technology.This importance is further increased thanks to smart houses and technologies; and this is reinforced by studies on the concept of lighting, and the light, which directly affects the quality of the human life [2,13].At first, a basic on/off controller system which switches according to lighting level is defined as an intelligent lighting system for the smart homes.In parallel with the developing technology, the term of Correlated Color Temperature (CCT) has increased its importance [1,9].It is a fact that colors affect the mood of the people.In addition to that, there are many studies on the effects of different colors on the human behavior.That is to say, the illumination affects every aspect of life.In a study, the effects of different CCT values on office workers were investigated [23].In another study carried out on elementary school children, two different light sources, which had different CCT levels, were compared according to their visual acuity [3].A wireless sensor network that allows the light level in the tunnel to be changed adaptively has been proposed in another study [19].Thanks to this adaptive approach, the safety in the tunnel may increase and power consumption of luminance systems may reduce [6].In addition to that, a proper lighting has a significant effect on the fatigue level of a person [20][21].The concept of light has moved to a different dimension with the concept of visible light communication [15].In addition to light sources' realizing their illumination task, the transfer of data by these sources will bring a major revolution in the field of illumination.In this work, a low-cost adaptive lighting system is suggested and examined for smart homes.The implementation of proposed approach consists several steps, such as: pattern recognition, morphological image processing, and transformation of color spaces.The RGB to XYZ transformation and RGB, XYZ color spaces are explained in the second part of the article.In the third part of the article, the algorithm of fuzzy c-means (FCM) is briefly described.The implementation of suggested method and comparisons are explained in the fourth part of the paper.

COLOR GAMUT AND RGB TO XYZ TRANSFORMATION
The term of the color gamut is defined as a color palette that is generated by a specific technology or process.In other words, it is a variety of colors, which are created or displayed via scanner, monitor, printer, television and similar technological devices [8].In the area of image processing, the images are represented in RGB color space, generally.Also, there are five major spaces to model color space in the literature [4].These models are: CIE, RGB, YUV, HSL/HSV, and CMYK.In this paper, color space of CIE and RGB are used to determine CCT values.The CIE color space is defined as the origin of other color spaces, it is based on color perception of the human, and it covers almost all colors spaces.The RGB (Red, Green, and Blue) is other color space, which is the most well-known color space in literature.It explains which lights need to be emitted to produce a specific color.A color can be defined as the set of three numbers due to the trichromatic nature of vision and it can be interpreted as a vector in a 3-D space.The magnitude and orientation of this vector represent the level of light and color tone, respectively.The illustration of this representation is shown in Figure 1.
The C̅ represents the color vector, and the coordinates of this vector are defined by C̅ 1 , C̅ 2 and C̅ 3 in 3-D space, and they are called as trichroma-tic coordinates.Additionally, the color vector is measured according to primary colors and these are defined as follows: P̅ 1 (red), P̅ 2 (green) and P̅ 3 (blue).Furthermore, the relationship between these parameters can be represented as a whole and it is shown in Equation 1. (1) This color space is also called as the basic components of the light.The sample illustration of different color spaces is shown in Figure 2. As shown below, the CIE color space is most comprehensive color space on the figure [7,17].
RGB to XYZ conversion is required for the intelligent lighting system to be realized in this article [16].The RGB to XYZ, and XYZ to RGB transformations are shown in Equation 2 and 3, respectively [18]. (2) (3) These two matrices allow the transformation between color spaces.A few additional steps are needed to complement the transforming from RGB to CCT.First, there is a need for an additional transformation to represent XYZ values on the 2D Cartesian coordinate system and this transformation is called as XYZ to xy transformation; and it is shown in Equation 4.

FUZZY C-MEANS
Fuzzy c-means is one of the clustering methods commonly used in the literature.In general, the implementation of the method is based on fuzzy logic.Thanks to the fuzzy logic, the boundaries of the clusters have soft character [14].The illustration for decision boundaries for soft and hard clustering is shown in Figure 3.In this figure, m is equal to membership function and X is representing the distribution of the sample in 1D space.
The implementation of fuzzy c-means is similar to any other clustering algorithm; it has only a few modifications on generic cost and distance calculation function.The realization of c-means is performed by the minimization of Equation 5.In this equation, the parameter of x i represents the fuzzy memberships on the j cluster.x i and c j represents the observation value and cluster center, respectively [5].
The large value of m leads to increased fuzziness in the clusters.On the other hand, lower value of m can cause crisp on clustering.In the literature, the value of membership is selected as m = 2 and it was selected parallel to literature for this work. (5) The memberships of fuzzy logic and cluster center are defined in Equation 6 and 7, respectively.In addition to that, the users have to define the error criteria to perform clustering algorithm.In this algorithm, the error criteria (ε) are defined as shown in Equation 8.The algorithm has to repeat until this error criterion is met.The value of error criteria was selected as ε = 10 -5 for this work.

ENVIRONMENT ADAPTIVE LIGHTING SYSTEM
In this part of the paper, the implementation process of the algorithm is explained.At the first part of algorithm realization, the users have to obtain an image of outer environment; and fisheye type lenses are used in this step, due to the wide angles.The information on colors of the outdoor environment is obtained by these images.The sample outdoor image for cloudy weather, which is obtained by the fisheye lens, is shown in Figure 4.The segmentation process is implemented for three clusters; and these are: cloudy air, open air, and earth surface.
The main aim of proposed algorithm is the conversion of RGB values to CCT by several assumptions.The analysis process of fisheye image and implementation of the algorithm were realized in MATLAB environment.
The proposed method consists of several steps as follows: • The input RGB image is converted to XYZ color space.• The XYZ color space is transformed to xy on Cartesian coordinate space.
• CCT value about the specific region is determined by the CCT estimation approach.
The flowchart of RGB to CCT transformation is shown in Figure 5 (10) Another approach for CCT transformation is Hernandez's method [10].These two approaches are performed in the light of several assumptions.
The constants for the Hernandez approach are shown in Table 1 and these parameters are used in Equation 10 to transform xy values to CCT. (11)   The values of CCT for a different region of the sky are calculated according to these two approaches.The McCamy and Hernandez approaches are called as method 1 and method 2.
The RGB to xy transformation results for different regions and the average zone is shown in Figure 6 on CIE diagram.
The CCT results for different regions and mean the region of sky is shown in Table 2.
Some of the CCT values for different types of light sources are shown in Table 3.
According to this table, the CCT value of open region is nearly equal to north skylight CCT value and estimated CCT value for cloudy part of the sky is about 5500 K; this means that CCT value of this part is similar to the light source of sunlight plus skylight.
In addition to that, the estimated CCT values are shown in Figure 7 as the color temperature bar on the Kelvin scale.As shown in the figure below, the estimated results are consistent.
The sample illustration of environment adaptive lighting system for smart home is shown in Figure 8.This system consists of several steps.First, the image of the sky should be determined; after that, this RGB image is transformed to CCT values as described in this study.In this stage, a data processing unit such as Raspberry Pi can be used [22].The lighting system of the home is adjusted by led driving unit, according to the estimated CCT values [11].As a result of this process, an environment adaptive low-cost system can be achieved.

CONCLUSION
In this paper, an environment adaptive lighting system is suggested.The implementation of the proposed method consists of several steps.In the first stage, the image of the sky is obtained by using a camera with fisheye lens and the segmentation process is performed by fuzzy c-means.As a result of the segmentation process, the input image is separated into three different clusters.These are as follows: open sky, cloudy sky and mean point of these two regions.The value of CCT is determined by these three regions.
After this information is obtained, an RGB image is converted to XYZ color space, and xy Cartesian coordinates transformation is applied to the result in this transformation.In this way, the RGB value of the input image can be represented in 2-D, instead of 3-D space.These coordinates are transformed to CCT values by two different and most common approaches in the literature.As a result of this transformation, the CCT values about input images are obtained.The estimated results are compared with some of the real CCT values of different light sources and this proposed approach has been observed to be successful.Information about using the proposed method in smart home applications is presented in the study.As a result, a low-cost environment adaptive lighting system has been proposed, and realization processes of proposed system are explained briefly in this paper.

Fig. 3 .
Fig. 3. (a) Hard Clustering (b) Soft Clustering [17].In the literature, two different approaches are commonly used to estimate CCT value of xy coordinates.The first one, the approach of McCamy, and the calculation of CCT value from xy coordinates for McCamy's approach is shown in Equation 9 and 10[12].

Table 1 .
The constants for the Hernandez's method for different CCT Fig. 6.CIE diagram of xy coordinates for different regions

Table 2 .
The CCT results of proposed algorithm for different regions

Table 3 .
Typical CCT values for different light sources