# Colour Recognition Algorithm Based on Colour Mapping Knowledge for Wooden Building Image

Authors: Siyi Jia; Heng Chen
Journal: Scientific Programming
 (2022)

---

## Abstract

In the cross-media image reproduction technology, the accurate transfer and reproduction of colour between different media are an important issue in the reproduction process, and the colour mapping technology is the key technology to effectively maintain the image details and improve the level of colour reproduction. Wooden structure in the image colour and colour piece is different, the image of each colour of visual perception is not independent, and every colour in the image pixels is affected by the surrounding pixels, but in the process of image map, without thinking of the pixel space, adjacent pixels of mutual influence in particular, do not let a person particularly be satisfied with the resulting map figure. In the process of image processing by traditional colour mapping algorithm, the colour distortion caused by colour component is ignored and the block diagram of colour mapping system is constructed. With the continuous development of mapping recognition algorithms, the maximum and minimum brightness values in the image are mapped to the maximum and minimum brightness values of the display device by linear mapping algorithm according to the flow of the established recognition algorithm. By establishing the colour adjustment method of the colour mapping image, the processing effect of the mapping algorithm is analysed. The results show that the brightness deviation of the image is reduced and the colour resolution is improved by the colour brightness compensation.


---

## Body

## 1. Introduction

The 21st century is the information age. Computer technology changes with each passing day, and people’s access to information, processing information, and the way of transmitting information also have a qualitative development. 83% of the information acquired by human beings comes from the visual system, and the image is the carrier of visual information, so the image plays an important role in information transmission. Image processing is to use computer to process the image information, so as to achieve the desired effect. Image processing technology can make people understand the world more objectively and accurately. In many cases, the image people get is fuzzy; through image enhancement, blurred image can be made clear. Image processing technology has achieved rapid development; all kinds of digital images are also widely used in various fields of production and life. Usually, digital image in the used process will involve the image data processing, such as image information acquisition and transmission. In these processes, the quality of the image itself must be guaranteed to meet the requirements of use [1]. Pattern recognition technology can identify the target in the image and retrieve and classify the image. Colour mapping is to solve the problem of large contrast attenuation to transform the brightness of the scene to the range that can be displayed, while maintaining the image details and colour information which is very important for the performance of the original scene. The colour mapping algorithm maps the range of the image to the range that the general display device can display. On the one hand, the mapping of high dynamic range images must map large range to display device range through compression, which will inevitably lead to the loss of details. On the other hand, it is necessary to enhance the detail information in order to keep the high light and low dark, which will lead to the contradiction between the compression of scope and the enhancement of detail, and easily cause visual defects, such as halo phenomenon and gradient inversion. Just because of these contradictions and difficulties, image colour mapping algorithm has always been the focus of image processing and display research.With the rapid development of human science and technology, a variety of buildings with different styles, materials, and uses have emerged. So many architectural landscapes not only enrich human life but also provide a broad space for choice. However, in today’s highly developed human civilization, humanistic thought has received great attention, which has invisibly increased human troubles. We explore from the perspective of image, use image processing knowledge and computer technology to get valuable data, and find the essential difference hidden behind the image. Although there are a large number of articles with similar purposes in previous studies, the analysis of various architectural images is rarely done. In the field of image processing, the analysis results of architectural images are mainly applied in image retrieval and image classification [2]. With the rapid development of database system and computer vision, basic low-level features, such as colour, line, and texture, are generally selected for image classification based on image features. In daily life, all the wonderful visual presentation comes from colour. Colour is an important language and factor in architectural design. Cleverly applying the rules of colour emotion in the design and giving full play to the implication of colour can attract extensive attention and interest of the public and easily produce various associations and imaginations. As an independent subject, chronology has its basic laws and attributes. Although colour perception varies from person to person, it has a common side. When people are opposite calorific experience and understanding mix after complex thought feeling and rich life experience, colour becomes rich human nature and emotional appeal. Architectural colour, as an important factor of urban landscape, directly affects people’s visual and spiritual feelings. Different colour can produce different psychological feeling, and the association that colour place introduces and feeling concern the creation of environmental atmosphere directly. The same colour can also produce different psychological feelings in different architectural environments. Orderly architectural colour collocation not only can bring people a pleasant and unforgettable feeling but also makes the city more unique charm. Otherwise, the chaotic architectural colour can only bring colour pollution; in the long run, it will cause people’s visual fatigue but also cause damage to the image of the city.Architectural colour, as an important factor of urban landscape, directly affects people’s visual and spiritual feelings. Different colour can produce different psychological experience, and the association that colour place introduces and feeling, the creation that concerns environmental atmosphere directly. The same colour can also produce different psychological feelings in different architectural environments. Orderly architectural colour collocation not only can bring people a pleasant and unforgettable feeling but also makes the city more unique charm. Otherwise, the chaotic architectural colour can only bring colour pollution; in the long run, it will cause people’s visual fatigue but also cause damage to the image of the city. The information conveyed by colour plays an irreplaceable role. People no longer only stay in the visual level but begin to pay more attention to the impact of colour on people’s spiritual world [3]. Under the impetus of lacquer craft development, wooden structure utensils represented by black and red eventually replaced bronze utensils and were widely used. For the purpose of protecting wood, with the development of lacquer technology and colouring technology, Chinese wood structure architecture slowly presents rich colours. Wooden structure building gradually from the original colour to a variety of colour development, from architectural colour to material colour, as well as architectural colour painting, reflect a huge difference. The main colours of traditional wooden structure buildings reflect two extremes due to different architectural functions, namely, “low-key and elegant” and “rich and colourful.” Under the influence of the view of nature, Chinese traditional wooden structure buildings also reflect the characteristics of respecting nature. Wooden structure residential buildings often use local materials and make use of the colour of building materials themselves. Due to the difference of natural environment, human environment, and social background, the application of colour in Chinese traditional wooden structure architecture reflects different characteristics in different air. The traditional wooden structure architecture has experienced thousands of years of development. Under the interweaving of regional culture and national culture with different characteristics in China, the colour system of wooden structure architecture with national characteristics has been developed, and its differences are reflected in different wooden structure architecture. Wood construction is a kind of art, image colour regulation is also an important part of architectural art, and how to obtain real colour through colour regulation has become the primary problem to be solved at present.


## 2. Related Work

Colour mapping algorithm will use different mapping functions for different local areas of the image according to the neighbourhood information of the image pixels in the process of mapping. In the process of local colour mapping, the values of two pixels with the same gray value may be different after mapping, and the values of two pixels with different gray value may be the same after mapping. This can enhance the local contrast of the image, but there may be visual defects such as gradient inversion and halo phenomenon. Fan et al. proposed a multiscale Retinex colour mapping algorithm based on human visual model. The algorithm can achieve dynamic range compression of images by eliminating the influence of illumination to obtain the reflected images reflecting the essential features of images. However, this method will produce halo phenomenon at the high-contrast edge of the image. Colour mapping using multiscale algorithm can reduce the halo phenomenon but will not completely eliminate it [4]. Haindl and Mikes proposed a colour mapping algorithm that is processed in the gradient domain. Firstly, the gradient domain of image brightness component is calculated, and then the larger gradient in the attenuation gradient domain is worth the modified gradient domain. Finally, the compressed image is obtained by solving the Poisson equation. This method can effectively compress the dynamic range of images and avoid visual defects such as gradient inversion and halo phenomenon, but it does not consider the accuracy of human visual system. Areas that are too dark become lighter or areas that are too bright become darker. The scale selection of the local area of the algorithm has a great influence on the mapping result and is prone to halo [5]. Zheng proposed a colour mapping algorithm based on fast bilateral filtering. Fast bilateral filtering is an improvement of bilateral filtering, which greatly improves the time efficiency. Fast bilateral filtering is obtained by piecewise linear approximation and spatial downsampling in the intensity domain of bilateral filtering. Fast bilateral filter is used to divide the image into basic layer and detail layer. Dynamic range compression is performed on the basic layer, and then it is added to the detail layer for subsequent processing to obtain the image after dynamic range compression [6]. Colour mapping using bilateral filtering is easy to produce visual defects such as halo and gradient inversion. Bilateral filter which can effectively filter out image details while preserving image edges is called edge preserving filter. Colour mapping algorithms based on edge preserving filter have been developed vigorously in the following years. This algorithm first transforms the image into a brightness channel and then scales it with an edge preserving filter. The filtering result of the original image is the basic layer, and the difference between the original image and the basic layer is the detail layer. The dynamic range of the base layer is compressed, and the dynamic range of the detail layer is enhanced. Finally, after combining the basic layer and detail layer, colour restoration is carried out to get the image after colour mapping.In the colour mapping algorithm, it is necessary to maintain the spatial relationship of the image as a basic principle, that is, the details obtained by the filter must be returned to the image by certain technical means. The colour mapping algorithm based on edge preserving filter has a very good image effect. Spreitzer et al. proposed the weighted least squares filter, which is an edge-preserving filter based on the weighted least squares framework, which can extract details of any scale while preserving edges and avoid halo effect and gradient inversion [7]. Masaoka et al. proposed the guidance filter, which processes the input image through a guidance image, so that the output image is similar to the input image in general but similar to the guidance image in texture. Guided filtering can overcome the problem of gradient inversion of bilateral filtering, but image processing will have halo phenomenon [8]. Sikudova et al. proposed the 0L smoothing filter, which performs edge preservation and smoothing on the image under the constraint of the minimum norm of 0L [9]. Lee et al. proposed the local edge-preserving filter, which defined the prominent edge as a relatively large local gradient, defined the detail as the local extreme value of the image, and then calculated the filtered value through energy function operation [10]. Pytlarz et al. proposed the gradient domain guided filter, which is an edge-preserving filter based on the guided filter and combined with explicit first-order edge perception constraints. The gradient domain guided filtering can maintain the edge of the image better than the guided filtering and reduce the halo phenomenon in the image [11]. Wan et al. proposed a local colour mapping algorithm based on photographic model while proposing a global colour mapping algorithm based on average logarithmic brightness. They partitioned the dynamic range of the scene and the display device. Firstly, the dynamic range of the display device was divided into 11 regions, and then the average log value of the scene brightness was corresponding to region 5, and the dynamic range of the scene was divided into regions according to the maximum and minimum brightness values in the scene [12]. At present, there are many filtering technologies, but there is still no one to achieve a wide range of applications, so the problem that needs to be considered is how to enhance the adaptive filter, so that the filter noise elimination effect is improved and tends to be stable. The edge structure filtering technique can eliminate the noise and save the structure information of the image, which is beneficial to the subsequent processing of the image. The edge preserving filtering technique is such a filtering method that can best preserve edge and detail while removing noise.Masaoka et al. proposed a colour mapping algorithm based on histogram, which can maintain visibility in various scenes with high dynamic range. This algorithm adds a new histogram adjustment technique on the basis of local adaptive brightness of scene. The luminance histogram is first created, and then the cumulative probability density function is calculated, which is mapped according to the maximum and minimum luminance after histogram and mapping. At the same time, the algorithm combined the human contrast sensitivity, glare, spatial sensitivity, and colour sensitivity models to make the mapped image have a better visual experience [13]. Zhang et al. proposed a global colour mapping algorithm based on mean logarithmic compression. The method first calculates the average logarithmic brightness value of the image. In practice, they find that the average pixel brightness is always mapped to 18% of the average scene display range, thus establishing the compression equation. Then the image is linearly compressed, and the dynamic range of the image is mapped to the dynamic range that can be displayed by the display device [14]. Xu et al. proposed an adaptive logarithmic colour mapping algorithm based on base number. Human eyes have a similar sensitivity to luminance changes as logarithmic function, so logarithmic mapping can achieve good results. The algorithm simulates the human eye’s response to light and compresses the luminance logarithmically. The deviation energy function is used to change the logarithmic base adaptively so that the mapped image has good detail information and contrast. Meanwhile, gamma correction was used to enhance the contrast of dark areas [15]. Poppiel et al. proposed a colour mapping algorithm based on linear mapping and histogram equalization, which combined linear mapping and histogram equalization, taking into account both the pixel value of the image and the pixel distribution of the image, achieving good results. Firstly, global histogram mapping is used to compress the dynamic range; then the image is segmented, and the local area of the image is adjusted adaptively to enhance the local contrast, so as to obtain better image quality [16]. Xu et al. proposed a colour mapping algorithm based on histogram and human visual model. The algorithm uses brightness histograms to build lookup tables for colour mapping. Firstly, the high dynamic range image is transformed into brightness channel, and then the histogram is constructed according to the threshold and intensity curve of human visual model. At the same time, in order to avoid excessive compression and excessive enhancement, the improved histogram is obtained by removing the pixels in the histogram that cannot be distinguished by HVS in consideration of the visual contribution of each pixel in the histogram. Combined histograms are obtained by weighting original histograms and improved histograms. Finally, LUT is created and the mapping process and colour restoration are carried out to obtain the corresponding low dynamic range image. Colour mapping algorithms based on histogram and human visual model are relatively simple and efficient and can produce visually pleasing colour mapping images [17]. Kim et al. proposed an image adjustment method based on Gaussian pyramid. By calculating the average difference and standard deviation of RGB images; the colour emission equation is constructed to compensate the colour and complete the colour adjustment of the image [18].This paper will study how to extract the colour features of the building image and analyse the processing effect of the mapping algorithm by establishing the colour mapping image colour adjustment method to provide reference for the subsequent research. It overcomes the phenomenon of colour distortion caused by ignoring colour component guide in traditional colour mapping algorithm.


## 3. Research on Colour Mapping Knowledge Recognition Algorithm

### 3.1. Overview of Colour Map Recognition Algorithm

Colour mapping compresses the high dynamic range of the real world so that it can be optimally displayed on low dynamic range devices. Colour mapping is established from high dynamic range to low dynamic range, and the compressed dynamic can optimize the brightness information of the actual scene, which is displayed on the common low dynamic range equipment, giving the observer a matching observation experience. This is the essence of all colour mapping algorithms. It can be defined mathematically as follows:(1)T:Ld=TLw,Ld∈D,Lw∈W.In the above formula,T represents the colour mapping operator, namely TMO; D is the set of luminance values of the display device; W is the set of luminance values of the actual scene; Ld and Lw represent the luminance values of the display device and the actual scene, respectively.The colour mapping framework based on image detail preservation firstly uses image filtering technology to filter the input image, which is decomposed into low frequency image corresponding to image edge contour information (also known as base layer image) and high frequency image corresponding to image texture detail information (also known as detail layer image). The first mapping results are added, and the final mapping result is obtained by the second mapping of the merged image. The two-colour mapping processes in the framework all use colour mapping methods, and different algorithms can be selected according to the actual mapping effect. Figure1 shows a block diagram of a typical colour mapping system.Figure 1
Tone mapping system framework diagram.Colour mapping algorithms can be divided into two types: one is spatial invariant algorithm, also known as global dynamic range compression. This algorithm applies the same transformation curve to each pixel when transforming the dynamic range of the image [19]. The transformation curve can be specified in advance or obtained according to the content of the image. Exponential transformation or logarithmic transformation are commonly used, because these two kinds of curves are more consistent with the human visual model curve. Different visual effects can be obtained according to different transformation curves. This mapping algorithm is relatively simple and efficient. Compared with traditional mapping algorithms, it uses the same transformation curve for each pixel in the image, which is actually a point processing that separates each pixel without considering the influence of the neighbourhood on the pixel. Fixed transformation curve cannot adapt to different regions of the image, resulting in a certain loss of detail, brightness, and colour of the mapped image. The other is spatial correlation algorithm, also known as local dynamic range compression algorithm. This kind of algorithm is not for a single pixel processing, but according to the pixel neighbourhood different transformation. When transforming the gray value of a point in the image, the spatial information of the point is also taken into account. Therefore, two pixels with the same value in an image may have different mapping values after mapping, and originally different pixel values may be mapped to the same value after mapping.


### 3.2. Identify the Flow of Algorithms

The recognition algorithm firstly transforms the high dynamic range image into luminance channel and takes logarithm and normalization for preprocessing. Then, scale decomposition process, using filter for filtering, get the basic layer and the details of the corresponding layer, using the basic layer recognition algorithm based on histogram and the method of human visual model to create dynamic range compression, both efficient and effective compression basic layer, and accord with human visual characteristic, making the compressed image contrast effect very good; it is superior to other s-shaped curves for basic layer compression. The detail layer is enhanced by S-curve processing, which not only stretches the contrast but also conforms to human visual characteristics [20]. At the same time, there is no gradient inversion, which makes the detail information of the resulting image richer. The treated basic layer and detail layer are combined to obtain the treated brightness channel value. At last, after postprocessing, abnormal pixels were removed to remove noise; normalization and colour correction were carried out to obtain the low dynamic range image. The process of identifying the algorithm is shown in Figure 2.Figure 2
Identify the flow chart of the algorithm.In the colour mapping algorithm, independent dynamic range compression for R, G, and B channels can produce better colour reproduction and mapping results. The local colour mapping algorithm compresses the three channels independently, which leads to colour distortion. Therefore, the local colour mapping algorithm can effectively separate the colour information and brightness information of the image, while preserving the colour information of the image. For the preprocessing of the algorithm, we first transform it into grayscale image, then perform a preliminary logarithmic compression transformation, and finally normalize the brightness channel.


### 3.3. Linear Mapping Algorithm

Linear mapping is the simplest mapping method, which maps the maximum and minimum brightness values in the high dynamic image to the maximum and minimum brightness values of the display device, respectively, and the brightness values in the middle are mapped to this range according to the corresponding mapping relationship [21]. A linear transformation method is given in this paper. The transformation formula used is as follows:(2)Ld=mLw,(3)m=1.219−Ld0.41.219−Lw0.42.5.Ld and Lw indicate the brightness that can be represented by the display device and the illumination value of the actual scene, respectively.In the implementation of this system, two linear mapping operators are compared. One is to setm in formula (2) as a constant, which is valued as 150 here, and the other is to use the following linear mapping operators:(4)ξ=logξh−logξhminlogξhmax−logξhmax×255.The above mapping operator is to map all the brightness values of the actual scene to and then multiply to restore to the dynamic range of the common display device.Linear mapping operator has a small amount of calculation, and this algorithm can achieve good results when the dynamic range of the scene is not much different from that of the display device. However, for high dynamic images, many highlights and dark scene details will be lost. In addition, this method does not consider the absolute radiation intensity of the scene at all, so it may lead to the same image mapped to the same scene under sunlight in the day and weak light at night, and the overall impression information of brightness of the scene is lost.Because the change of logarithmic relation is very close to the pattern of human eye’s response to the change of light intensity, the logarithmic relation equation can be used to compress the data of high dynamic range image to achieve a better effect. This paper proposes a logarithmic mapping relation:(5)Ld=logLw−1logLwmax−1.For each pixel,Ld is the light intensity displayed by the display device, Lw is the light intensity of the actual scene, and Lmax is the maximum light intensity in the actual scene. This mapping ensures that no matter what the dynamic range of the actual scene is, the highest light intensity is always mapped (white) and the rest of the light intensity is smoothly mapped onto the display device. This method is good for high dynamic range images with high contrast, but it cannot reproduce very dark and very bright image scenes simultaneously. Therefore, this mapping operator is suitable for high dynamic images without extreme brightness scenes.This paper improved the formula and proposed a new logarithm equation:(6)Ld=Ldmax×0.01logLwmax−1×logLw−1log2Lw+Lwmax.The equation is adaptive and the mapping factor varies with the brightness pairwise relationship. The basic idea is to use a user control parameter to control the shape of the mapping factor curve and the corresponding brightness range. If there is extreme brightness scene in high dynamic image, the user can adjust the appropriate control parameters according to the characteristics of the image and also get ideal results. In the above formula,Lwmax is the maximum brightness value of the actual scene, and Ldmax is the maximum brightness value that can be displayed by the display device and is used as the quantization parameter for display. Generally, Lw is the brightness value of the actual scene.In order to enable the algorithm to automatically adjust the radix of the logarithm equation for brightness values of different pixels and make it change between 2 and 10, the algorithm adopts an adaptive logarithm radix calculation equation:(7)St=tlogb/log0.5.Here is the parameter that can be adjusted by userB, which has a significant influence on the bright area and dark area of the image. The recommended value range is 0.5–1.0.Another point to note about this algorithm is that the data used to map highly dynamic images is done in colour space. In the algorithm, firstly, to the input of high dynamic image data from colour space conversion, for the space in the space, the channel value is the brightness of the original image; the channel into the formula (6) to calculate the value of the generation Y compressed the brightness values of high dynamic, and then brightness value data is converted to RGB colour space; you can get the final output effect.


### 3.4. Colour Mapping Image Colour Adjustment Method

On the basis of the image correction results, the response curves of channels R, G, and B were set, and the illuminance value of each image pixel point in the corresponding channel was obtained through the response curve [9, 10]. The gain coefficient was extracted from the illuminance value by the colour mapping algorithm, and the colour adjustment was completed through the gain parameters. The specific process is as follows. The global colour mapping algorithm is adopted to compress the illumination value of the wooden building into the gray value of the image:(8)DE=Dmax−Dmin×logEmin−1logEmax−1.In the formula,E represents the illuminance value of wood-framed buildings, and D represents the Gray value of wood-framed buildings. Emax represents the maximum illuminance of wood structure buildings, and Emin represents the minimum illuminance of wood structure buildings. Dmax represents the maximum and Dmin the minimum of wood construction gray scale.According to the above formula, the average illuminance can be obtained as(9)E¯=exp1N∑x,ylog−Ex,y,where N represents the total number of pixel points in the image and E (x, y) represents the illuminance value of a certain point.Determine the median value as shown in(10)k=A×BlogEmax−logE,where the value of k is [0,1] and A and B represent constants.The offset at the solution of formula (10) is calculated by Newton iteration method:(11)k=logE¯−τ−logEmin−τlogE¯max−τ−logEmin−τ,where τ represents the offset. Colour level mapping is performed by offsets of retro architectural images:(12)DR=DRmax−DRmin.Extract the level mapping image of the colour channel:(13)kr=∑i=1M∑j=1NRij+∑i=1M∑j=1NGij+∑i=1M∑j=1NBij∑i=1M∑j=1NRij.Use gain coefficient to adjust colour:(14)DR′=DR×kr,DG′=DG×kg,DB′=DB×kb.


## 3.1. Overview of Colour Map Recognition Algorithm

Colour mapping compresses the high dynamic range of the real world so that it can be optimally displayed on low dynamic range devices. Colour mapping is established from high dynamic range to low dynamic range, and the compressed dynamic can optimize the brightness information of the actual scene, which is displayed on the common low dynamic range equipment, giving the observer a matching observation experience. This is the essence of all colour mapping algorithms. It can be defined mathematically as follows:(1)T:Ld=TLw,Ld∈D,Lw∈W.In the above formula,T represents the colour mapping operator, namely TMO; D is the set of luminance values of the display device; W is the set of luminance values of the actual scene; Ld and Lw represent the luminance values of the display device and the actual scene, respectively.The colour mapping framework based on image detail preservation firstly uses image filtering technology to filter the input image, which is decomposed into low frequency image corresponding to image edge contour information (also known as base layer image) and high frequency image corresponding to image texture detail information (also known as detail layer image). The first mapping results are added, and the final mapping result is obtained by the second mapping of the merged image. The two-colour mapping processes in the framework all use colour mapping methods, and different algorithms can be selected according to the actual mapping effect. Figure1 shows a block diagram of a typical colour mapping system.Figure 1
Tone mapping system framework diagram.Colour mapping algorithms can be divided into two types: one is spatial invariant algorithm, also known as global dynamic range compression. This algorithm applies the same transformation curve to each pixel when transforming the dynamic range of the image [19]. The transformation curve can be specified in advance or obtained according to the content of the image. Exponential transformation or logarithmic transformation are commonly used, because these two kinds of curves are more consistent with the human visual model curve. Different visual effects can be obtained according to different transformation curves. This mapping algorithm is relatively simple and efficient. Compared with traditional mapping algorithms, it uses the same transformation curve for each pixel in the image, which is actually a point processing that separates each pixel without considering the influence of the neighbourhood on the pixel. Fixed transformation curve cannot adapt to different regions of the image, resulting in a certain loss of detail, brightness, and colour of the mapped image. The other is spatial correlation algorithm, also known as local dynamic range compression algorithm. This kind of algorithm is not for a single pixel processing, but according to the pixel neighbourhood different transformation. When transforming the gray value of a point in the image, the spatial information of the point is also taken into account. Therefore, two pixels with the same value in an image may have different mapping values after mapping, and originally different pixel values may be mapped to the same value after mapping.


## 3.2. Identify the Flow of Algorithms

The recognition algorithm firstly transforms the high dynamic range image into luminance channel and takes logarithm and normalization for preprocessing. Then, scale decomposition process, using filter for filtering, get the basic layer and the details of the corresponding layer, using the basic layer recognition algorithm based on histogram and the method of human visual model to create dynamic range compression, both efficient and effective compression basic layer, and accord with human visual characteristic, making the compressed image contrast effect very good; it is superior to other s-shaped curves for basic layer compression. The detail layer is enhanced by S-curve processing, which not only stretches the contrast but also conforms to human visual characteristics [20]. At the same time, there is no gradient inversion, which makes the detail information of the resulting image richer. The treated basic layer and detail layer are combined to obtain the treated brightness channel value. At last, after postprocessing, abnormal pixels were removed to remove noise; normalization and colour correction were carried out to obtain the low dynamic range image. The process of identifying the algorithm is shown in Figure 2.Figure 2
Identify the flow chart of the algorithm.In the colour mapping algorithm, independent dynamic range compression for R, G, and B channels can produce better colour reproduction and mapping results. The local colour mapping algorithm compresses the three channels independently, which leads to colour distortion. Therefore, the local colour mapping algorithm can effectively separate the colour information and brightness information of the image, while preserving the colour information of the image. For the preprocessing of the algorithm, we first transform it into grayscale image, then perform a preliminary logarithmic compression transformation, and finally normalize the brightness channel.


## 3.3. Linear Mapping Algorithm

Linear mapping is the simplest mapping method, which maps the maximum and minimum brightness values in the high dynamic image to the maximum and minimum brightness values of the display device, respectively, and the brightness values in the middle are mapped to this range according to the corresponding mapping relationship [21]. A linear transformation method is given in this paper. The transformation formula used is as follows:(2)Ld=mLw,(3)m=1.219−Ld0.41.219−Lw0.42.5.Ld and Lw indicate the brightness that can be represented by the display device and the illumination value of the actual scene, respectively.In the implementation of this system, two linear mapping operators are compared. One is to setm in formula (2) as a constant, which is valued as 150 here, and the other is to use the following linear mapping operators:(4)ξ=logξh−logξhminlogξhmax−logξhmax×255.The above mapping operator is to map all the brightness values of the actual scene to and then multiply to restore to the dynamic range of the common display device.Linear mapping operator has a small amount of calculation, and this algorithm can achieve good results when the dynamic range of the scene is not much different from that of the display device. However, for high dynamic images, many highlights and dark scene details will be lost. In addition, this method does not consider the absolute radiation intensity of the scene at all, so it may lead to the same image mapped to the same scene under sunlight in the day and weak light at night, and the overall impression information of brightness of the scene is lost.Because the change of logarithmic relation is very close to the pattern of human eye’s response to the change of light intensity, the logarithmic relation equation can be used to compress the data of high dynamic range image to achieve a better effect. This paper proposes a logarithmic mapping relation:(5)Ld=logLw−1logLwmax−1.For each pixel,Ld is the light intensity displayed by the display device, Lw is the light intensity of the actual scene, and Lmax is the maximum light intensity in the actual scene. This mapping ensures that no matter what the dynamic range of the actual scene is, the highest light intensity is always mapped (white) and the rest of the light intensity is smoothly mapped onto the display device. This method is good for high dynamic range images with high contrast, but it cannot reproduce very dark and very bright image scenes simultaneously. Therefore, this mapping operator is suitable for high dynamic images without extreme brightness scenes.This paper improved the formula and proposed a new logarithm equation:(6)Ld=Ldmax×0.01logLwmax−1×logLw−1log2Lw+Lwmax.The equation is adaptive and the mapping factor varies with the brightness pairwise relationship. The basic idea is to use a user control parameter to control the shape of the mapping factor curve and the corresponding brightness range. If there is extreme brightness scene in high dynamic image, the user can adjust the appropriate control parameters according to the characteristics of the image and also get ideal results. In the above formula,Lwmax is the maximum brightness value of the actual scene, and Ldmax is the maximum brightness value that can be displayed by the display device and is used as the quantization parameter for display. Generally, Lw is the brightness value of the actual scene.In order to enable the algorithm to automatically adjust the radix of the logarithm equation for brightness values of different pixels and make it change between 2 and 10, the algorithm adopts an adaptive logarithm radix calculation equation:(7)St=tlogb/log0.5.Here is the parameter that can be adjusted by userB, which has a significant influence on the bright area and dark area of the image. The recommended value range is 0.5–1.0.Another point to note about this algorithm is that the data used to map highly dynamic images is done in colour space. In the algorithm, firstly, to the input of high dynamic image data from colour space conversion, for the space in the space, the channel value is the brightness of the original image; the channel into the formula (6) to calculate the value of the generation Y compressed the brightness values of high dynamic, and then brightness value data is converted to RGB colour space; you can get the final output effect.


## 3.4. Colour Mapping Image Colour Adjustment Method

On the basis of the image correction results, the response curves of channels R, G, and B were set, and the illuminance value of each image pixel point in the corresponding channel was obtained through the response curve [9, 10]. The gain coefficient was extracted from the illuminance value by the colour mapping algorithm, and the colour adjustment was completed through the gain parameters. The specific process is as follows. The global colour mapping algorithm is adopted to compress the illumination value of the wooden building into the gray value of the image:(8)DE=Dmax−Dmin×logEmin−1logEmax−1.In the formula,E represents the illuminance value of wood-framed buildings, and D represents the Gray value of wood-framed buildings. Emax represents the maximum illuminance of wood structure buildings, and Emin represents the minimum illuminance of wood structure buildings. Dmax represents the maximum and Dmin the minimum of wood construction gray scale.According to the above formula, the average illuminance can be obtained as(9)E¯=exp1N∑x,ylog−Ex,y,where N represents the total number of pixel points in the image and E (x, y) represents the illuminance value of a certain point.Determine the median value as shown in(10)k=A×BlogEmax−logE,where the value of k is [0,1] and A and B represent constants.The offset at the solution of formula (10) is calculated by Newton iteration method:(11)k=logE¯−τ−logEmin−τlogE¯max−τ−logEmin−τ,where τ represents the offset. Colour level mapping is performed by offsets of retro architectural images:(12)DR=DRmax−DRmin.Extract the level mapping image of the colour channel:(13)kr=∑i=1M∑j=1NRij+∑i=1M∑j=1NGij+∑i=1M∑j=1NBij∑i=1M∑j=1NRij.Use gain coefficient to adjust colour:(14)DR′=DR×kr,DG′=DG×kg,DB′=DB×kb.


## 4. Research and Analysis of Colour Mapping Knowledge Recognition Algorithm for Wooden Building Image

### 4.1. Image Brightness Deviation

In order to prove the effectiveness of the proposed method of automatic colour adjustment of wooden building image based on colour mapping algorithm, a simulation is needed. The simulation environment is as follows. The platform of MATLAB R2015b is used, and the experimental data is OTB-50 standard dataset. The brightness deviation of the proposed colour mapping algorithm was compared with that of the gradient region segmentation method. The results of automatic colour adjustment method for wood-frame building image based on colour mapping algorithm are shown in Figure3. The result of colour regulation method based on gradient region segmentation is shown in Figure 4.Figure 3
Result diagram of automatic colour adjustment method for wooden building image.Figure 4
Results of colour regulation method based on gradient region segmentation.It can be seen from the figure that the brightness deviation of the image colour adjustment method based on the colour mapping algorithm is relatively low. When the number of experiments is 30, the brightness deviation of the proposed method is 0.29 cd/m2, and that of the colour adjustment method based on the gradient region segmentation is 0.78 cd/m2. The proposed method compensates the brightness of the colour. The image brightness deviation is reduced and the colour resolution is improved. The colour adjustment method based on colour mapping is obviously superior to the colour adjustment method based on gradient region segmentation in terms of average and maximum chromatic aberration. Image solving colour correction function reduces colour distortion so that the original image retains the structural characteristics and improves the colour node effect. Through intuitive visual experience and integrated image details, the algorithm in this chapter has well expanded the dynamic range of the image, made the image have more details, and performed well in colour without colour deviation.


### 4.2. Colour Adjustment Time

A large number of experiments were conducted on 40 wood-framed building images, and the traditional colour adjustment method and colour mapping recognition algorithm were used to conduct the colour adjustment time. The statistical results are shown in Figure5.Figure 5
Results of colour regulation method based on gradient region segmentation.As can be seen from the figure, the average time of the proposed image colour adjustment method based on colour mapping algorithm is 3.25 s, the shortest colour adjustment time is 2.98 s, and the longest colour adjustment time is 3.34 s. Compared with traditional algorithms, the proposed method can effectively reduce the time of colour adjustment by correcting the image colour.


### 4.3. Peak Signal-to-Noise Ratio

In the process of system testing, 40 wooden building images were selected for a large number of experiments, and several building colour template coefficients were obtained. After the relevant template is obtained, the colour component can be encoded, and the obtained colour component can be inverted to obtain the reconstructed image, which is matched with each feature region, and the peak signal-to-noise ratio can be calculated. The calculation formula is as follows:(15)P=lg2552δ,where δ represents the mean square error of the original image. The sample pattern was analysed and its peak signal-to-noise ratio was compared. The analysis results of the statistical system are shown in Figure 6.Figure 6
Peak signal to noise ratio statistical analysis result diagram.It can be seen from the figure that the results of peak SNR analysed by traditional system and this paper differ greatly in different feature areas of wood-frame building images, and the fundamental reason lies in the coding elements corresponding to the correlation template coefficients. In the traditional system, there is no step to encode the image, which leads to high channel pressure. The mean square error of the encoded region and the original region becomes smaller, and the signal-to-noise ratio after coding will be higher, and the mining degree of visualization of colour attribute information of wooden buildings will be higher.


### 4.4. Quality Factor

In order to more objectively compare the application effect of the traditional algorithm with that of the algorithm in this paper, 10 classical wood-framed building pictures are used for the experiment, and the results obtained are shown in Figure7.Figure 7
Comparison diagram of application effect between traditional algorithm and this algorithm.As can be seen from the figure, the average value of the obtained images is the highest, indicating that the image quality after the algorithm mapping is the best. The time complexity of guided filtering is low, but some images after mapping have halo phenomenon. On the basis of guided filtering, filtering can better maintain the image edge and reduce the halo phenomenon. The efficiency of the mapping algorithm is improved by 50%, especially the efficiency of the large image. The recognition algorithm can effectively maintain the details of the image, have good brightness and contrast, display the information of the image highlighting and low dark at the same time, and obtain good image quality.


## 4.1. Image Brightness Deviation

In order to prove the effectiveness of the proposed method of automatic colour adjustment of wooden building image based on colour mapping algorithm, a simulation is needed. The simulation environment is as follows. The platform of MATLAB R2015b is used, and the experimental data is OTB-50 standard dataset. The brightness deviation of the proposed colour mapping algorithm was compared with that of the gradient region segmentation method. The results of automatic colour adjustment method for wood-frame building image based on colour mapping algorithm are shown in Figure3. The result of colour regulation method based on gradient region segmentation is shown in Figure 4.Figure 3
Result diagram of automatic colour adjustment method for wooden building image.Figure 4
Results of colour regulation method based on gradient region segmentation.It can be seen from the figure that the brightness deviation of the image colour adjustment method based on the colour mapping algorithm is relatively low. When the number of experiments is 30, the brightness deviation of the proposed method is 0.29 cd/m2, and that of the colour adjustment method based on the gradient region segmentation is 0.78 cd/m2. The proposed method compensates the brightness of the colour. The image brightness deviation is reduced and the colour resolution is improved. The colour adjustment method based on colour mapping is obviously superior to the colour adjustment method based on gradient region segmentation in terms of average and maximum chromatic aberration. Image solving colour correction function reduces colour distortion so that the original image retains the structural characteristics and improves the colour node effect. Through intuitive visual experience and integrated image details, the algorithm in this chapter has well expanded the dynamic range of the image, made the image have more details, and performed well in colour without colour deviation.


## 4.2. Colour Adjustment Time

A large number of experiments were conducted on 40 wood-framed building images, and the traditional colour adjustment method and colour mapping recognition algorithm were used to conduct the colour adjustment time. The statistical results are shown in Figure5.Figure 5
Results of colour regulation method based on gradient region segmentation.As can be seen from the figure, the average time of the proposed image colour adjustment method based on colour mapping algorithm is 3.25 s, the shortest colour adjustment time is 2.98 s, and the longest colour adjustment time is 3.34 s. Compared with traditional algorithms, the proposed method can effectively reduce the time of colour adjustment by correcting the image colour.


## 4.3. Peak Signal-to-Noise Ratio

In the process of system testing, 40 wooden building images were selected for a large number of experiments, and several building colour template coefficients were obtained. After the relevant template is obtained, the colour component can be encoded, and the obtained colour component can be inverted to obtain the reconstructed image, which is matched with each feature region, and the peak signal-to-noise ratio can be calculated. The calculation formula is as follows:(15)P=lg2552δ,where δ represents the mean square error of the original image. The sample pattern was analysed and its peak signal-to-noise ratio was compared. The analysis results of the statistical system are shown in Figure 6.Figure 6
Peak signal to noise ratio statistical analysis result diagram.It can be seen from the figure that the results of peak SNR analysed by traditional system and this paper differ greatly in different feature areas of wood-frame building images, and the fundamental reason lies in the coding elements corresponding to the correlation template coefficients. In the traditional system, there is no step to encode the image, which leads to high channel pressure. The mean square error of the encoded region and the original region becomes smaller, and the signal-to-noise ratio after coding will be higher, and the mining degree of visualization of colour attribute information of wooden buildings will be higher.


## 4.4. Quality Factor

In order to more objectively compare the application effect of the traditional algorithm with that of the algorithm in this paper, 10 classical wood-framed building pictures are used for the experiment, and the results obtained are shown in Figure7.Figure 7
Comparison diagram of application effect between traditional algorithm and this algorithm.As can be seen from the figure, the average value of the obtained images is the highest, indicating that the image quality after the algorithm mapping is the best. The time complexity of guided filtering is low, but some images after mapping have halo phenomenon. On the basis of guided filtering, filtering can better maintain the image edge and reduce the halo phenomenon. The efficiency of the mapping algorithm is improved by 50%, especially the efficiency of the large image. The recognition algorithm can effectively maintain the details of the image, have good brightness and contrast, display the information of the image highlighting and low dark at the same time, and obtain good image quality.


## 5. Conclusion

With the update and iteration of multimedia equipment, more and more image capture equipment can capture the high dynamic range of natural scenes more accurately. Colour mapping algorithm emerges as The Times require. Colour mapping is a key technology in cross-media image replication. Images store nearly real scene information with rich details and can truly represent various rich information in the natural world. In this paper, the hue mapping algorithm is implemented to enable the mapped image to be displayed on the monitor. In the process of colour mapping, we should try to keep more details, enhance the information with small contrast, keep the corresponding cooler information, and avoid visual defects such as halo. Through the analysis of the tone-mapping algorithm for wooden building image, the effectiveness of the algorithm is verified by subjective and objective experiments. The existing image colour mapping algorithm is studied in detail from the realization principle and application effect of the algorithm. By using the method of colour mapping image colour adjustment, the time of colour adjustment can be reduced effectively. The efficiency of the mapping algorithm is improved by 50%, especially the efficiency of the large image. The recognition algorithm can effectively maintain the details of the image, compared with the traditional algorithm which has better brightness and contrast, while displaying the image highlighting and low dark information, and obtain good image quality. Compared with traditional mapping, algorithm is improved and achieved great success, but the colour mapping algorithm remains a technical problem; how to maintain the effect of improving the efficiency of the algorithm, how to enlarge the scope of the same kind of algorithm, and making it in different brightness of the image can produce good effect, where it is also needed to follow up on constant innovation and improvement.



---

*Source: 1313819-2022-01-12.xml*