# Research on Night Tourism Recommendation Based on Intelligent Image Processing Technology

Authors: Meng Li; Ning Fan
Journal: Scientific Programming
 (2021)

---

## Abstract

The rapid development of the tourism industry and the Internet era has led to an increasingly severe problem of travel information overload, and travel recommendation methods are essential to solving the information overload problem. Traditional recommendation algorithms only target common travel scenarios during the daytime, combining the ratings and necessary attributes between users and items to calculate similarity for a recommendation. Still, the research on night travel recommendations is one of the few scenarios that needs to be explored urgently. This paper, based on histogram equalization, achieves better experimental results on image enhancement, combines convolutional neural network technology with night image and text comment feature extraction technology, and evaluates the resulting error with mean absolute error (MAE). This paper presents the first night travel recommendation system. It compares it with the traditional collaborative filtering method, and the model proposed in this paper can effectively reduce the prediction error.


---

## Body

## 1. Introduction

Online travel has become a daily travel application, primarily bringing convenience for people to travel and tour. However, with the increasing number of travelers and the explosive growth of information on the internet, it is difficult for travel users to quickly find the travel data they need in massive data. The emergence of recommendation systems effectively solved this problem of information overload. A recommendation system [1] refers to a website platform, which digs the explicit and implicit information of users to determine their preferences, and selects the N products that best match them, thus helping them to make efficient choices. In order to further study the recommendation system, people have developed various recommendation algorithms.However, the research on the travel recommendation systems for night scenes has always been a problematic research field because the biggest difference between night and day is the significant difference in lighting conditions. It is not perfect to use the data of daytime travel directly for a recommendation. Therefore, this paper presents a feasible solution to solve one of the challenges by using intelligent image processing technology. Image enhancement processing usually does not consider the reason of image quality degradation. However, it only uses specific techniques to selectively highlight the interesting features in the image according to the image features and processing purposes and may suppress another part of the information, so as to improve the visual effect of the image or facilitate the analysis and processing of the picture by humans or computers. Its main purpose is to improve the comprehensibility of the image.Traditional image enhancement methods can be divided into spatial domain and frequency domain methods according to different scopes. The spatial domain method refers to the arithmetic processing of pixel gray values directly in the spatial domain. The commonly used spatial domain methods include grayscale transformation, histogram modification, image space smoothing and sharpening, and pseudo-color processing. The frequency domain method enhances the transform value of the image in a certain transform domain and then obtains the enhanced image through inverse transformation.Commonly used recommendation algorithms include content-based recommendation algorithm, collaborative filtering recommendation algorithm, CF recommendation algorithm, and mixed recommendation algorithm [2]. Content-based recommendation algorithm analyzes the users’ historical content data, builds an interest model, and recommends similar interesting items to users. However, the biggest problem with this algorithm is that the recommendation domain is narrow. The collaborative filtering algorithm only relies on the historical data of users to obtain a group of users with similar interests and then recommends this group of users’ preference items to the target users [3]. The hybrid recommendation algorithm is the most effective algorithm to solve the shortcomings of various algorithms in theory, but the design of this algorithm is relatively complex.In recent years, artificial intelligence is in full swing. As an important research direction in artificial intelligence, deep learning has penetrated into various industries. Deep learning can deeply mine data features in image, text, and natural language processing and has made some progress, especially for hidden information which is easy to be ignored. In traditional tourism recommendation models, predictions are only based on the scores between tourists and scenic spots, which lack the information about the characteristics and attributes of tourists and scenic spots and tourists’ evaluation of tourism experience. A multimodal recommendation algorithm based on deep multimodal learning is proposed, which establishes the feature representation between multimodal features in videos and effectively obtains more information. Gao and Xu [4] used the recursive neural network to process the time series data of users and movies, so as to recommend movies more accurately. They used long-term and short-term memory units to accumulate historical states at long distances, which ultimately improve the accuracy of recommendation.However, most of the current standard recommendation systems are based on textual review features and recommendations made by daytime well-lit tourist attraction picture features. Despite these, travel suggestions under low light conditions at night are still tasted because of low visibility, or travel suggestions during the day are directly adopted. This paper mainly studies the complex problem of night travel recommendations under the general lighting conditions. In this paper, the night travel recommendation model is designed by using a histogram equalization-based night image enhancement algorithm and collaborative filtering combined with the convolutional neural network.


## 2. Materials and Methods

### 2.1. Common Methods and Quality Evaluation of Image Enhancement for Night Tourist Attraction

Usually, the acquired images cannot be processed directly by using the computer and must be converted into digital images before processing can be performed. The process of digitization consists of 3 steps: scanning, sampling, and quantization. From the computer’s point of view, a digital image can be seen as an image obtained by sampling and quantizing a two-dimensional functionf(x, y), i.e., after discrete processing. Therefore, an image is usually represented by a two-dimensional matrix. When an image is generated from a physical process, its value is usually proportional to the radiated energy of the physical source (e.g., electromagnetic waves). Therefore, f(x, y) must be nonzero and finite.Digitizing an image will result in a two-dimensional matrix of integers, as in equation (1), which defines a digital image of size M∗N:(1)fx,y=f0,0f0,1…f0,N−1f1,0f1,1…f1,N−1…………fM−1,0fM−1,1…fM−1,N−1,where each element of the matrix is called an image unit, image element, or pixel.


#### 2.1.1. Night Image Enhancement Basic Method

Image enhancement techniques usually have two types of methods: spatial domain methods and frequency domain methods. Spatial domain enhancement methods target direct processing of pixel grayscale values. Common ones are grayscale transformations, image smoothing and sharpening in the null domain, histogram correction, pseudo-color processing, etc. Frequency domain enhancement methods are based on the Fourier transform of the image to enhance or suppress the desired spectrum, thus achieving an improvement of the image spectrum.(1) Grayscale Transformation. Grayscale transformation is one of the simplest and most important means of image enhancement techniques. Grayscale transform extends the image contrast to obtain a clearer image. It corrects the grayscale of the input pixels, and the grayscale transform can be expressed as(2)gx,y=Tfx,y,where T denotes the function relationship between the input gray value and the output gray value. According to different application requirements and the nature of the function, the following grayscale transformation methods can be used.For a given grayscale space, let the grayscale transformation range of the original imagef(x, y) be [a, b] and the grayscale extension of the transformed image g(x, y) be [c, d]; then, a proportional linear grayscale change can be used to achieve.(3)gx,y=d−ca−bfx,y−a+c.The proportional linear grayscale transform operation is relatively simple, and it can effectively change the image visual effect.And the segmented linear transform has a better enhancement effect in stretching the gray details of feature objects and suppressing the uninteresting gray levels with the following mathematical expressions:(4)gx,y=cafx,y0≤fx,y≤a,d−cb−afx,y−a+ca≤fx,y≤b,f−de−bfx,y−b+db≤fx,y≤e.(2) Histogram Correction. The histogram of an image represents the statistical relationship between each gray level and its frequency. Usually, the horizontal coordinate represents the gray level, and the vertical coordinate represents the frequency. According to the definition of the histogram, it can be expressed as(5)prk=nkNk=0,1,…,L−1,where N is the total number of pixels in an image, nk denotes the number of pixels at the kth gray level, rk is the kth gray level, L is the number of gray levels, and p(rk) denotes the relative frequency of the occurrence of that gray level.Histogram is the main means to reflect the general characteristics of a digital image. It gives information about the grayscale range, the grayscale distribution, the average brightness, and the contrast between light and dark of a digital image, which is an important basis for further processing of digital images.The histogram equalization method is a common grayscale enhancement algorithm that transforms a known grayscale probability density distribution into a new image with a uniform grayscale probability density distribution to enhance the overall contrast of the image.Assuming that the number of pixels in an image isn, there are l gray levels, and nk represents the number of pixels with a gray level of gas, the probability of the occurrence of the kth gray level can be expressed as(6)prk=nkn,where 0 ≤ rk ≤ 1 andk=0,1,…,L−1. The transformation function T(r) is(7)sk=Trk=∑j=0kPrrj=∑j=0knjn.From the above calculation process, it can be seen that the statistical value of the histogram of the original input image can calculate the grayscale value of each pixel after equalization. The histogram equalization results in the stretching of the dense grayscale distribution and the compression of the sparse grayscale distribution, thus enhancing the overall contrast of an image.However, the traditional histogram equalization algorithm is processed for the whole image, so there are some insurmountable defects: (1) the brightness information of the original image is not retained, and the grayscale is approximately uniformly distributed in the processed image, so the average brightness is always around the median of the grayscale range; (2) the phenomenon of parsimony occurs in the process, i.e., some low-frequency grayscale may be combined, and the total grayscale level will be lost, thus causing the loss of image details. For these drawbacks, some improvement methods are listed in the next section of this paper.


#### 2.1.2. Image Quality Evaluation Criteria

Image quality evaluation [5] is one of the basic techniques of image information engineering, and there are two kinds of subjective and objective evaluations. Subjective evaluation is to let observers make quality judgments on test images according to visual effects based on some predefined evaluation scales or their own experiences and give quality scores, and finally, the scores given by all observers are weighted and averaged, and the result is the subjective quality evaluation of the image. The subjective evaluation is determined by some subjective factors such as individual knowledge background, observation purpose, and prevailing environment because different individuals evaluate the same image. The two commonly used subjective evaluation methods are the absolute scale grading method and the relative scale grading method.(1) Mean Value. The mean value indicates the average value of image grayscale, which reflects the image illumination situation.(2) Mean Square Error. The mean square error, also called the mean squared error of the image gray value, reflects the dynamic range of the image gray value. Let f(i, j) denote the original image, f^i,j denote the distorted image of f(i, j), and the mean square error between f(i, j) and f^i,j for any i and j is(8)MSE=∑i=0M−1∑j=0N−1fi,j−f^i,j2MN,where M and N denote the height and width of the image, respectively. Obviously, the smaller the MSE value is, the more similar the two images are before and after information hiding.(3) Information Entropy. For an image with n levels of gray, if the probability of the occurrence of its ith level of gray is pi, then the entropy of that level of gray is(9)ei=−pilogpi.Then, the entropy of the whole image is(10)E=∑i=0n−1ei=−∑i=0n−1pilogpi.(4) Peak Signal-to-Noise Ratio. The peak signal-to-noise ratio is defined as follows:(11)PSNR=10lg∑i,j=1H,W2552∑i,j=1H,Wf^i,j−fi,j,where H and W indicate the height and width of the image, respectively. Usually, a larger PSNR value indicates a better image recovery, but it does not mean that the subjective quality is higher.


### 2.2. Night Image Improvement Algorithm Based on Histogram Equalization

Histogram equalization is one of the very important algorithms in image enhancement. It uses basic knowledge of probability theory to perform gray point operations for the purpose of histogram transformation [6–8]. The essence of the image histogram equalization algorithm is to selectively enhance the low-frequency information and suppress the high-frequency information of the image. After histogram equalization of an image, the grayscale that originally possesses fewer pixels is most likely to be merged. In contrast, the boundaries between image regions that normally occupy fewer pixels contain important structural information, which may cause the loss of image details. In addition, various types of image noise are inevitably present in the image, and then the image noise will be amplified accordingly [7, 9]. Therefore, the traditional histogram equalization algorithm has the disadvantages of image detail information loss and noise amplification.


#### 2.2.1. Improved Algorithm 1

(1)
For each pixel in the original image, it is recorded into the corresponding pixel number accumulatorri according to its grayscale value.(2)
Select the appropriate mapping relationship for the number of pixels. Here,ri = log (ri + 1) is used, and ri and Q=∑i=0m−1ri are calculated, respectively.Calculate the converted grayscale value of grayscalei in the original image.(12)fi=L−1∑k=0i−1rkQ−ri.The grayscale conversion method of the above equation can extend the gray space of the original image so that the converted grayscale values are distributed over the entire gray space.


#### 2.2.2. Improved Algorithm 2

For the grayscalefi(x, y), at level i in the original image grayscale histogram, the position of its corrected grayscale gix,y is determined based on the ratio of ∑k=0i−1Prrk and ∑k=i+1i−1Prrk on its left and right sides using the following equation j:(13)j:l−1−j=∑k=0i−1Prrk:∑k=i+1i−1Prrk.Collate to obtain(14)j=l−1∑k=0i−1Prrk∑k=0i−1Prrk+∑k=i+1i−1Prrk.Furthermore, it is reduced to(15)j=l−1∑k=0i−1Prrk1−Prri=l−1∑k=0i−1nkn−ni.


#### 2.2.3. Improved Algorithm 3

After histogram equalization of the image, the average brightness of the output image usually lies in the middle of the gray level of the image. By using histogram recursive decomposition and segmented equalization, we can achieve multilevel brightness control of the output image, thus avoiding the unnatural enhancement effect caused by too much brightness after enhancement.The basic idea of histogram recursive decomposition and segmented equalization is to use the average luminance as the closed value, decompose the image recursively according to the specified depthr, so as to obtain 2r subimages of different grayscale ranges, then make histogram equalization for each subimage, and finally merge the equalized subimages to obtain the equalization result of the night image. Obviously, when the recurrence depth r is 0, the input image is not decomposed in any way, i.e., in the conventional way. The case when r is 1 is illustrated below, and so on for other cases.First, the original imageX is divided into two subgraphs X1 and X2, with the grayscale mean value Gm as the threshold, i.e.,(16)X1=xi,j|GX≤Gm,X2=xi,j|Gx>Gm.Next, the histograms are counted for each of the two subplots and equalized in the grayscale range on each side of the respective mean.(17)p1Gk=n1kn1,k=0,1,2,...,m,C1k=∑k=0mp1k,Y1=f1X1,while,Gy=GmCGx.Then, the processed subgraphs are merged:(18)Y=Y1∪Y2.Since the segmentation, processing, and merging are performed in grayscale dependence, the spatial location of the enhanced pixels does not change. Similarly, according to the recurrence depth, the image is decomposed into 2r subimages according to the average luminance, then each of them is histogram equalized, and finally, the equalized subimages are merged. Then, the average luminance of the output image is(19)EY=1−12rGm+12rGc.From the above equation, we can see that the greater the depth of decomposing the image is, the closer the average brightness of the final image obtained will be to the average brightness of the input image. Therefore, we can use differentr values to achieve luminance control. The above method can automatically extend the range of image gray levels and, at the same time, can control the average luminance of the output image with better enhancement effect. However, there is still the disadvantage of gray level merging, and the image gray level average value is still offset.


### 2.3. Night Tour Recommendation Model Design

This paper improves the feature recognition of night attraction images by combining the techniques of night image enhancement in the previous section. Combining convolutional neural networks and collaborative filtering methods, we extract and classify the factor features in night attraction images and visitor text reviews by convolutional neural networks and predict the user item ratings by using collaborative filtering methods. Among them, the convolutional neural network for mining features in reviews can effectively alleviate the data sparsity problem in the collaborative filtering method [10], and the method can retain the advantages of shared experience and personalization in the collaborative filtering method.


#### 2.3.1. Collaborative Filtering Recommendation Algorithm

As the most widely used recommendation algorithm, the core idea of collaborative filtering is to calculate the similarity between users or items to achieve recommendations. User-based collaborative filtering recommendation algorithm calculates the similarity between users, establishes the nearest-neighbor user group, and then recommends the products of interest in the nearest-neighbor group to the target users; item-based collaborative filtering recommendation algorithm calculates the similarity between items; model-based collaborative filtering recommendation algorithm combines some intelligent models to train and test the data in order to obtain the user’s preference information more effectively to achieve recommendations.In order to find users or items in close proximity, similarity calculation is the key. The most commonly used methods to calculate similarity are Pearson’s method and cosine method [11]. Among them, the Pearson similarity method is more applicable to the calculation of document data and is more comprehensive for different users, which is expressed by the following formula:(20)sima,b=∑i∈Ia,bRa,i−Ra¯Rb,i−Rb¯∑i∈Ia,bRa,i−Ra¯2∑i∈Ia,bRb,i−Rb¯2.Chen et al. [12] used a new dynamic evolutionary clustering algorithm to divide the set of users and items into K clusters and clustered the individuals with high similarity. Collaborative filtering technique is applied to predict among each of the K clusters, and recommendation predictions are made for target users based on the prediction levels obtained from clustering. Bo and Fei [2] used a combined collaborative filtering recommendation algorithm to improve the accuracy utilization of group buying websites using an offline testing method [13–16].


#### 2.3.2. Convolutional Neural Network

Convolutional neural networks (CNNs) are one of the main focuses of research in deep learning [17, 18], and their applications in image processing are quite mature, and they are also widely used for processing text comments. As a feedforward neural network, the basic structure of the CNN is similar to that of other neural networks in that it consists of an input layer, an implicit layer [19–25], and an output layer for data feature extraction, and the implicit layer of the CNN consists of three layers, including convolution, pooling, and full connectivity [3]. The CNN structure is shown in Figure 1, including the convolution layer, pooling layer, and fully connected layer, which are the important neural network structures in this paper.Figure 1
Structure of the convolutional neural network.The purpose of this paper is to design a personalized night tour recommendation model, and to address the problem of data sparsity where it is difficult to mine deep information based on user collaborative filtering recommendation algorithms, convolutional neural networks are selected to classify the night attraction images and review information of tour data for deep extraction. The text comments of tourists on tourism contain emotional factors about the tourism process, which are divided into two categories: positive and negative. The basic information, behavioral information, and contextual information of tourist users are combined to form tourist user data to solve the problem of single data.In this paper, in addition to the night landscape features after data enhancement, text features are also required in the tourism recommendation model, which mainly considers three major elements of user data: basic information, behavioral information, and contextual information. The vectorized tourism user review data matrix is sent to the convolutional neural network for training to get the positive and negative emotions of tourists towards the project, and then the processed tourism data are used for similarity calculation. The structure of the travel recommendation model is shown in Figure2.Figure 2
Structure of the recommended model.The basic information of the user is expressed as(21)P=α1age+α2sex+α3place.The behavioral information of travel users is expressed as(22)S=β1demand+β2prefer+β3consume.The emotional information of travel users is expressed as(23)Q=γ1time+γ2location+γ3intact.The textual feature information of the night tour recommendation information is expressed as(24)TR=αP+βS+γQ.


## 2.1. Common Methods and Quality Evaluation of Image Enhancement for Night Tourist Attraction

Usually, the acquired images cannot be processed directly by using the computer and must be converted into digital images before processing can be performed. The process of digitization consists of 3 steps: scanning, sampling, and quantization. From the computer’s point of view, a digital image can be seen as an image obtained by sampling and quantizing a two-dimensional functionf(x, y), i.e., after discrete processing. Therefore, an image is usually represented by a two-dimensional matrix. When an image is generated from a physical process, its value is usually proportional to the radiated energy of the physical source (e.g., electromagnetic waves). Therefore, f(x, y) must be nonzero and finite.Digitizing an image will result in a two-dimensional matrix of integers, as in equation (1), which defines a digital image of size M∗N:(1)fx,y=f0,0f0,1…f0,N−1f1,0f1,1…f1,N−1…………fM−1,0fM−1,1…fM−1,N−1,where each element of the matrix is called an image unit, image element, or pixel.


### 2.1.1. Night Image Enhancement Basic Method

Image enhancement techniques usually have two types of methods: spatial domain methods and frequency domain methods. Spatial domain enhancement methods target direct processing of pixel grayscale values. Common ones are grayscale transformations, image smoothing and sharpening in the null domain, histogram correction, pseudo-color processing, etc. Frequency domain enhancement methods are based on the Fourier transform of the image to enhance or suppress the desired spectrum, thus achieving an improvement of the image spectrum.(1) Grayscale Transformation. Grayscale transformation is one of the simplest and most important means of image enhancement techniques. Grayscale transform extends the image contrast to obtain a clearer image. It corrects the grayscale of the input pixels, and the grayscale transform can be expressed as(2)gx,y=Tfx,y,where T denotes the function relationship between the input gray value and the output gray value. According to different application requirements and the nature of the function, the following grayscale transformation methods can be used.For a given grayscale space, let the grayscale transformation range of the original imagef(x, y) be [a, b] and the grayscale extension of the transformed image g(x, y) be [c, d]; then, a proportional linear grayscale change can be used to achieve.(3)gx,y=d−ca−bfx,y−a+c.The proportional linear grayscale transform operation is relatively simple, and it can effectively change the image visual effect.And the segmented linear transform has a better enhancement effect in stretching the gray details of feature objects and suppressing the uninteresting gray levels with the following mathematical expressions:(4)gx,y=cafx,y0≤fx,y≤a,d−cb−afx,y−a+ca≤fx,y≤b,f−de−bfx,y−b+db≤fx,y≤e.(2) Histogram Correction. The histogram of an image represents the statistical relationship between each gray level and its frequency. Usually, the horizontal coordinate represents the gray level, and the vertical coordinate represents the frequency. According to the definition of the histogram, it can be expressed as(5)prk=nkNk=0,1,…,L−1,where N is the total number of pixels in an image, nk denotes the number of pixels at the kth gray level, rk is the kth gray level, L is the number of gray levels, and p(rk) denotes the relative frequency of the occurrence of that gray level.Histogram is the main means to reflect the general characteristics of a digital image. It gives information about the grayscale range, the grayscale distribution, the average brightness, and the contrast between light and dark of a digital image, which is an important basis for further processing of digital images.The histogram equalization method is a common grayscale enhancement algorithm that transforms a known grayscale probability density distribution into a new image with a uniform grayscale probability density distribution to enhance the overall contrast of the image.Assuming that the number of pixels in an image isn, there are l gray levels, and nk represents the number of pixels with a gray level of gas, the probability of the occurrence of the kth gray level can be expressed as(6)prk=nkn,where 0 ≤ rk ≤ 1 andk=0,1,…,L−1. The transformation function T(r) is(7)sk=Trk=∑j=0kPrrj=∑j=0knjn.From the above calculation process, it can be seen that the statistical value of the histogram of the original input image can calculate the grayscale value of each pixel after equalization. The histogram equalization results in the stretching of the dense grayscale distribution and the compression of the sparse grayscale distribution, thus enhancing the overall contrast of an image.However, the traditional histogram equalization algorithm is processed for the whole image, so there are some insurmountable defects: (1) the brightness information of the original image is not retained, and the grayscale is approximately uniformly distributed in the processed image, so the average brightness is always around the median of the grayscale range; (2) the phenomenon of parsimony occurs in the process, i.e., some low-frequency grayscale may be combined, and the total grayscale level will be lost, thus causing the loss of image details. For these drawbacks, some improvement methods are listed in the next section of this paper.


### 2.1.2. Image Quality Evaluation Criteria

Image quality evaluation [5] is one of the basic techniques of image information engineering, and there are two kinds of subjective and objective evaluations. Subjective evaluation is to let observers make quality judgments on test images according to visual effects based on some predefined evaluation scales or their own experiences and give quality scores, and finally, the scores given by all observers are weighted and averaged, and the result is the subjective quality evaluation of the image. The subjective evaluation is determined by some subjective factors such as individual knowledge background, observation purpose, and prevailing environment because different individuals evaluate the same image. The two commonly used subjective evaluation methods are the absolute scale grading method and the relative scale grading method.(1) Mean Value. The mean value indicates the average value of image grayscale, which reflects the image illumination situation.(2) Mean Square Error. The mean square error, also called the mean squared error of the image gray value, reflects the dynamic range of the image gray value. Let f(i, j) denote the original image, f^i,j denote the distorted image of f(i, j), and the mean square error between f(i, j) and f^i,j for any i and j is(8)MSE=∑i=0M−1∑j=0N−1fi,j−f^i,j2MN,where M and N denote the height and width of the image, respectively. Obviously, the smaller the MSE value is, the more similar the two images are before and after information hiding.(3) Information Entropy. For an image with n levels of gray, if the probability of the occurrence of its ith level of gray is pi, then the entropy of that level of gray is(9)ei=−pilogpi.Then, the entropy of the whole image is(10)E=∑i=0n−1ei=−∑i=0n−1pilogpi.(4) Peak Signal-to-Noise Ratio. The peak signal-to-noise ratio is defined as follows:(11)PSNR=10lg∑i,j=1H,W2552∑i,j=1H,Wf^i,j−fi,j,where H and W indicate the height and width of the image, respectively. Usually, a larger PSNR value indicates a better image recovery, but it does not mean that the subjective quality is higher.


## 2.1.1. Night Image Enhancement Basic Method

Image enhancement techniques usually have two types of methods: spatial domain methods and frequency domain methods. Spatial domain enhancement methods target direct processing of pixel grayscale values. Common ones are grayscale transformations, image smoothing and sharpening in the null domain, histogram correction, pseudo-color processing, etc. Frequency domain enhancement methods are based on the Fourier transform of the image to enhance or suppress the desired spectrum, thus achieving an improvement of the image spectrum.(1) Grayscale Transformation. Grayscale transformation is one of the simplest and most important means of image enhancement techniques. Grayscale transform extends the image contrast to obtain a clearer image. It corrects the grayscale of the input pixels, and the grayscale transform can be expressed as(2)gx,y=Tfx,y,where T denotes the function relationship between the input gray value and the output gray value. According to different application requirements and the nature of the function, the following grayscale transformation methods can be used.For a given grayscale space, let the grayscale transformation range of the original imagef(x, y) be [a, b] and the grayscale extension of the transformed image g(x, y) be [c, d]; then, a proportional linear grayscale change can be used to achieve.(3)gx,y=d−ca−bfx,y−a+c.The proportional linear grayscale transform operation is relatively simple, and it can effectively change the image visual effect.And the segmented linear transform has a better enhancement effect in stretching the gray details of feature objects and suppressing the uninteresting gray levels with the following mathematical expressions:(4)gx,y=cafx,y0≤fx,y≤a,d−cb−afx,y−a+ca≤fx,y≤b,f−de−bfx,y−b+db≤fx,y≤e.(2) Histogram Correction. The histogram of an image represents the statistical relationship between each gray level and its frequency. Usually, the horizontal coordinate represents the gray level, and the vertical coordinate represents the frequency. According to the definition of the histogram, it can be expressed as(5)prk=nkNk=0,1,…,L−1,where N is the total number of pixels in an image, nk denotes the number of pixels at the kth gray level, rk is the kth gray level, L is the number of gray levels, and p(rk) denotes the relative frequency of the occurrence of that gray level.Histogram is the main means to reflect the general characteristics of a digital image. It gives information about the grayscale range, the grayscale distribution, the average brightness, and the contrast between light and dark of a digital image, which is an important basis for further processing of digital images.The histogram equalization method is a common grayscale enhancement algorithm that transforms a known grayscale probability density distribution into a new image with a uniform grayscale probability density distribution to enhance the overall contrast of the image.Assuming that the number of pixels in an image isn, there are l gray levels, and nk represents the number of pixels with a gray level of gas, the probability of the occurrence of the kth gray level can be expressed as(6)prk=nkn,where 0 ≤ rk ≤ 1 andk=0,1,…,L−1. The transformation function T(r) is(7)sk=Trk=∑j=0kPrrj=∑j=0knjn.From the above calculation process, it can be seen that the statistical value of the histogram of the original input image can calculate the grayscale value of each pixel after equalization. The histogram equalization results in the stretching of the dense grayscale distribution and the compression of the sparse grayscale distribution, thus enhancing the overall contrast of an image.However, the traditional histogram equalization algorithm is processed for the whole image, so there are some insurmountable defects: (1) the brightness information of the original image is not retained, and the grayscale is approximately uniformly distributed in the processed image, so the average brightness is always around the median of the grayscale range; (2) the phenomenon of parsimony occurs in the process, i.e., some low-frequency grayscale may be combined, and the total grayscale level will be lost, thus causing the loss of image details. For these drawbacks, some improvement methods are listed in the next section of this paper.


## 2.1.2. Image Quality Evaluation Criteria

Image quality evaluation [5] is one of the basic techniques of image information engineering, and there are two kinds of subjective and objective evaluations. Subjective evaluation is to let observers make quality judgments on test images according to visual effects based on some predefined evaluation scales or their own experiences and give quality scores, and finally, the scores given by all observers are weighted and averaged, and the result is the subjective quality evaluation of the image. The subjective evaluation is determined by some subjective factors such as individual knowledge background, observation purpose, and prevailing environment because different individuals evaluate the same image. The two commonly used subjective evaluation methods are the absolute scale grading method and the relative scale grading method.(1) Mean Value. The mean value indicates the average value of image grayscale, which reflects the image illumination situation.(2) Mean Square Error. The mean square error, also called the mean squared error of the image gray value, reflects the dynamic range of the image gray value. Let f(i, j) denote the original image, f^i,j denote the distorted image of f(i, j), and the mean square error between f(i, j) and f^i,j for any i and j is(8)MSE=∑i=0M−1∑j=0N−1fi,j−f^i,j2MN,where M and N denote the height and width of the image, respectively. Obviously, the smaller the MSE value is, the more similar the two images are before and after information hiding.(3) Information Entropy. For an image with n levels of gray, if the probability of the occurrence of its ith level of gray is pi, then the entropy of that level of gray is(9)ei=−pilogpi.Then, the entropy of the whole image is(10)E=∑i=0n−1ei=−∑i=0n−1pilogpi.(4) Peak Signal-to-Noise Ratio. The peak signal-to-noise ratio is defined as follows:(11)PSNR=10lg∑i,j=1H,W2552∑i,j=1H,Wf^i,j−fi,j,where H and W indicate the height and width of the image, respectively. Usually, a larger PSNR value indicates a better image recovery, but it does not mean that the subjective quality is higher.


## 2.2. Night Image Improvement Algorithm Based on Histogram Equalization

Histogram equalization is one of the very important algorithms in image enhancement. It uses basic knowledge of probability theory to perform gray point operations for the purpose of histogram transformation [6–8]. The essence of the image histogram equalization algorithm is to selectively enhance the low-frequency information and suppress the high-frequency information of the image. After histogram equalization of an image, the grayscale that originally possesses fewer pixels is most likely to be merged. In contrast, the boundaries between image regions that normally occupy fewer pixels contain important structural information, which may cause the loss of image details. In addition, various types of image noise are inevitably present in the image, and then the image noise will be amplified accordingly [7, 9]. Therefore, the traditional histogram equalization algorithm has the disadvantages of image detail information loss and noise amplification.


### 2.2.1. Improved Algorithm 1

(1)
For each pixel in the original image, it is recorded into the corresponding pixel number accumulatorri according to its grayscale value.(2)
Select the appropriate mapping relationship for the number of pixels. Here,ri = log (ri + 1) is used, and ri and Q=∑i=0m−1ri are calculated, respectively.Calculate the converted grayscale value of grayscalei in the original image.(12)fi=L−1∑k=0i−1rkQ−ri.The grayscale conversion method of the above equation can extend the gray space of the original image so that the converted grayscale values are distributed over the entire gray space.


### 2.2.2. Improved Algorithm 2

For the grayscalefi(x, y), at level i in the original image grayscale histogram, the position of its corrected grayscale gix,y is determined based on the ratio of ∑k=0i−1Prrk and ∑k=i+1i−1Prrk on its left and right sides using the following equation j:(13)j:l−1−j=∑k=0i−1Prrk:∑k=i+1i−1Prrk.Collate to obtain(14)j=l−1∑k=0i−1Prrk∑k=0i−1Prrk+∑k=i+1i−1Prrk.Furthermore, it is reduced to(15)j=l−1∑k=0i−1Prrk1−Prri=l−1∑k=0i−1nkn−ni.


### 2.2.3. Improved Algorithm 3

After histogram equalization of the image, the average brightness of the output image usually lies in the middle of the gray level of the image. By using histogram recursive decomposition and segmented equalization, we can achieve multilevel brightness control of the output image, thus avoiding the unnatural enhancement effect caused by too much brightness after enhancement.The basic idea of histogram recursive decomposition and segmented equalization is to use the average luminance as the closed value, decompose the image recursively according to the specified depthr, so as to obtain 2r subimages of different grayscale ranges, then make histogram equalization for each subimage, and finally merge the equalized subimages to obtain the equalization result of the night image. Obviously, when the recurrence depth r is 0, the input image is not decomposed in any way, i.e., in the conventional way. The case when r is 1 is illustrated below, and so on for other cases.First, the original imageX is divided into two subgraphs X1 and X2, with the grayscale mean value Gm as the threshold, i.e.,(16)X1=xi,j|GX≤Gm,X2=xi,j|Gx>Gm.Next, the histograms are counted for each of the two subplots and equalized in the grayscale range on each side of the respective mean.(17)p1Gk=n1kn1,k=0,1,2,...,m,C1k=∑k=0mp1k,Y1=f1X1,while,Gy=GmCGx.Then, the processed subgraphs are merged:(18)Y=Y1∪Y2.Since the segmentation, processing, and merging are performed in grayscale dependence, the spatial location of the enhanced pixels does not change. Similarly, according to the recurrence depth, the image is decomposed into 2r subimages according to the average luminance, then each of them is histogram equalized, and finally, the equalized subimages are merged. Then, the average luminance of the output image is(19)EY=1−12rGm+12rGc.From the above equation, we can see that the greater the depth of decomposing the image is, the closer the average brightness of the final image obtained will be to the average brightness of the input image. Therefore, we can use differentr values to achieve luminance control. The above method can automatically extend the range of image gray levels and, at the same time, can control the average luminance of the output image with better enhancement effect. However, there is still the disadvantage of gray level merging, and the image gray level average value is still offset.


## 2.2.1. Improved Algorithm 1

(1)
For each pixel in the original image, it is recorded into the corresponding pixel number accumulatorri according to its grayscale value.(2)
Select the appropriate mapping relationship for the number of pixels. Here,ri = log (ri + 1) is used, and ri and Q=∑i=0m−1ri are calculated, respectively.Calculate the converted grayscale value of grayscalei in the original image.(12)fi=L−1∑k=0i−1rkQ−ri.The grayscale conversion method of the above equation can extend the gray space of the original image so that the converted grayscale values are distributed over the entire gray space.


## 2.2.2. Improved Algorithm 2

For the grayscalefi(x, y), at level i in the original image grayscale histogram, the position of its corrected grayscale gix,y is determined based on the ratio of ∑k=0i−1Prrk and ∑k=i+1i−1Prrk on its left and right sides using the following equation j:(13)j:l−1−j=∑k=0i−1Prrk:∑k=i+1i−1Prrk.Collate to obtain(14)j=l−1∑k=0i−1Prrk∑k=0i−1Prrk+∑k=i+1i−1Prrk.Furthermore, it is reduced to(15)j=l−1∑k=0i−1Prrk1−Prri=l−1∑k=0i−1nkn−ni.


## 2.2.3. Improved Algorithm 3

After histogram equalization of the image, the average brightness of the output image usually lies in the middle of the gray level of the image. By using histogram recursive decomposition and segmented equalization, we can achieve multilevel brightness control of the output image, thus avoiding the unnatural enhancement effect caused by too much brightness after enhancement.The basic idea of histogram recursive decomposition and segmented equalization is to use the average luminance as the closed value, decompose the image recursively according to the specified depthr, so as to obtain 2r subimages of different grayscale ranges, then make histogram equalization for each subimage, and finally merge the equalized subimages to obtain the equalization result of the night image. Obviously, when the recurrence depth r is 0, the input image is not decomposed in any way, i.e., in the conventional way. The case when r is 1 is illustrated below, and so on for other cases.First, the original imageX is divided into two subgraphs X1 and X2, with the grayscale mean value Gm as the threshold, i.e.,(16)X1=xi,j|GX≤Gm,X2=xi,j|Gx>Gm.Next, the histograms are counted for each of the two subplots and equalized in the grayscale range on each side of the respective mean.(17)p1Gk=n1kn1,k=0,1,2,...,m,C1k=∑k=0mp1k,Y1=f1X1,while,Gy=GmCGx.Then, the processed subgraphs are merged:(18)Y=Y1∪Y2.Since the segmentation, processing, and merging are performed in grayscale dependence, the spatial location of the enhanced pixels does not change. Similarly, according to the recurrence depth, the image is decomposed into 2r subimages according to the average luminance, then each of them is histogram equalized, and finally, the equalized subimages are merged. Then, the average luminance of the output image is(19)EY=1−12rGm+12rGc.From the above equation, we can see that the greater the depth of decomposing the image is, the closer the average brightness of the final image obtained will be to the average brightness of the input image. Therefore, we can use differentr values to achieve luminance control. The above method can automatically extend the range of image gray levels and, at the same time, can control the average luminance of the output image with better enhancement effect. However, there is still the disadvantage of gray level merging, and the image gray level average value is still offset.


## 2.3. Night Tour Recommendation Model Design

This paper improves the feature recognition of night attraction images by combining the techniques of night image enhancement in the previous section. Combining convolutional neural networks and collaborative filtering methods, we extract and classify the factor features in night attraction images and visitor text reviews by convolutional neural networks and predict the user item ratings by using collaborative filtering methods. Among them, the convolutional neural network for mining features in reviews can effectively alleviate the data sparsity problem in the collaborative filtering method [10], and the method can retain the advantages of shared experience and personalization in the collaborative filtering method.


### 2.3.1. Collaborative Filtering Recommendation Algorithm

As the most widely used recommendation algorithm, the core idea of collaborative filtering is to calculate the similarity between users or items to achieve recommendations. User-based collaborative filtering recommendation algorithm calculates the similarity between users, establishes the nearest-neighbor user group, and then recommends the products of interest in the nearest-neighbor group to the target users; item-based collaborative filtering recommendation algorithm calculates the similarity between items; model-based collaborative filtering recommendation algorithm combines some intelligent models to train and test the data in order to obtain the user’s preference information more effectively to achieve recommendations.In order to find users or items in close proximity, similarity calculation is the key. The most commonly used methods to calculate similarity are Pearson’s method and cosine method [11]. Among them, the Pearson similarity method is more applicable to the calculation of document data and is more comprehensive for different users, which is expressed by the following formula:(20)sima,b=∑i∈Ia,bRa,i−Ra¯Rb,i−Rb¯∑i∈Ia,bRa,i−Ra¯2∑i∈Ia,bRb,i−Rb¯2.Chen et al. [12] used a new dynamic evolutionary clustering algorithm to divide the set of users and items into K clusters and clustered the individuals with high similarity. Collaborative filtering technique is applied to predict among each of the K clusters, and recommendation predictions are made for target users based on the prediction levels obtained from clustering. Bo and Fei [2] used a combined collaborative filtering recommendation algorithm to improve the accuracy utilization of group buying websites using an offline testing method [13–16].


### 2.3.2. Convolutional Neural Network

Convolutional neural networks (CNNs) are one of the main focuses of research in deep learning [17, 18], and their applications in image processing are quite mature, and they are also widely used for processing text comments. As a feedforward neural network, the basic structure of the CNN is similar to that of other neural networks in that it consists of an input layer, an implicit layer [19–25], and an output layer for data feature extraction, and the implicit layer of the CNN consists of three layers, including convolution, pooling, and full connectivity [3]. The CNN structure is shown in Figure 1, including the convolution layer, pooling layer, and fully connected layer, which are the important neural network structures in this paper.Figure 1
Structure of the convolutional neural network.The purpose of this paper is to design a personalized night tour recommendation model, and to address the problem of data sparsity where it is difficult to mine deep information based on user collaborative filtering recommendation algorithms, convolutional neural networks are selected to classify the night attraction images and review information of tour data for deep extraction. The text comments of tourists on tourism contain emotional factors about the tourism process, which are divided into two categories: positive and negative. The basic information, behavioral information, and contextual information of tourist users are combined to form tourist user data to solve the problem of single data.In this paper, in addition to the night landscape features after data enhancement, text features are also required in the tourism recommendation model, which mainly considers three major elements of user data: basic information, behavioral information, and contextual information. The vectorized tourism user review data matrix is sent to the convolutional neural network for training to get the positive and negative emotions of tourists towards the project, and then the processed tourism data are used for similarity calculation. The structure of the travel recommendation model is shown in Figure2.Figure 2
Structure of the recommended model.The basic information of the user is expressed as(21)P=α1age+α2sex+α3place.The behavioral information of travel users is expressed as(22)S=β1demand+β2prefer+β3consume.The emotional information of travel users is expressed as(23)Q=γ1time+γ2location+γ3intact.The textual feature information of the night tour recommendation information is expressed as(24)TR=αP+βS+γQ.


## 2.3.1. Collaborative Filtering Recommendation Algorithm

As the most widely used recommendation algorithm, the core idea of collaborative filtering is to calculate the similarity between users or items to achieve recommendations. User-based collaborative filtering recommendation algorithm calculates the similarity between users, establishes the nearest-neighbor user group, and then recommends the products of interest in the nearest-neighbor group to the target users; item-based collaborative filtering recommendation algorithm calculates the similarity between items; model-based collaborative filtering recommendation algorithm combines some intelligent models to train and test the data in order to obtain the user’s preference information more effectively to achieve recommendations.In order to find users or items in close proximity, similarity calculation is the key. The most commonly used methods to calculate similarity are Pearson’s method and cosine method [11]. Among them, the Pearson similarity method is more applicable to the calculation of document data and is more comprehensive for different users, which is expressed by the following formula:(20)sima,b=∑i∈Ia,bRa,i−Ra¯Rb,i−Rb¯∑i∈Ia,bRa,i−Ra¯2∑i∈Ia,bRb,i−Rb¯2.Chen et al. [12] used a new dynamic evolutionary clustering algorithm to divide the set of users and items into K clusters and clustered the individuals with high similarity. Collaborative filtering technique is applied to predict among each of the K clusters, and recommendation predictions are made for target users based on the prediction levels obtained from clustering. Bo and Fei [2] used a combined collaborative filtering recommendation algorithm to improve the accuracy utilization of group buying websites using an offline testing method [13–16].


## 2.3.2. Convolutional Neural Network

Convolutional neural networks (CNNs) are one of the main focuses of research in deep learning [17, 18], and their applications in image processing are quite mature, and they are also widely used for processing text comments. As a feedforward neural network, the basic structure of the CNN is similar to that of other neural networks in that it consists of an input layer, an implicit layer [19–25], and an output layer for data feature extraction, and the implicit layer of the CNN consists of three layers, including convolution, pooling, and full connectivity [3]. The CNN structure is shown in Figure 1, including the convolution layer, pooling layer, and fully connected layer, which are the important neural network structures in this paper.Figure 1
Structure of the convolutional neural network.The purpose of this paper is to design a personalized night tour recommendation model, and to address the problem of data sparsity where it is difficult to mine deep information based on user collaborative filtering recommendation algorithms, convolutional neural networks are selected to classify the night attraction images and review information of tour data for deep extraction. The text comments of tourists on tourism contain emotional factors about the tourism process, which are divided into two categories: positive and negative. The basic information, behavioral information, and contextual information of tourist users are combined to form tourist user data to solve the problem of single data.In this paper, in addition to the night landscape features after data enhancement, text features are also required in the tourism recommendation model, which mainly considers three major elements of user data: basic information, behavioral information, and contextual information. The vectorized tourism user review data matrix is sent to the convolutional neural network for training to get the positive and negative emotions of tourists towards the project, and then the processed tourism data are used for similarity calculation. The structure of the travel recommendation model is shown in Figure2.Figure 2
Structure of the recommended model.The basic information of the user is expressed as(21)P=α1age+α2sex+α3place.The behavioral information of travel users is expressed as(22)S=β1demand+β2prefer+β3consume.The emotional information of travel users is expressed as(23)Q=γ1time+γ2location+γ3intact.The textual feature information of the night tour recommendation information is expressed as(24)TR=αP+βS+γQ.


## 3. Results and Discussion

### 3.1. Experimental Results of a Night Image Improvement Algorithm Based on Histogram Equalization

In the experiment, the images of night tourist attractions are selected, and the traditional histogram equalization and the three improved histogram equalization methods proposed in this paper are carried out, respectively, and the corresponding histograms are given. The comparison graph of the image enhancement results of the three improved algorithms is shown in Figure3.Figure 3
Comparison of image enhancement results of three improved algorithms. (a) Traditional algorithms. (b) Improved algorithm 1. (c) Improved algorithm 2. (d) Improved algorithm 3.
(a)(b)(c)(d)In addition to the visual comparison of the results, this paper provides a table of numerical comparisons of different algorithms, as shown in Table1. According to the results of the above experimental images, the improved histogram equalization method has a more obvious contrast of the enhanced images. From the experimental data, the enhanced histogram equalization method enlarges the grayscale range of the image. In addition, the average value of the image is closer to the actual value.Table 1
Comparison of experimental data.
ParametersOriginal imageTraditional algorithmsImproved algorithm 1Improved algorithm 2Improved algorithm 3Number of shades of gray used118531105564Maximum grayscale value133255255254255Minimum grayscale value024000Average grayscale value111284212545


### 3.2. Analysis of Travel Recommendation Results after Night Image Enhancement

In this paper, we crawled the nighttime attraction pictures of China 5A and 4A, a total of 32 attractions on the Internet and the rating data set on tourism websites. Then, the text features are extracted: first, the duplicate data, blank data, and invalid data of irrelevant scenic spots are removed. Then, the noisy data are filtered; that is, the nontext symbols are removed. Then, we use Python’s jieba to split the word for annotation data and filter stop words. Convolutional neural networks have certain requirements on the length of the input vectors, so the length of segmented sentences is standardized. Most of the processed word segmentation data are about 50 in length, so sentences with a length of about 50 are chosen. The data corresponding to each visitor and scenic spot are merged. Then, word2vec vectorization is performed on the merged word segmentation data. The vectorized multidimensional data are sent to the convolutional neural network to extract features.In order to reflect the effectiveness of the convolutional neural network and collaborative filtering method more intuitively, this experiment compares this method with the traditional collaborative filtering method which only considers the scores between users and items. The experimental results are shown in Figure4. It can be seen that the MAE value of this paper is smaller than that of the collaborative filtering method in the same scene, considering the behavior information and context data of tourists. As the data volume in the test set increases, the MAE value increases, but the overall trend decreases, which indicates that when the data volume is more significant, the quality of the model can be fully verified.Figure 4
Comparison of experimental results.


## 3.1. Experimental Results of a Night Image Improvement Algorithm Based on Histogram Equalization

In the experiment, the images of night tourist attractions are selected, and the traditional histogram equalization and the three improved histogram equalization methods proposed in this paper are carried out, respectively, and the corresponding histograms are given. The comparison graph of the image enhancement results of the three improved algorithms is shown in Figure3.Figure 3
Comparison of image enhancement results of three improved algorithms. (a) Traditional algorithms. (b) Improved algorithm 1. (c) Improved algorithm 2. (d) Improved algorithm 3.
(a)(b)(c)(d)In addition to the visual comparison of the results, this paper provides a table of numerical comparisons of different algorithms, as shown in Table1. According to the results of the above experimental images, the improved histogram equalization method has a more obvious contrast of the enhanced images. From the experimental data, the enhanced histogram equalization method enlarges the grayscale range of the image. In addition, the average value of the image is closer to the actual value.Table 1
Comparison of experimental data.
ParametersOriginal imageTraditional algorithmsImproved algorithm 1Improved algorithm 2Improved algorithm 3Number of shades of gray used118531105564Maximum grayscale value133255255254255Minimum grayscale value024000Average grayscale value111284212545


## 3.2. Analysis of Travel Recommendation Results after Night Image Enhancement

In this paper, we crawled the nighttime attraction pictures of China 5A and 4A, a total of 32 attractions on the Internet and the rating data set on tourism websites. Then, the text features are extracted: first, the duplicate data, blank data, and invalid data of irrelevant scenic spots are removed. Then, the noisy data are filtered; that is, the nontext symbols are removed. Then, we use Python’s jieba to split the word for annotation data and filter stop words. Convolutional neural networks have certain requirements on the length of the input vectors, so the length of segmented sentences is standardized. Most of the processed word segmentation data are about 50 in length, so sentences with a length of about 50 are chosen. The data corresponding to each visitor and scenic spot are merged. Then, word2vec vectorization is performed on the merged word segmentation data. The vectorized multidimensional data are sent to the convolutional neural network to extract features.In order to reflect the effectiveness of the convolutional neural network and collaborative filtering method more intuitively, this experiment compares this method with the traditional collaborative filtering method which only considers the scores between users and items. The experimental results are shown in Figure4. It can be seen that the MAE value of this paper is smaller than that of the collaborative filtering method in the same scene, considering the behavior information and context data of tourists. As the data volume in the test set increases, the MAE value increases, but the overall trend decreases, which indicates that when the data volume is more significant, the quality of the model can be fully verified.Figure 4
Comparison of experimental results.


## 4. Conclusions

Night travel recommendation, as an essential part of travel recommendation, is often ignored due to low light. However, with the optimization of intelligent image processing technology, it has been paid much attention. In digital image processing, image enhancement technology plays an important role in improving image quality. It is the preprocessing stage of image processing, which plays the role of carrying forward and preparing for the subsequent processing stages. Firstly, the basic theories and algorithms of image enhancement are introduced. Secondly, this paper lists the related improvements made in view of the shortcomings of traditional histogram equalization methods and analyzes the advantages of each improvement. Finally, a better night travel recommendation system is proposed by combining collaborative filtering and convolutional neural network.



---

*Source: 2624621-2021-10-06.xml*