# Automatic Color-Matching Model of Environmental Art Based on Visual Matching by Using IoT

Authors: Deqiang Hu; Xugang Hou; Nan Song
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

In order to improve the matching effect of environmental art color automatic matching, a model of environmental art color automatic matching based on visual matching is designed. Firstly, it preprocesses the color matching of environmental art, then extracts the color space and its main color, and analyzes the color deviation. At the same time, the color model is established and the color quantization is processed, and finally the color matching is realized. The experimental results show that the matching time of the proposed model is less than that of the traditional model, and the wrong contour is less.Research Objective. A model of environmental art color-automated matching based on visual matching is developed in order to improve the matching effect of environmental art color matching. Current Challenges. Because of time constraints, the matching model still has certain drawbacks, necessitating more optimization research in the subsequent study. The main steps in the research are pretreatment before color matching of environmental art, color space and main color extraction, color deviation analysis, color modeling, color quantization processing, implementation of color matching, and experimental comparison.


---

## Body

## 1. Introduction

The color matching of drawings is a common design method, while the traditional manual color matching completely depends on the experience of designers, and there are few schemes for designers to use in color matching. Computer automatic color matching is to divide the color of the image first, that is, to quantify the color. The color of the image is summed up to a limited number of colors, and then the quantitative colors are matched. In color quantization, the standard of minimum variance between quantized image and original image is usually adopted to determine the final quantized image. The so-called “color matching” refers to the replacement of colors in the quantitative graph with each other to form different color combinations and produce different pattern effects. New colors that are not in the image can also be introduced to replace with one or more colors in the quantitative graph to obtain a new color-matching scheme. In this way, a variety of schemes can be provided for designers to choose, and designers can also be involved in the process of man-machine integration. In the color matching process, the degree of computer participation in color matching can be controlled, which makes the color matching process quite flexible and convenient. Therefore, an automatic color-matching model of environmental art based on visual matching is designed.The Internet of Things (IoT) is a current communication model that anticipates a less distant future, clinched alongside which those questions from claiming standard normal presence will be furnished for microcontrollers, handsets for electronic communication, and additionally sensible gathering stacks that will make them ready will talk with one another, also with the customers, turning under a significant piece of the web. Therefore, the IoT concept aims to make the Internet much more immersive and unavoidable. Additionally, by enabling easy access to and collaboration with a variety of devices, such as home appliances, surveillance cameras, checking sensors, actuators, displays, and vehicles, the IoT will foster the development of numerous applications that utilize the potentially enormous sum and variety of data [1].


## 2. Pretreatment before Color Matching of Environmental Art

In order to improve the effect of color matching, neighborhood average method is used to denoise the color before color matching. Neighborhood average method is also known as the mean filtering of neighborhood average method [2]. It has been widely used in color denoising because of its intuitive, simple, easy to implement, and other advantages. The neighborhood average method uses the average value of several pixels in the middle template (usually 3x3 template) to replace the gray value of the pixels in the region [3], so as to eliminate those pixels that cannot represent the value of the surrounding environment pixels, and so as to realize the color preprocessing. The expression is as follows:
(1)gx,y=1N∑f∈Rfx,y.In Formula (1), fx,y represents to be processed, R represents the kernel, N represents the total number of pixels in the kernel, gx,y represents the total number of pixels on the kernel, and gx,y represents the total number of pixels after neighborhood average filtering.Although neighborhood average method can suppress noise to a certain extent, it will make the original color blurred in the process of denoising. To solve this problem, a binarization method with smaller structure elements is proposed [4]. The mathematical expression is as follows:
(2)AΘB=zBz⊆A.In Formula (2), AΘB is the result of binary image corrosion, B is the structural element of color, and A is the color to be processed.The processing described above can make the structural elementB originally located in the color move on the whole z plane [5], which improves the effect of color denoising processing.Based on the above process, the color denoising is completed.Due to the color constraints, the final color is enhanced, as shown below:(3)Eoφx,φxo=φx−φxo2.In Formula (3), Eo represents the color constraint to be restored, and the constraint to be restored represents the feature mapping of colors in the network.At the same time, to solve this problem, the semantic segmentation method is used to generate the segmentation label, the expression is as follows:(4)LSS=∑C12N2Gcx−Gcxr2.In Formula (4), C represents the number of channels in the semantic segmentation mask, and Gcx and Gcxr represent the relationship between color mapping features.On this basis, the expression of color enhancement is as follows:(5)gx,y=Tfx,y.In Formula (5), gx,y is the original color information, fx,y represents the processed color, and T is the operation parameter.Finally, the color quality is improved.


## 3. Color Space and Main Color Extraction

### 3.1. Color Space

A simple way to express the early color is to sum up the seven colors of the sun as six colors, connect them from head to tail, and turn them into six-color rings. Add intermediate colors between adjacent colors to turn them into twelve-color rings or twenty-four-color rings. Taking the twelve-color ring diagram as an example, using the three primary colors of red, yellow, and blue as the color basis, the three primary colors are mixed to produce secondary colors, and then the secondary colors are mixed to obtain tertiary colors [6]. From the position of the three primary colors shown in the figure, the distribution of red, yellow, and blue in the hue ring is equilateral. With the three primary colors as the basic colors, the color changes counterclockwise, and the angle of one color, change of the twelve-hue ring is 30 degrees. After a rotation along this rule, it will return to the original color.Color can also be divided into colorful and colorless. The rainbow in the sky after the rain and the neon lights flashing everywhere in the city at night are colorful; colorless is based on black and white two colors, these two colors from white to black in the continuous transition will appear in different shades of gray, is also a colorless change. Colorless can be blended with any one of the twelve-hue rings to produce other colors. From the aspect of hue psychology, color can be divided into light and hard, which mainly comes from the psychological stimulation brought by different lightness and purity of color. High brightness colors give people a sense of lightness, such as white, yellow, and red. This kind of color gives people an intuitive feeling of soft and bulging; low brightness colors give people a sense of massiness, such as black, blue, and blue purple, which gives people an intuitive feeling of hardness and shrinkage [7].In order to make all kinds of colors in a certain order and contained in a space, the three-dimensional coordinate axis is corresponding to the three independent parameters of colors, so that each color has a corresponding space position. Conversely, any point in the space represents a specific color. We call this space color space. The quantitative expression of color information is completed in color space (color coordinate system) [8]. Color space is three-dimensional. As the three-dimensional coordinates of color space, the three independent parameters can be the three psychological attributes of color: hue, saturation, and intensity. They can also be the other three parameters, such as RGB, lab, or CMY. As long as the three parameters describing color are independent of each other, they can be used as the three-dimensional coordinates of color space. There are CMYK color space, YCC color space, CIE color space, Wanfang Data RGB color space, and HSI color space. According to the needs of this paper, RGB and HSI spaces are discussed [9].The RGB color coordinate system takes red R, green G, and blue B as the primary colors, and other colors are weighted and mixed by these three primary colors. RGB color space is a common color space, because most numbers are expressed in this color space. However, the main disadvantage of RGB space is that it is not intuitive. It is difficult to know the perceptual attribute of the color described by the RGB value. Secondly, RGB color space is one of the most uneven color spaces, and the difference between two colors cannot be expressed as the distance between two points in the corresponding color space. If the RGB value is converted into hue, color saturation, and brightness [10], the problem is solved. Therefore, some other color spaces, which are more in line with visual perception, have been proposed. HSI is more commonly used, and its three components represent hue, saturation, and intensity, respectively. In the HSI model, the H component’s ability to describe color is relatively close to human vision [11]. In many applications, when the color is transformed from RGB space to HSI space for retrieval, only H component can be considered to simplify the operation and improve the processing speed.Conversion formula from RGB format to HSI format:(6)H=ang162R−G−B,12G−B,S=4R2+4G2+4B2−2RG−2RB−5GB6.


### 3.2. Clustering Algorithm for Dominant Color Extraction

In RGB space, the clustering algorithm of essential color extraction is as follows:(1) Count the total number of colors in a picture, recordT, arbitrarily set N colors as the main colors (here, assuming that there is no prior knowledge), the initial value of iteration M is 1, and the maximum value isMax(2) For each pixel of RGB, take the upper 4 bits of RGB and compress it into the space of16∗16∗16. The use frequency of each color in statistics(3) Merge all the colors whose spatial distance is less than 01 and calculate the merged colors according to the weighted frequency of each merged object [12]. If the number of colors after merging is less than or equal to N, it will be the main color and enter (7); otherwise, the first N colors which are used frequently after merging are used as the initial clustering centers(4) According to the nearest neighbor criterion, the other items are assigned toN clustering centers to complete the first clustering M=M+1. The distance from each color to each cluster center is calculated according to Formula (2)(5) ForN categories, according to the use frequency of various colors in this category, the weighted average is used to calculate the new cluster center(6) If the number of cyclesM is greater than Max, or all the new cluster centers are the same as the last cluster center, enter (7); otherwise, go back to (5)(7) Check the current color space format, if it is RGB format, end; if it is HSI format, restore to RGB format, end


## 3.1. Color Space

A simple way to express the early color is to sum up the seven colors of the sun as six colors, connect them from head to tail, and turn them into six-color rings. Add intermediate colors between adjacent colors to turn them into twelve-color rings or twenty-four-color rings. Taking the twelve-color ring diagram as an example, using the three primary colors of red, yellow, and blue as the color basis, the three primary colors are mixed to produce secondary colors, and then the secondary colors are mixed to obtain tertiary colors [6]. From the position of the three primary colors shown in the figure, the distribution of red, yellow, and blue in the hue ring is equilateral. With the three primary colors as the basic colors, the color changes counterclockwise, and the angle of one color, change of the twelve-hue ring is 30 degrees. After a rotation along this rule, it will return to the original color.Color can also be divided into colorful and colorless. The rainbow in the sky after the rain and the neon lights flashing everywhere in the city at night are colorful; colorless is based on black and white two colors, these two colors from white to black in the continuous transition will appear in different shades of gray, is also a colorless change. Colorless can be blended with any one of the twelve-hue rings to produce other colors. From the aspect of hue psychology, color can be divided into light and hard, which mainly comes from the psychological stimulation brought by different lightness and purity of color. High brightness colors give people a sense of lightness, such as white, yellow, and red. This kind of color gives people an intuitive feeling of soft and bulging; low brightness colors give people a sense of massiness, such as black, blue, and blue purple, which gives people an intuitive feeling of hardness and shrinkage [7].In order to make all kinds of colors in a certain order and contained in a space, the three-dimensional coordinate axis is corresponding to the three independent parameters of colors, so that each color has a corresponding space position. Conversely, any point in the space represents a specific color. We call this space color space. The quantitative expression of color information is completed in color space (color coordinate system) [8]. Color space is three-dimensional. As the three-dimensional coordinates of color space, the three independent parameters can be the three psychological attributes of color: hue, saturation, and intensity. They can also be the other three parameters, such as RGB, lab, or CMY. As long as the three parameters describing color are independent of each other, they can be used as the three-dimensional coordinates of color space. There are CMYK color space, YCC color space, CIE color space, Wanfang Data RGB color space, and HSI color space. According to the needs of this paper, RGB and HSI spaces are discussed [9].The RGB color coordinate system takes red R, green G, and blue B as the primary colors, and other colors are weighted and mixed by these three primary colors. RGB color space is a common color space, because most numbers are expressed in this color space. However, the main disadvantage of RGB space is that it is not intuitive. It is difficult to know the perceptual attribute of the color described by the RGB value. Secondly, RGB color space is one of the most uneven color spaces, and the difference between two colors cannot be expressed as the distance between two points in the corresponding color space. If the RGB value is converted into hue, color saturation, and brightness [10], the problem is solved. Therefore, some other color spaces, which are more in line with visual perception, have been proposed. HSI is more commonly used, and its three components represent hue, saturation, and intensity, respectively. In the HSI model, the H component’s ability to describe color is relatively close to human vision [11]. In many applications, when the color is transformed from RGB space to HSI space for retrieval, only H component can be considered to simplify the operation and improve the processing speed.Conversion formula from RGB format to HSI format:(6)H=ang162R−G−B,12G−B,S=4R2+4G2+4B2−2RG−2RB−5GB6.


## 3.2. Clustering Algorithm for Dominant Color Extraction

In RGB space, the clustering algorithm of essential color extraction is as follows:(1) Count the total number of colors in a picture, recordT, arbitrarily set N colors as the main colors (here, assuming that there is no prior knowledge), the initial value of iteration M is 1, and the maximum value isMax(2) For each pixel of RGB, take the upper 4 bits of RGB and compress it into the space of16∗16∗16. The use frequency of each color in statistics(3) Merge all the colors whose spatial distance is less than 01 and calculate the merged colors according to the weighted frequency of each merged object [12]. If the number of colors after merging is less than or equal to N, it will be the main color and enter (7); otherwise, the first N colors which are used frequently after merging are used as the initial clustering centers(4) According to the nearest neighbor criterion, the other items are assigned toN clustering centers to complete the first clustering M=M+1. The distance from each color to each cluster center is calculated according to Formula (2)(5) ForN categories, according to the use frequency of various colors in this category, the weighted average is used to calculate the new cluster center(6) If the number of cyclesM is greater than Max, or all the new cluster centers are the same as the last cluster center, enter (7); otherwise, go back to (5)(7) Check the current color space format, if it is RGB format, end; if it is HSI format, restore to RGB format, end


## 4. Color Deviation Analysis

According to the influence of color on people’s visual perception, color is divided into cold tone, warm tone, and neutral tone [13]. Every spring, everything recovers, the weather is warm and cold, the temperature rises, giving people a kind of hope, at this time the color should be light green as the main tone. With the increasing temperature, the color changes from green to yellowish green, lemon yellow, and orange, and then gradually enters summer. Summer weather is hot, the red sun is baking the earth, at this time the color is mainly red. From summer to autumn, the weather turns cool gradually. At this time, the red color gradually transits to magenta and purple. In late autumn, when it’s cold, we should use cool colors, so we need to use blue. In winter, when snow flies outside the window, you should use cyan to cyan transition, because cyan is the coldest color. Through the above four seasons of the weather changes, we use a good description of color, this natural appearance is outlined by us with twelve-hue ring. In this case, it is necessary to analyze the color deviation. The process of color deviation analysis is shown in Figure 1:Figure 1
Analysis process of color deviation.The simple process of color deviation analysis is shown in the figure. When analyzing digital color deviation, refer to the above process of color deviation analysis to improve the accuracy of analysis. There are a large number of numbers in the sequence, so we cannot analyze every color, but we can determine the gray balance of the image and the color deviation by using memory color [14]. Gray balance is the basis of color in digital image processing. First of all, analyze the original document, judge the color of the original document from two aspects, judge whether there is deviation in the color of the original document, and determine whether the color needs special attention. In color analysis, it will be affected by noise, because in acquisition, it will be affected by the optical imaging, imaging system, and acquisition equipment. In the imaging process, the relative motion, environmental noise, and other reasons will have a certain impact on the image. In order to improve the accuracy of digital color segregation analysis, a linear filtering algorithm is used to analyze the color segregation of digital image [15]. The calculation formula of linear filtering algorithm is as follows:
(7)Q=∂n∑i=1ni+CiD+1.In Formula (7), Q represents the noise in the acquisition, ∂/n represents the noise processing factor, and ∑i=1ni represents the linear filtering algorithm factor. In this calculation, the production parameters are introduced, and the directional analysis is not performed.On this basis, it analyzes the color shift of the color, in the color of the number, the human eye is more sensitive to the neutral gray part of the gray, because in the gray [16], as long as there is a certain amount of color, it will be found by people’s eyes. Therefore, the gray balance detection algorithm is used to check the offset in the image. When using the gray balance detection algorithm, it is necessary to collect the gray balance data of sequence numbers. The gray balance data acquisition algorithm is as follows:
(8)Re=Wσβ+rC∗Pmf+V.In Formula (8), Re represents the basic color data in the number, mf+V represents the gray balance data, and Wσβ represents the gray balance detection algorithm factor, this calculation does not do directional analysis.On the basis of the above formula calculation, the gray balance data collection is completed, the analysis algorithm is as follows:(9)Q=1γ∑j=1M∂∗n.In Formula (9), Q represents gray balance data, 1/γ represents color deviation, and ∑j=1M∂ represents color deviation analysis factor, and orientation analysis is not performed in this calculation.Through the above calculation, the analysis of color deviation is completed, which provides the basis for automatic color matching.


## 5. Color Modeling

Color model is a coordinate system used to identify and quantify colors. In the color model, the set of all colors is the corresponding color space of the model [17]. The most commonly used color model in computer is RGB model. The spatial position of each color in the model is represented by the coordinate system composed of R,G,B primary colors. Each point in the color space can be represented by a vector x [18].
(10)x=Rx,Gx,Bxr.The similarity of two colorsx and y can be expressed by the norm distance Dx,y of their vector differenceE.
(11)Dx,y=E=x−y.In the formula,Dx,y is usually called color distance, and E is the norm of vector, such as Euclidean norm:
(12)Dx,y=Rn−Ry2+Gx−Gy2+Bx−By2.Generally, the smaller theDx,y between the two colors is, the closer the two colors are. However, RGB color space has one disadvantage: it is a nonuniform linear space, and the same distance in the space does not mean the same visual difference [19]. For this reason, a uniform color space L,a,b is defined, L represents metric brightness, and a and b represent metric chroma. They are defined as follows:
(13)L=116YY01/3−16.WhenY/Y0>0.01,
(14)a=500XX01/3−YY01/3,(15)b=200YY01/3−ZZ01/3.The color space is precisely converted through Equations (14) and (15).


## 6. Color Quantization Processing

The problem of color quantization is to sum up the original colors into a few colors according to the visual characteristics of human eyes, and then use these colors to generate quantization again, so as to minimize the difference between the quantization and the original color and the quantization error. There are two ways to measure the quantization error, one is the minimum variance between the quantization color and the original color, the other is the minimum maximum deviation between the quantization color and the original color. The quantization algorithm in this paper adopts the minimum variance standard [20–23].Color quantization was first used to display true color on the display, but at present, color quantization has been widely used in engineering. Compared with the application in computer display, in printing, and dyeing processing, there are few quantized colors, generally 5 or 6 colors and at most 20 colors. In this way, the difficulty of color quantization increases.In this paper, an improved clustering analysis quantization algorithm is used, because in the printing and dyeing process, the colors are different, which can classify the colors quantized at the beginning. In this way, the display effect in the reconstruction quantization is obviously improved compared with the quantization of only quantized color itself.The color quantization algorithm based on clustering analysis is shown in Figure2.Step 1.
Assuming that colors need to be re quantized ton colors, specify the m0≤m≤n colors z1,z2,⋯,zm that must be retained in the quantization as a part of the cluster center and record them as Z10,Z20,⋯,Zm0. Then the computer randomly selects n−m colors as the rest of the cluster center and record them asZm+10,Zm+20,⋯,Zn0.Step 2.
Assuming thatk iterations have been passed, Zj is defined as the clustering center after the second iteration. If x−Zik exists for a pixel x, then x∈Sjk, dividing all pixels into n clustering sample sets.Step 3.
Calculating the new cluster center value and the average value of all pixels inSjk of sample set is taken as the new cluster center, namely,
(16)Zjk+1=1nj∑∗∈Sx,j=1,2,⋯,n.Figure 2
Calculation process.In Formula (16), nj represents the number of samples contained.Step 4.
If thej-th cluster center is closest to the i-th specified color, namely, DZjk+1,zi=minDZjk+1,zi,j=1,2,⋯,n, replacing the h-th cluster center with the specified color Zi.Step 5.
IfDZjk+1,Zjk=0,j=1,2,⋯,n, the clustering ends; otherwise, it turns to step 2.
In step4, the specified color can be kept unchanged, and step 5 is to judge the convergence. If the clustering center has converged to a certain value, the clustering ends.This quantization method combines the process of manual selection of specified color and computer automatic analysis, which can meet the convenience of computer algorithm implementation and human visual effect at the same time. In the color-matching algorithm introduced in this paper, the color separation part adopts this algorithm. After the color quantization, the color has been summed up to a few limited colors, so that it is ready for the next step of color matching [24, 25].


## 7. Implementation of Color Matching

At present, the objective evaluation of gamut matching results mostly adopts the color difference formula, assuming thatu0 represents the original image to be matched in CIELAB space, and its size is M×N. The color gamut obtained after u gamut matching, t0 and t represent the corresponding pixels in u0 and u, respectively, then the average color difference between the two is
(17)E=1MN∑Mi=1∑Nj=1t0−t.In fact, the color difference formula is only suitable for comparing the similarity between single color patches, but it is often rich in content and has obvious texture and geometric features. Therefore, the evaluation results based on the color difference formula are often inconsistent with human visual perception. Some scholars also use subjective methods to evaluate the gamut matching results, that is, the matching results are displayed with the original image at the same time. Observers in different fields score the corresponding gamut matching algorithm by comparing the closeness of the two images. The algorithm with the closest matching result to the original image gets the highest score.In order to describe the difference quantitatively and guide the color gamut matching, based on the traditional color difference formula, the author introduces the CSF function, which reflects the characteristics of the visual system, and defines the two physical quantities of the perceived color difference and the perceived gradient difference.Definition 1.
Perceptual color differenceD′=f∗uc−u0c,c∈L,A,B, L,A,B are components on three planes of CIELAB space, and f is the CSF function simulating human visual effect.Definition 2.
Perceptual gradient differenceGc=∇Dc=∇f∗uc−u0c,c∈L,A,B, which is to obtain the edge change information of two images.


## 8. Experimental Comparison

In order to verify the effectiveness of the automatic matching model of environmental art color based on visual matching, the experimental comparison is carried out, the traditional matching model is compared with the research model, and the application effect of the two models is compared.


### 8.1. Comparison of Collocation Time

Using the collocation model of this study and the traditional model, respectively, the collocation time of the two methods is compared, the comparison results are as follows:As can be seen from Figure3, the automatic color-matching model of environmental art in this study takes less time than the traditional model and can achieve color matching in a short time.Figure 3
Comparison of collocation time.


### 8.2. Comparison of Wrong Contour Generation Times after Color Matching

The number of false contours generated by the two collocation models was compared, the comparison results are shown in Table1.Table 1
Comparison of error contour generation times after color matching.
Serial numberTimes of error contour generation in traditional methods/timesThe number of false contour generation in the method studied/times120230320450530620740851Comparing with the above table, we can see that the method in this study has one error contour after matching, while the traditional method has many errors, which is better than the traditional method.


## 8.1. Comparison of Collocation Time

Using the collocation model of this study and the traditional model, respectively, the collocation time of the two methods is compared, the comparison results are as follows:As can be seen from Figure3, the automatic color-matching model of environmental art in this study takes less time than the traditional model and can achieve color matching in a short time.Figure 3
Comparison of collocation time.


## 8.2. Comparison of Wrong Contour Generation Times after Color Matching

The number of false contours generated by the two collocation models was compared, the comparison results are shown in Table1.Table 1
Comparison of error contour generation times after color matching.
Serial numberTimes of error contour generation in traditional methods/timesThe number of false contour generation in the method studied/times120230320450530620740851Comparing with the above table, we can see that the method in this study has one error contour after matching, while the traditional method has many errors, which is better than the traditional method.


## 9. Conclusions

An automatic matching model of environmental art color is designed, and the effectiveness of the model is verified by experiments. The experimental results show that the matching time of the proposed model is less than that of the traditional model, and the wrong contour is less. However, due to the limitation of research time, the matching model still has some shortcomings, and further optimization research is needed in the follow-up research.



---

*Source: 9100991-2022-09-19.xml*