Painting Psychotherapy Image Measurement and Reconstruction Algorithm based on Improved Hadamard Matrix

: Painting psychotherapy based on Internet technology has become a method of mental health testing and treatment. This method will produce a large number of digital images of painting psychotherapy. How to measure and reconstruct the image is the basis of automatic analysis and processing. This study aimed to propose a painting psychotherapy image measurement and reconstruction algorithm based on the improved Hadamard matrix. Moreover, the construction of a measurement matrix was analyzed using the compressed sensing theory and the Hadamard matrix construction algorithm was improved and optimized. Also, four different measurement matrices were compared and analyzed. The findings revealed that the improved Hadamard measurement matrix achieved good experimental results in terms of signal reconstruction accuracy and Peak Signal-to-Noise Ratio (PSNR) value. In the experimental analysis of painting psychotherapy image reconstruction, the reconstruction algorithm based on the improved Hadamard measurement matrix had a shorter reconstruction time and the algorithm achieved satisfactory results in terms of the number of iterations and the PSNR value of the reconstructed image. For painting psychotherapy images, the algorithm provided a theoretical basis for later digital processing, large-sample training and analysis and automatic machine recognition and judgment.


Introduction
Psychologists combine painting and psychology to form the research direction of painting therapy and psychotherapy. Researchers have described and expressed different psychological states with different image features and achieved good results in reducing emotions, alleviating mental symptoms and performing psychological consultation or evaluation (Schwartz, 2018).
However, in the implementation process, manual paintings could not fully reflect a participant's real psychological state due to limitations in terms of the participant's painting level and environmental conditions. This shortcoming led to parameter deviation in the analysis of painting psychotherapy image reconstruction, thereby changing the effect of painting psychotherapy.
In recent years, psychologists have started using representative image models of houses, trees, people and other psychological characteristics with the development of mobile Internet technology, software technology and intelligent terminals. This advancement has allowed participants to assemble and draw through intelligent terminals or computers (Bouchoucha et al., 2019). Further, the digital image expression of painting psychotherapy can be realized and big data samples and network interaction platforms are possible for painting psychotherapy. A research foundation for machine learning and intelligent processing of painting psychotherapy is thus established.
In the process of painting psychotherapy based on digital image analysis and processing, this study aimed to analyze and set forth a feature measurement and reconstruction algorithm to better extract the features and semantic expression of painting psychotherapy images and facilitate image storage, transmission and feature analysis. The improved measurement matrix had fewer independent random variables. The constructed measurement matrix had better sparsity, which was suitable for feature analysis and intelligent processing of painting psychotherapy images.
This study analyzes the Hadamard measurement matrix, construction algorithm and optimization algorithm and then analyzes the image measurement and reconstruction algorithm of painting psychology. Finally, the experimental results are compared and analyzed.

Hadamard Measurement Matrix
A Hadamard matrix is defined as follows (Jiang et al., 2013): For an N  N order of the matrix Hn, the elements of the matrix Hn are all +1 or -1. If the matrix Hn satisfies the conditions given in Equation (1) Most of the methods for constructing a Hadamard matrix are based on the number theory (Huckle and Kravvaritis, 2017). The construction methods include the Turyn construction method, Paley algorithm first construction method, second Paley Williamson construction method and the Sylvester algorithm method. The graph theory hypercube concept is also used to construct a Hadamard matrix (Lan and Min, 2013).
A hypercube is constructed by 2 n points in the ndimensional space. Points 2 n are recorded as {x0, x1, x2,… 21 n x  }; if the distance between the points xi, xj meets   2 1 ij xx  , then the edge of the cube is determined and the length of the edge is marked as 1. According to the relationship between the vertices and edges of the hypercube (Rychkov, 2019), the matrix of the undirected graph is obtained as follows: The shortest distance between two points is calculated according to the representation matrix of the hypercube undirected graph; the distance between two points is marked as dij; if dij = 1 or dij = 2，the Hij of the corresponding matrix is 1; if dij is the other value, then Hij is labeled as -1.

Improved Hadamard Measurement Matrix and Rapid Construction Method
A previous study (Peng et al., 2018) found that any subset of the column vectors in a perfect measurement matrix was orthogonal; the larger the column of the quantum set, the better the measurement matrix. According to this principle, a random block Hadamard matrix (Scrambled Block Hadamard Ensemble, SBHE) was designed in that study. The sampling value was obtained for each sample to achieve the difference of +1 and -1. That is: In the actual sampling of the medical image, only the +1 portion was obtained. Considering that the total energy of the medical image was equal to the sum of +1 and -1 and the total energy in the sampling time was constant, Equation (3) could be transformed as follows: A random block Hadamard matrix was used in medical image sampling. First, the measurement matrix  was used to sample the signal in which the measurement matrix  was an element of all "1" matrices and the sampled values were represented by y. Then, the set of random block Hadamard matrices was used for sampling the signal and obtaining an intermediate sampling value yi(+1). The sampling value y and intermediate sampling value yi(+1) were substituted into Equation (4) to obtain the final sampling valueyi.
The present study proposed improvements to the Hadamard measurement matrix and the rapid construction method using the Galois field characteristic function and random block Hadamard matrix.
Letl be an odd prime number. A mod operation was performed for an integerx (x modl). In the remainder of l-1, if m 2  x(mod)l, then x was two times the remainder. For an odd prime number l, Equation (5) was used to solve the Galois field problem (Li et al., 2006): In Equation (5), r is a positive integer and x is the root element Gal of the Galois field GF(l r ). In the Galois field GF(l r ), Equation (6) was used to solve the characteristic function k(x): In this study, the Hadamard measurement matrix was constructed to determine the position of "1" and "-1" using the value of k(x). The values of "1" and "-1" were kept the same in the rows and columns of the improved Hadamard measurement matrix to ensure that the measurement matrix of the structure met the Restricted Isometry Property (RIP) criterion.
In the rapid construction algorithm of the improved Hadamard measurement matrix, the first-row and the first-column elements were set to "1." Then, a basis matrix was constructed, according to Equation (6) in the characteristic function k(x), to determine the value of the fundamental matrix that first appeared in the first line of "1" and the "-1" position. The values of the other elements were the same as those of the upper left corner in the base matrix, except for the first row and the first column.
The description and implementation steps of the improved Hadamard measurement matrix and rapid construction algorithm were as follows: Step1: According to the length of the input signal n and sampling rate of R, the order of the matrix M was determined, where M was an integer close to (nR)n and (M-1) was required to meet the "odd prime" condition.
Step 2: The elements of the first row and first column were set to "1" and the (M-1) matrix was represented by. The Hadamard measurement matrix was represented as Step 3: According to Equation (6), the positions of "1" and "-1" in the first row and first column of the matrix  were determined.
Step 4: In the matrix, the values of the other elements were the same as those of the upper left corner, except the first row and first column and the structure of the improved Hadamard measurement matrix was constructed by the cyclic shift transformation.

Measurement Matrix Optimization
The measurement matrix was required to satisfy the RIP criterion in the compressed sensing theory. In practice, RIP is often used instead of "irrelevant." Therefore, the correlation should be minimized in the construction of the measurement matrix. The minimization of "correlation" was the main criterion for the optimal design of the measurement matrix (Li and Qin, 2011).
Correlation reflected the maximum of the crosscorrelation between the columns of the (MN)dimensional measurement matrix . The optimization of the measurement matrix based on the cross-correlation involved the selection of N vectors from the Mdimensional space; the maximum of the cross-correlation between the N vectors was the minimum. The best case for cross-correlation could be considered when the maximum of each column of the M-dimensional space reached the Welch lower bound (Huihui et al., 2014).
The optimal design of the measurement matrix changed the relationship between the elements in . Given the sparsity of K, a certain number of measurements were required to restore the signal M minimum. The objective of the measurement matrix was to reconstruct the original signal correctly using the measurement vector M and the sparsity of the signal K was the maximum.
A good correlation was found between each column of the Hadamard matrix and good signal reconstruction ability existed. The row-orthogonal, row-mode and column-mode were kept the same to retain the advantages of the Hadamard matrix. In this study, the improved Hadamard matrix was optimized and the optimization algorithm was as follows: Step 1: The improved Hadamard matrix was represented as H, the number of iterations was set to I, the initial value of I was set to 0 and the number of iterations of the maximum I was set to Imax. The correlation coefficient between each column vector of the matrix H was represented byci and the correlation coefficient between each vector matrix was denoted byri. Each column-vectormode was represented by normci and each rowvector-mode was represented bynormri.
Step 2: ci and ri were calculated [11] and the maximum value cimax of the absolute value of the correlation coefficient between the column vectors and the maximum valuerimax of the absolute value of the correlation coefficient between the row vectors were determined.
Step 4: Each vector matrix in H was normalized for the orthogonal matrix, followed by normalization of the unit vector of the column matrix in H.
Step 5: The number of iterations I was increased by 1 (I = I + 1) to determine whether I reached the maximum value of Imax; if I>Imax, then the optimized measurement matrixH was output; otherwise, step 2 through step 5 were repeated.

Image Measurement and Reconstruction Algorithm of Painting Psychotherapy
In this study, the algorithm of painting psychotherapy image measurement and reconstruction based on the improved Hadamard matrix was designed using the principle of the Orthogonal Matching Pursuit (OMP) algorithm (Nguyen and Park, 2018). The idea of the medical image reconstruction algorithm was as follows: R N was a K-sparse vector, that is, the  of the N elements had only K-nonzero elements. The signal XR N could be expressed as X = , YR N , n<N, where Y was obtained by improving the Hadamard measurement matrix, that is: The improved Hadamard measurement matrix satisfied the RIP criterion and the medical image reconstruction could resolve the following optimization problems (min||||1), which was equivalent to finding the optimal sparse solution Y = H.
The signal X was sparse and compressible and hence the problem of solving the undetermined equations Y = A CS X was converted into anl1 optimization problem: In Equation (10), n n d  represents the direction of the iterative update and a n represents the step size. a n could be calculated as: The flow chart of image measurement and reconstruction algorithm of painting psychology is shown in Fig. 1. According to the OMP algorithm (Bahaghighat and Motamedi, 2017), the image reconstruction algorithm based on the improved Hadamard measurement matrix was described and implemented as follows: Step 1: Suppose H is an improved Hadamard measurement matrix, Y is the observation vector, K is the sparsity, r and r 0 = Y are the initialization residuals，x 0 = 0,  0 =  are the initialization parameters andn is the number of iterations, which was set to 0.
Step 2: X was the re-established sparse solution andI was the index set, with I = E. g n = <n r-1 , H> was calculated.
Step 3 was updated.
Step 4: a n was updated according to Equation (12) Step 6: r n ,  was updated.
Step 7: The iteration condition was determined; if 16 | | 10 nn rr  , then the iteration was terminated and the r n and n n x  were output. If unsatisfied with the iterative termination conditions, step 2 through step 7 was performed again.

Experimental Analysis
In this study, the Peak Signal-to-Noise Ratio (PSNR) was used to evaluate the effect of the reconstructed image.

Experimental Analysis of Measurement Matrix Construction Algorithm
In the simulation experiment, two (256256)-pixel painting psychotherapy images were selected as the test images. Image G1 was the experimental image of houses, trees and people taken by the camera, while image G2 was the construction image of houses, trees and people drawn by the participants using computers. The two original images are shown in Fig. 2.
For the test image, this study adopted the Gaussian random matrix, Hadamard matrix, SBHE measurement matrix and the improved Hadamard measurement matrix to perform the sampling and reconstruction experiments. Figure 3 is the angiographic image G1 according to the 1616 block, with a sampling rate of 0.20, 0.25, 0.35 and 0.40 and reconstruction of the painting psychotherapy image used to obtain the PSNR value.
In Fig. 2, the reconstruction algorithm obtained a large value for reconstruction of the painting psychotherapy image G1 using the same sampling rate. The reconstruction experiment achieved good results. In Fig. 4, the reconstruction algorithm obtained a large PSNR value for the reconstruction of image G2 drawn by a participant using the same sampling rate. The reconstruction experiment achieved good results.
According to the PSNR value of the reconstructed image, the value of the improved Hadamard measurement matrix for image G2 drawn by a participant was higher at different sampling rates and the reconstructed image had a better PSNR value.
Four different matrices were tested using the OMP reconstruction algorithm further to analyze the relationship between reconstruction probability and sparsity. The Gauss sparse signal was used as a test and the measurement matrix was evaluated using a 256256 measurement matrix. This matrix was used to test the signal 100 times with different sparsity signals. The test data are shown in Fig. 5.
According to the data in Fig. 5, the improved Hadamard measurement matrix had a higher probability of reconstruction under the condition of the same degree of sparsity and the optimized Hadamard measurement matrix had a better reconstruction effect in the OMP reconstruction algorithm.

Experimental Analysis of Painting Psychotherapy Image Reconstruction Algorithm
The images G1 and G2 were chosen for experimental analysis in painting psychotherapy image reconstruction algorithm experiments. Image G1 was the experimental image of houses, trees and people taken with the camera, while image G2 was the construction image of houses, trees and people drawn by the participants using computers. The PSNR was used as the criterion for judging the     Fig. 6. The reconstruction algorithm was based on the OMP algorithm, GPSR algorithm, BP algorithm, Bregman iterative algorithm and the improved algorithm proposed in this study, showing that the improved algorithm had the lowest reconstruction time. Table 2 shows the results of experiments using different reconstruction algorithms on the image G2 under different sparsity conditions (120, 160, 200 and 240). The reconstruction was set at the same mean square error and the number of iterations is shown in Table 2. Figure 7 shows the number of iterations of each algorithm. Each algorithm had a different sparsity but the same reconstruction mean square error conditions.
The experimental results showed that the painting psychotherapy image reconstruction algorithm proposed in this study achieved satisfactory results in terms of the PSNR value of the reconstructed image, number of iterations and execution time of the reconstruction algorithm.

Conclusion
In this study, both the construction of the measurement matrix in the compressed sensing theory and the construction algorithm of the Hadamard matrix were analyzed. The improvement and optimization of the Hadamard measurement matrix, as well as the painting psychotherapy image measurement and reconstruction algorithm based on the improved Hadamard matrix, were proposed.
A comparison of four different measurement matrices showed that the proposed algorithm achieved good results.
In the painting image reconstruction experiment, the painting psychotherapy image reconstruction algorithm based on improved Hadamard measurement matrix achieved satisfactory results in terms of the number of iterations, reconstruction time and PSNR value of the reconstructed image. For painting psychotherapy images, the algorithm provided a theoretical basis for later digital processing, large-sample training and analysis and automatic machine recognition and judgment.