# Multilevel Image Edge Detection Algorithm Based on Visual Perception

Authors: Hui Li
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Multilevel image edge repair results directly affect the follow-up image quality evaluation and recognition. Current edge detection algorithms have the problem of unclear edge detection. In order to detect more accurate edge contour information, a multilevel image edge detection algorithm based on visual perception is proposed. Firstly, the digital image is processed by double filtering and fuzzy threshold segmentation; Through the analysis of the contour features of the moving image, the threshold of the moving image features is set, and the latest membership function is obtained to complete the multithreshold optimization. Adaptive smoothing is used to process the contour of the object in the moving image, and the geometric center values of the two adjacent contour points within the contour range are calculated. According to the calculation results, the curvature angle is further calculated, and the curvature symbol is obtained. According to the curvature symbol, the contour features of the moving image are detected. The experimental results show that the proposed algorithm can effectively and accurately detect the edge contour of the image and shorten the reconstruction time, and the detection image resolution is high.


---

## Body

## 1. Introduction

The edge of multilevel image concentrates most of the information of the image, and its determination and detection are of great importance to the recognition and understanding of the multilevel image. Edge detection can effectively synthesize rich spectral information and spatial information of multilevel image, get local mutation, form edge, and then detect edge contour in the image. With the development of digital image processing technology [1], the multilevel image edge detection algorithm is becoming more and more familiar and important in multilevel image processing. In the field of human vision, the edge of the object is usually used to distinguish each object, but in the multilevel image, the edge is an important feature to distinguish different regions. Multilevel image edge is the most basic feature in the image [2], which is the basis of analyzing and understanding image. It contains the important information in the multilevel image. It refers to the part of the local brightness that has significant change. It exists between the target image and the target image, the target image and the background image, and the area image and the area image. For the multilevel image [3], the contour features of the object represented by the edge information can reflect the individual features of the multilevel image better than other features. Because of the complexity of multilevel image, the influence of background noise, and the density of edge, it is difficult for some multilevel image edge detection algorithms to meet the practical needs. At present, multilevel image edge detection technology has been widely used, such as target tracking, fingerprint recognition, laser remote-sensing image segmentation, and many other fields.As the edge and contour information detection of multilevel image is the basis of image analysis and processing, the quality of the detection results directly affects the subsequent image quality evaluation, compression, and recognition results, so it is necessary to make a comparative study on the edge and contour detection algorithms of the multilevel image. In order to eliminate the influence of noise and obtain more accurate image edge information, many experts and scholars have made investigation and research. As the edge contour detection of the multilevel image has important research significance in various fields, it has been widely concerned and discussed, so a series of effective methods have emerged. In [4], a laser image contour detection algorithm based on the maximum interclass variance method is proposed. The laser image is described in the form of two-dimensional gray histogram, and the laser image is segmented by the maximum interclass variance method to obtain the optimal threshold of the laser image target. The optimal threshold is taken as the primary edge of the laser image target, and the edge energy is minimized until the minimum edge energy is obtained. The edge with the minimum energy is the final contour of the laser image target, and the algorithm has high detection accuracy. In [5], the image edge detection algorithm of arc simulation experiment is proposed. According to the histogram of arc column gray distribution, the characteristics of uneven distribution of arc brightness are analyzed. Through the extracted arc contour image, the arc root contraction, arc column short-circuit phenomenon, and spiral structure of the submerged arc are effectively identified, and the irregular motion characteristics of the cathode arc root coexisting with the anode arc root jumping are analyzed. The arc length variation, displacement characteristics, and arc column diameter variation during the movement of the submerged arc are analyzed. Although the above algorithm has achieved some research results, the similarity of the detected image edge features is low, and the detection effect of the image edge details is not ideal. In order to solve the above problems, the multilevel image edge contour detection algorithm is studied, and a multilevel image edge contour detection algorithm based on visual perception is proposed. The experimental results show that the proposed algorithm can eliminate the noise interference in the image, detect more accurate edge contour information, and retain better edge details.The research innovations of this article include the following:(1)
Current edge detection algorithms have the problem of unclear edge detection. In order to detect more accurate edge contour information, a multilevel image edge detection algorithm based on visual perception is proposed.(2)
Adaptive smoothing is used to process the contour of the object in the moving image, and the geometric center values of the two adjacent contour points within the contour range are calculated. According to the calculation results, the curvature angle is further calculated, and the curvature symbol is obtained. According to the curvature symbol, the contour features of the moving image are detected.(3)
The experimental results show that the proposed algorithm can effectively and accurately detect the edge contour of the image and shorten the reconstruction time, and the detection image resolution is high.The remainder of this paper is organized as follows. Section2 introduces the research on edge detection algorithm of the multilevel image under visual perception. Section 3 discusses the multilevel image contour feature detection algorithm based on multithreshold optimization. Section 4 discusses experiment and analysis. Section 5 presents the conclusions of the study.


## 2. Research on Edge Detection Algorithm of Multilevel Image under Visual Perception

### 2.1. Smoothing and Denoising of Multilevel Images

Firstly, the multilevel image is smoothed and the double-filter denoising algorithm is selected to smooth the multilevel image.


#### 2.1.1. Multilevel Image Denoising Based on Wavelet Adaptive Threshold

Firstly, according to the wavelet decomposition characteristics of multilevel images, a better threshold suitable for denoising multilevel images with different coefficients is determined to achieve smooth denoising effect [6]. The specific process is as follows.Suppose that a multilevel image ofM×N size zi,j is represented as(1)zi,j=yi,j+ni,j,where i,j∈Z represents the position of multilevel image pixels, yi,j represents a multilevel image without noise, and ni,j represents the Gaussian white noise of multilevel image subject to N0,σ2. By applying the discrete wavelet transform to both sides of the equal sign of formula (1), we can get the following results:(2)Wz=Wy+Wn,where Wz represents the wavelet coefficients of the noisy digital image after wavelet transform [7], Wy represents the wavelet coefficients of the original multilevel image after wavelet transform, and Wy represents the wavelet coefficients of Gaussian white noise after wavelet transform. Because the characteristic of wavelet transform is a kind of linear transform, then(3)Wy=Wz−Wn,where the wavelet coefficient Wy of the original multilevel image can be obtained by inverse wavelet transform. Based on wavelet threshold denoising, the main process of Wy is as follows:(1)
The multifunction digital image with noise is decomposed by wavelet transform. The appropriate wavelet and wavelet decomposition seriesN are selected to calculate the wavelet coefficients at all levels of the multifunctional digital noisy image after wavelet decomposition.(2)
Set the threshold value of each layer detail of the multilevel image [8]. Each layer from the first layer to the N layer of the image is thresholded, and then, each detail wavelet coefficient of the image is preprocessed by thresholding.(3)
Multilevel image reconstruction [9]: according to the low-frequency coefficients of the N layer and the modified high-frequency coefficients of each layer from the first layer to the N layer, the multilevel image is calculated and reconstructed.Threshold selection is the key step of multilevel image wavelet denoising and shrinkage:(a)
The calculation expression of multilevel image fixed threshold is as follows:(4)T=α2lnA,whereA represents the length of wavelet coefficients of the multilevel image, α represents the standard deviation of multilevel image noise [10], and T represents the image estimation threshold. In fact, the noise error of the image is unknown, so it is necessary to estimate and calculate the standard deviation of the noise from the noisy signal of the multilevel image; the expression is as follows:(5)α=YijH1,whereYij represents the standard deviation coefficient of the multilevel image and H1 represents the subband coefficient of the multilevel image.(b)
Multilevel image unbiased likelihood estimation threshold: set a thresholda for the multilevel image and calculate its likelihood estimation. Then, the threshold a of the multilevel image is processed by nonlikelihood minimization to get the selected threshold.(c)
Multilevel image heuristic threshold: combining the above two thresholds, it is the optimal threshold selection for multilevel image prediction variables. When the SNR of image is small, the unbiased likelihood estimation threshold has a large error, so the first fixed threshold method is used. On the contrary, unbiased likelihood estimation threshold is used.


#### 2.1.2. Multilevel Image Denoising Algorithm Based on Visual Perception

The rational differential denoising model of the multilevel image is obtained to remove the noisy pixels in the image. The specific operation process is as follows.Assume that the original multilevel clear image is represented asux,y. The multilevel image affected by noise is represented as u0x,y. The image noise is expressed as nx,y. Because the noise has the characteristic of the zero mean value, the difference of the multilevel image is expressed as σ1; then, we can get the energy function expression of the multilevel image:(6)Tux,y=∇pux,ydxdy+ux,y−u0x,y2dxdy.According to formula (6), a multilevel image denoising model is established; then, the functional formula of the multilevel image is as follows:(7)TVpux,y=Fx,y,u,∂pu∂xp,∂pu∂ypdxdy,where ∂p, xp, and yp all represent the noisy scale coefficients of multilevel images and F represents the noise difference value of the multilevel image, and its calculation formula is as follows:(8)F=∇pux,y+λ2ux,y−u0x,y2,where λ represents the parameter value of the multilevel image and ∇p represents the multilevel image gradient operator ∇ and the replacement operator of p order differential operator. The necessary conditions for finding the extremum of the multilevel image are as follows:(9)λu−u0−∇p∇pu∇pu=0,∇p=∂pu∂xp,∂pu∂yp.To sum up, whenp=1, the multilevel image denoising model TVp degenerates to the TV image denoising model. When 0<p<1, the multilevel image denoising model TVp degenerates to the fractional differential denoising model. So far, the smooth denoising of the multilevel image is completed.


#### 2.1.3. Multilevel Image Denoising Algorithm Based on Dual Filtering

Firstly, the basic principle of double filtering is used to divide a certain neighborhood of multilevel image noise points into four filtering templates in different directions, and median filtering is performed, respectively [11]. Then, the filtering results of the four templates in different directions are calculated to obtain the filtering values of multilevel image noise points. The detailed description process is as follows.For the noise point ati1,j1 in the multilevel image, its neighborhood size is expressed as 2N1+1×2N1+1, where N1 is a positive integer. The process of multilevel image filtering using the dual discrete wavelet method is as follows:(10)a1i1,j1=MedBi1+k,j1,−N1≤k≤N1,a2i1,j1=MedBi1j1+k,−N1≤k≤N1,a3i1,j1=MedBi1+k,j1+k,−N1≤k≤N1,a4i1,j1=MedBi1−k,j1−k,−N1≤k≤N1,where axi1,j1 represents the filtering values of four different directional filtering templates of the multilevel image, Med· represents the median filtering calculation of the multilevel image, and Bi1,j1 represents the gray matrix in a certain region of the multilevel image. The set axi1,j1 is calculated as follows:(11)Zmaxi1,j1=maxaxi1,j1,Zmini1,j1=minaxi1,j1,where Zmaxi1,j1 represents the maximum filtering coefficient of the multilevel image and Zmini1,j1 represents the minimum filtering coefficient of the multilevel image.


### 2.2. Edge and Contour Detection Algorithm of the Multilevel Image

#### 2.2.1. Multilevel Image Edge Contour Detection Algorithm Based on Gradient Operator

Based on the results of multilevel image segmentation, the gradient operator is used to detect the edge contour of the multilevel image, so as to obtain the edge contour information of the multilevel image. The specific process is as follows.The multilevel image gradient is a vector [12], whose size represents the edge strength of the image, and its direction is perpendicular to the edge direction of the image. For a multilevel image, the gradient of continuous function o′u′,v′ at u′,v′ is calculated as follows:(12)∇s′=∂0′∂0′∂u′∂v′T=Gu′,Go′T.For the multilevel image, the gray values of two adjacent points are usually used to approximate the continuous function variablesGu′ and Go′ of the digital image:(13)∇u′=u′m+1,n−u′m,n,(14)∇u′=u′m,1+n−u′m,n.According to formulas (13) and (14), the gradient operator is sensitive to the noise in the multilevel image, so it has poor antinoise ability and cannot effectively detect the edge contour information in different directions in the multilevel image.


#### 2.2.2. Multilevel Image Edge Contour Detection Algorithm Based on Mathematical Morphology

On the basis of multilevel image segmentation results, the edge contour of the multilevel image is detected by using mathematical morphology edge detection operator, and the image edge with noise is removed. According to the detection results, the edge contour information of the multilevel image is detected. The specific measures are as follows.Assuming thatm multilevel image structure elements are selected for mathematical morphology calculation, the multilevel image multistructure elements Bm are expressed as follows:(15)Bm=l1⊕l2⊕l3⊕⋯lm,where l stands for multilevel image cross 3×3 structure element, whose size can be 3×3, 5×5, and 7×7 or even larger. The time of multilevel image morphological operation is usually proportional to the size of the structure element. By decomposing the structure element of the multilevel image, the operation time can be reduced. The smaller the size of the structural elements, the more the image details can be protected.It is assumed thatϕx″,y″ represents the input multilevel image gray function and φx″,y″ stands for the multilevel image structure element function, and the structure element of n′ element multilevel image is defined on the multilevel image structure element set R2 or Z2. Dϕ and Dφ represent the definition domain of multilevel image gray function ϕx″,y″ and φx″,y″, respectively.Then, the weighted average value of structure element function of multilevel image ofn′ element is calculated as follows:(16)ϕavrx″,y″=1n′∑i=1n′λ′ϕ′x″,y″.The weight value is set according to the importance difference of structural elements in the multilevel image, in the formula,λ′∈0,1.Based on the above calculation, we getn′ multilevel image edge detection operators and add appropriate weights to them to get the multilevel image edge detection operators; the calculation formula is as follows:(17)Eavrx″,y″=∑i=1n′a′E′x″,y″.Suppose the gray range of the multilevel image is1,L′, and the probability of each gray level image pixel is expressed as P0′,P1′,P2′,…,Pl′′. According to the multilevel image edge detection operator E′x″,y″, the processed image is expressed as I′, and the multilevel image entropy calculation formula of I′ is as follows:(18)eI′=−∑k⌣llog2,k⌣=1,2,…,l.Then, the weighta″ calculated by the multilevel image entropy is as follows:(19)a″=eI′∑k⌣n′eI′.According to the above calculation, the edge detection of multilevel image is completed, and the edge contour information detection of the multilevel image is realized according to the detection results.


## 2.1. Smoothing and Denoising of Multilevel Images

Firstly, the multilevel image is smoothed and the double-filter denoising algorithm is selected to smooth the multilevel image.


### 2.1.1. Multilevel Image Denoising Based on Wavelet Adaptive Threshold

Firstly, according to the wavelet decomposition characteristics of multilevel images, a better threshold suitable for denoising multilevel images with different coefficients is determined to achieve smooth denoising effect [6]. The specific process is as follows.Suppose that a multilevel image ofM×N size zi,j is represented as(1)zi,j=yi,j+ni,j,where i,j∈Z represents the position of multilevel image pixels, yi,j represents a multilevel image without noise, and ni,j represents the Gaussian white noise of multilevel image subject to N0,σ2. By applying the discrete wavelet transform to both sides of the equal sign of formula (1), we can get the following results:(2)Wz=Wy+Wn,where Wz represents the wavelet coefficients of the noisy digital image after wavelet transform [7], Wy represents the wavelet coefficients of the original multilevel image after wavelet transform, and Wy represents the wavelet coefficients of Gaussian white noise after wavelet transform. Because the characteristic of wavelet transform is a kind of linear transform, then(3)Wy=Wz−Wn,where the wavelet coefficient Wy of the original multilevel image can be obtained by inverse wavelet transform. Based on wavelet threshold denoising, the main process of Wy is as follows:(1)
The multifunction digital image with noise is decomposed by wavelet transform. The appropriate wavelet and wavelet decomposition seriesN are selected to calculate the wavelet coefficients at all levels of the multifunctional digital noisy image after wavelet decomposition.(2)
Set the threshold value of each layer detail of the multilevel image [8]. Each layer from the first layer to the N layer of the image is thresholded, and then, each detail wavelet coefficient of the image is preprocessed by thresholding.(3)
Multilevel image reconstruction [9]: according to the low-frequency coefficients of the N layer and the modified high-frequency coefficients of each layer from the first layer to the N layer, the multilevel image is calculated and reconstructed.Threshold selection is the key step of multilevel image wavelet denoising and shrinkage:(a)
The calculation expression of multilevel image fixed threshold is as follows:(4)T=α2lnA,whereA represents the length of wavelet coefficients of the multilevel image, α represents the standard deviation of multilevel image noise [10], and T represents the image estimation threshold. In fact, the noise error of the image is unknown, so it is necessary to estimate and calculate the standard deviation of the noise from the noisy signal of the multilevel image; the expression is as follows:(5)α=YijH1,whereYij represents the standard deviation coefficient of the multilevel image and H1 represents the subband coefficient of the multilevel image.(b)
Multilevel image unbiased likelihood estimation threshold: set a thresholda for the multilevel image and calculate its likelihood estimation. Then, the threshold a of the multilevel image is processed by nonlikelihood minimization to get the selected threshold.(c)
Multilevel image heuristic threshold: combining the above two thresholds, it is the optimal threshold selection for multilevel image prediction variables. When the SNR of image is small, the unbiased likelihood estimation threshold has a large error, so the first fixed threshold method is used. On the contrary, unbiased likelihood estimation threshold is used.


### 2.1.2. Multilevel Image Denoising Algorithm Based on Visual Perception

The rational differential denoising model of the multilevel image is obtained to remove the noisy pixels in the image. The specific operation process is as follows.Assume that the original multilevel clear image is represented asux,y. The multilevel image affected by noise is represented as u0x,y. The image noise is expressed as nx,y. Because the noise has the characteristic of the zero mean value, the difference of the multilevel image is expressed as σ1; then, we can get the energy function expression of the multilevel image:(6)Tux,y=∇pux,ydxdy+ux,y−u0x,y2dxdy.According to formula (6), a multilevel image denoising model is established; then, the functional formula of the multilevel image is as follows:(7)TVpux,y=Fx,y,u,∂pu∂xp,∂pu∂ypdxdy,where ∂p, xp, and yp all represent the noisy scale coefficients of multilevel images and F represents the noise difference value of the multilevel image, and its calculation formula is as follows:(8)F=∇pux,y+λ2ux,y−u0x,y2,where λ represents the parameter value of the multilevel image and ∇p represents the multilevel image gradient operator ∇ and the replacement operator of p order differential operator. The necessary conditions for finding the extremum of the multilevel image are as follows:(9)λu−u0−∇p∇pu∇pu=0,∇p=∂pu∂xp,∂pu∂yp.To sum up, whenp=1, the multilevel image denoising model TVp degenerates to the TV image denoising model. When 0<p<1, the multilevel image denoising model TVp degenerates to the fractional differential denoising model. So far, the smooth denoising of the multilevel image is completed.


### 2.1.3. Multilevel Image Denoising Algorithm Based on Dual Filtering

Firstly, the basic principle of double filtering is used to divide a certain neighborhood of multilevel image noise points into four filtering templates in different directions, and median filtering is performed, respectively [11]. Then, the filtering results of the four templates in different directions are calculated to obtain the filtering values of multilevel image noise points. The detailed description process is as follows.For the noise point ati1,j1 in the multilevel image, its neighborhood size is expressed as 2N1+1×2N1+1, where N1 is a positive integer. The process of multilevel image filtering using the dual discrete wavelet method is as follows:(10)a1i1,j1=MedBi1+k,j1,−N1≤k≤N1,a2i1,j1=MedBi1j1+k,−N1≤k≤N1,a3i1,j1=MedBi1+k,j1+k,−N1≤k≤N1,a4i1,j1=MedBi1−k,j1−k,−N1≤k≤N1,where axi1,j1 represents the filtering values of four different directional filtering templates of the multilevel image, Med· represents the median filtering calculation of the multilevel image, and Bi1,j1 represents the gray matrix in a certain region of the multilevel image. The set axi1,j1 is calculated as follows:(11)Zmaxi1,j1=maxaxi1,j1,Zmini1,j1=minaxi1,j1,where Zmaxi1,j1 represents the maximum filtering coefficient of the multilevel image and Zmini1,j1 represents the minimum filtering coefficient of the multilevel image.


## 2.1.1. Multilevel Image Denoising Based on Wavelet Adaptive Threshold

Firstly, according to the wavelet decomposition characteristics of multilevel images, a better threshold suitable for denoising multilevel images with different coefficients is determined to achieve smooth denoising effect [6]. The specific process is as follows.Suppose that a multilevel image ofM×N size zi,j is represented as(1)zi,j=yi,j+ni,j,where i,j∈Z represents the position of multilevel image pixels, yi,j represents a multilevel image without noise, and ni,j represents the Gaussian white noise of multilevel image subject to N0,σ2. By applying the discrete wavelet transform to both sides of the equal sign of formula (1), we can get the following results:(2)Wz=Wy+Wn,where Wz represents the wavelet coefficients of the noisy digital image after wavelet transform [7], Wy represents the wavelet coefficients of the original multilevel image after wavelet transform, and Wy represents the wavelet coefficients of Gaussian white noise after wavelet transform. Because the characteristic of wavelet transform is a kind of linear transform, then(3)Wy=Wz−Wn,where the wavelet coefficient Wy of the original multilevel image can be obtained by inverse wavelet transform. Based on wavelet threshold denoising, the main process of Wy is as follows:(1)
The multifunction digital image with noise is decomposed by wavelet transform. The appropriate wavelet and wavelet decomposition seriesN are selected to calculate the wavelet coefficients at all levels of the multifunctional digital noisy image after wavelet decomposition.(2)
Set the threshold value of each layer detail of the multilevel image [8]. Each layer from the first layer to the N layer of the image is thresholded, and then, each detail wavelet coefficient of the image is preprocessed by thresholding.(3)
Multilevel image reconstruction [9]: according to the low-frequency coefficients of the N layer and the modified high-frequency coefficients of each layer from the first layer to the N layer, the multilevel image is calculated and reconstructed.Threshold selection is the key step of multilevel image wavelet denoising and shrinkage:(a)
The calculation expression of multilevel image fixed threshold is as follows:(4)T=α2lnA,whereA represents the length of wavelet coefficients of the multilevel image, α represents the standard deviation of multilevel image noise [10], and T represents the image estimation threshold. In fact, the noise error of the image is unknown, so it is necessary to estimate and calculate the standard deviation of the noise from the noisy signal of the multilevel image; the expression is as follows:(5)α=YijH1,whereYij represents the standard deviation coefficient of the multilevel image and H1 represents the subband coefficient of the multilevel image.(b)
Multilevel image unbiased likelihood estimation threshold: set a thresholda for the multilevel image and calculate its likelihood estimation. Then, the threshold a of the multilevel image is processed by nonlikelihood minimization to get the selected threshold.(c)
Multilevel image heuristic threshold: combining the above two thresholds, it is the optimal threshold selection for multilevel image prediction variables. When the SNR of image is small, the unbiased likelihood estimation threshold has a large error, so the first fixed threshold method is used. On the contrary, unbiased likelihood estimation threshold is used.


## 2.1.2. Multilevel Image Denoising Algorithm Based on Visual Perception

The rational differential denoising model of the multilevel image is obtained to remove the noisy pixels in the image. The specific operation process is as follows.Assume that the original multilevel clear image is represented asux,y. The multilevel image affected by noise is represented as u0x,y. The image noise is expressed as nx,y. Because the noise has the characteristic of the zero mean value, the difference of the multilevel image is expressed as σ1; then, we can get the energy function expression of the multilevel image:(6)Tux,y=∇pux,ydxdy+ux,y−u0x,y2dxdy.According to formula (6), a multilevel image denoising model is established; then, the functional formula of the multilevel image is as follows:(7)TVpux,y=Fx,y,u,∂pu∂xp,∂pu∂ypdxdy,where ∂p, xp, and yp all represent the noisy scale coefficients of multilevel images and F represents the noise difference value of the multilevel image, and its calculation formula is as follows:(8)F=∇pux,y+λ2ux,y−u0x,y2,where λ represents the parameter value of the multilevel image and ∇p represents the multilevel image gradient operator ∇ and the replacement operator of p order differential operator. The necessary conditions for finding the extremum of the multilevel image are as follows:(9)λu−u0−∇p∇pu∇pu=0,∇p=∂pu∂xp,∂pu∂yp.To sum up, whenp=1, the multilevel image denoising model TVp degenerates to the TV image denoising model. When 0<p<1, the multilevel image denoising model TVp degenerates to the fractional differential denoising model. So far, the smooth denoising of the multilevel image is completed.


## 2.1.3. Multilevel Image Denoising Algorithm Based on Dual Filtering

Firstly, the basic principle of double filtering is used to divide a certain neighborhood of multilevel image noise points into four filtering templates in different directions, and median filtering is performed, respectively [11]. Then, the filtering results of the four templates in different directions are calculated to obtain the filtering values of multilevel image noise points. The detailed description process is as follows.For the noise point ati1,j1 in the multilevel image, its neighborhood size is expressed as 2N1+1×2N1+1, where N1 is a positive integer. The process of multilevel image filtering using the dual discrete wavelet method is as follows:(10)a1i1,j1=MedBi1+k,j1,−N1≤k≤N1,a2i1,j1=MedBi1j1+k,−N1≤k≤N1,a3i1,j1=MedBi1+k,j1+k,−N1≤k≤N1,a4i1,j1=MedBi1−k,j1−k,−N1≤k≤N1,where axi1,j1 represents the filtering values of four different directional filtering templates of the multilevel image, Med· represents the median filtering calculation of the multilevel image, and Bi1,j1 represents the gray matrix in a certain region of the multilevel image. The set axi1,j1 is calculated as follows:(11)Zmaxi1,j1=maxaxi1,j1,Zmini1,j1=minaxi1,j1,where Zmaxi1,j1 represents the maximum filtering coefficient of the multilevel image and Zmini1,j1 represents the minimum filtering coefficient of the multilevel image.


## 2.2. Edge and Contour Detection Algorithm of the Multilevel Image

### 2.2.1. Multilevel Image Edge Contour Detection Algorithm Based on Gradient Operator

Based on the results of multilevel image segmentation, the gradient operator is used to detect the edge contour of the multilevel image, so as to obtain the edge contour information of the multilevel image. The specific process is as follows.The multilevel image gradient is a vector [12], whose size represents the edge strength of the image, and its direction is perpendicular to the edge direction of the image. For a multilevel image, the gradient of continuous function o′u′,v′ at u′,v′ is calculated as follows:(12)∇s′=∂0′∂0′∂u′∂v′T=Gu′,Go′T.For the multilevel image, the gray values of two adjacent points are usually used to approximate the continuous function variablesGu′ and Go′ of the digital image:(13)∇u′=u′m+1,n−u′m,n,(14)∇u′=u′m,1+n−u′m,n.According to formulas (13) and (14), the gradient operator is sensitive to the noise in the multilevel image, so it has poor antinoise ability and cannot effectively detect the edge contour information in different directions in the multilevel image.


### 2.2.2. Multilevel Image Edge Contour Detection Algorithm Based on Mathematical Morphology

On the basis of multilevel image segmentation results, the edge contour of the multilevel image is detected by using mathematical morphology edge detection operator, and the image edge with noise is removed. According to the detection results, the edge contour information of the multilevel image is detected. The specific measures are as follows.Assuming thatm multilevel image structure elements are selected for mathematical morphology calculation, the multilevel image multistructure elements Bm are expressed as follows:(15)Bm=l1⊕l2⊕l3⊕⋯lm,where l stands for multilevel image cross 3×3 structure element, whose size can be 3×3, 5×5, and 7×7 or even larger. The time of multilevel image morphological operation is usually proportional to the size of the structure element. By decomposing the structure element of the multilevel image, the operation time can be reduced. The smaller the size of the structural elements, the more the image details can be protected.It is assumed thatϕx″,y″ represents the input multilevel image gray function and φx″,y″ stands for the multilevel image structure element function, and the structure element of n′ element multilevel image is defined on the multilevel image structure element set R2 or Z2. Dϕ and Dφ represent the definition domain of multilevel image gray function ϕx″,y″ and φx″,y″, respectively.Then, the weighted average value of structure element function of multilevel image ofn′ element is calculated as follows:(16)ϕavrx″,y″=1n′∑i=1n′λ′ϕ′x″,y″.The weight value is set according to the importance difference of structural elements in the multilevel image, in the formula,λ′∈0,1.Based on the above calculation, we getn′ multilevel image edge detection operators and add appropriate weights to them to get the multilevel image edge detection operators; the calculation formula is as follows:(17)Eavrx″,y″=∑i=1n′a′E′x″,y″.Suppose the gray range of the multilevel image is1,L′, and the probability of each gray level image pixel is expressed as P0′,P1′,P2′,…,Pl′′. According to the multilevel image edge detection operator E′x″,y″, the processed image is expressed as I′, and the multilevel image entropy calculation formula of I′ is as follows:(18)eI′=−∑k⌣llog2,k⌣=1,2,…,l.Then, the weighta″ calculated by the multilevel image entropy is as follows:(19)a″=eI′∑k⌣n′eI′.According to the above calculation, the edge detection of multilevel image is completed, and the edge contour information detection of the multilevel image is realized according to the detection results.


## 2.2.1. Multilevel Image Edge Contour Detection Algorithm Based on Gradient Operator

Based on the results of multilevel image segmentation, the gradient operator is used to detect the edge contour of the multilevel image, so as to obtain the edge contour information of the multilevel image. The specific process is as follows.The multilevel image gradient is a vector [12], whose size represents the edge strength of the image, and its direction is perpendicular to the edge direction of the image. For a multilevel image, the gradient of continuous function o′u′,v′ at u′,v′ is calculated as follows:(12)∇s′=∂0′∂0′∂u′∂v′T=Gu′,Go′T.For the multilevel image, the gray values of two adjacent points are usually used to approximate the continuous function variablesGu′ and Go′ of the digital image:(13)∇u′=u′m+1,n−u′m,n,(14)∇u′=u′m,1+n−u′m,n.According to formulas (13) and (14), the gradient operator is sensitive to the noise in the multilevel image, so it has poor antinoise ability and cannot effectively detect the edge contour information in different directions in the multilevel image.


## 2.2.2. Multilevel Image Edge Contour Detection Algorithm Based on Mathematical Morphology

On the basis of multilevel image segmentation results, the edge contour of the multilevel image is detected by using mathematical morphology edge detection operator, and the image edge with noise is removed. According to the detection results, the edge contour information of the multilevel image is detected. The specific measures are as follows.Assuming thatm multilevel image structure elements are selected for mathematical morphology calculation, the multilevel image multistructure elements Bm are expressed as follows:(15)Bm=l1⊕l2⊕l3⊕⋯lm,where l stands for multilevel image cross 3×3 structure element, whose size can be 3×3, 5×5, and 7×7 or even larger. The time of multilevel image morphological operation is usually proportional to the size of the structure element. By decomposing the structure element of the multilevel image, the operation time can be reduced. The smaller the size of the structural elements, the more the image details can be protected.It is assumed thatϕx″,y″ represents the input multilevel image gray function and φx″,y″ stands for the multilevel image structure element function, and the structure element of n′ element multilevel image is defined on the multilevel image structure element set R2 or Z2. Dϕ and Dφ represent the definition domain of multilevel image gray function ϕx″,y″ and φx″,y″, respectively.Then, the weighted average value of structure element function of multilevel image ofn′ element is calculated as follows:(16)ϕavrx″,y″=1n′∑i=1n′λ′ϕ′x″,y″.The weight value is set according to the importance difference of structural elements in the multilevel image, in the formula,λ′∈0,1.Based on the above calculation, we getn′ multilevel image edge detection operators and add appropriate weights to them to get the multilevel image edge detection operators; the calculation formula is as follows:(17)Eavrx″,y″=∑i=1n′a′E′x″,y″.Suppose the gray range of the multilevel image is1,L′, and the probability of each gray level image pixel is expressed as P0′,P1′,P2′,…,Pl′′. According to the multilevel image edge detection operator E′x″,y″, the processed image is expressed as I′, and the multilevel image entropy calculation formula of I′ is as follows:(18)eI′=−∑k⌣llog2,k⌣=1,2,…,l.Then, the weighta″ calculated by the multilevel image entropy is as follows:(19)a″=eI′∑k⌣n′eI′.According to the above calculation, the edge detection of multilevel image is completed, and the edge contour information detection of the multilevel image is realized according to the detection results.


## 3. Multilevel Image Contour Feature Detection Algorithm Based on Multithreshold Optimization

### 3.1. Multithreshold Optimization Based on Genetic Algorithm

Through the analysis of multilevel image contour features, the threshold is set for multilevel image features to obtain the latest membership function [13], so as to complete the multithreshold optimization. The specific process is as follows.Based on the analysis of multilevel image contour features, the multilevel image is transformed into image fuzzy space according to the gray data space. However, the membership function of multilevel image contour fuzzy generally consumes too much time. If it is replaced by a simple linear function, the membership function matrixG of the multilevel image can be transformed quickly:(20)Pmn=xmmxT,xmm≤xT,xTxmm,xmm>xT,where xmm represents the gray value of multilevel image pixels and xT represents multithreshold.In the definition of multilevel image fuzzy matrix,Pmn represents the maximum membership degree of image pixel gray level xmm relative to the threshold xT. This method is used to define fuzzy matrix for low gray range and high gray range of multilevel image contour features, so as to reduce the information loss of low gray range of multilevel image contour features and achieve better results.Based on formula (20), the inverse transformation of G−1 is as follows:(21)xmm=Pmn×xT,xmm≤xT,Pmn×xT,xT≤xmm≤xmax.Since the gray level of the multilevel image is 0–255, the multithreshold is regarded as a chromosome. According to the 12 bit binary code, the threshold is set for each code. Two hundred individuals with different contour points are randomly selected from the multilevel image matrix, or all of them are taken as the initial population. The fitness function is given as follows:(22)f=w1u1−v2+w2u2−v2+Pmn,where u1 and u2 represent the average gray values of the two intervals of the multilevel image divided by T, w1 and w2 represent the sum of the probabilities when the gray values of the multilevel image are less than T and greater than T, and v represents the average gray values of the contour feature information of the whole multilevel image.According to the genetic algorithm, the optimal threshold is optimized, and then, a fluctuation thresholdA is set, and the maximum interclass variance is evaluated in the range of xT−A,xT+A to obtain the optimal image multithreshold.


### 3.2. Multilevel Image Contour Feature Detection Optimization

Adaptive smoothing is used to process the contour of the object in the multilevel image, and the geometric center values of the two adjacent contour points within the contour range are calculated. According to the calculation results, the curvature angle is further calculated, and the curvature symbol is obtained. According to the curvature symbol, the feature information is detected. The specific process is as follows.Edge detection and contour detection are performed on the multilevel image to obtain the contour line of the object in the image, which is recorded asP, P=pi, and pi represents the pixels on the contour line. The closed contour line is divided into two one-dimensional discrete curves xi and yi, and the description formula is as follows:(23)P=pi=xi,yi|i=0,1,…,m−1,where i is the number of pixels and m is the total number of pixels [14]. Affected by the error and noise in the process of image formation, xi and yi are not smooth. The adaptive smoothing method is used to process the curve. Let Sx represent the discrete signal on the unsmoothed curve, and the smooth signal St+1x is obtained by t+1 iterations:(24)St+1x=PW∑i=−NNStx+iktx+i,W=∑i=−NNktx+i,where ktx+i≥0−N≤i≤N is convolution weight [15]. In the process of adaptive smoothing, N=1, and ktx is(25)ktx=St+1xe∂S′tx2/2,where S′tx is the derivative result of signal Stx and ∂ is the smoothing coefficient. The larger the coefficient is, the stronger the smoothing effect is. Too strong smoothing effect will lead to the loss of uneven points and the passivation of the curve, resulting in the poor shrinkage of the image contour. The size of the coefficient needs to be selected according to the degree of unsmooth contour and image noise.After smoothing, the curvature angle of the contour is calculated with the image range ofpi as the center and R as the radius, so as to reduce the error and noise of the image. The image area composed of pixel pi and each point in radius R is Si:(26)Si=ktxpi=xj,yj,where j is the pixel number within the radius R around pi, j=i−R,i−R+1,…,i,…,i+R−1,i+R.The direction anglesθfi and θbi of the vectors composed of the two regions adjacent to pi whose center points are pfi, pbi, and pi are calculated as follows:(27)θfi=arctanyi−yfixi−xfi,θbi=arctanybi−yixbi−xi,where xfi and yfi are the abscissa and ordinate of pfi, respectively, and xbi and ybi are the abscissa and ordinate of pbi, respectively. The curvature angle θi of the contour line is obtained:(28)θi=Siθbi−θfi.When the curvature ofθi and pi is proportional, set the reference value T1 of the curvature angle. When θi>T1, pi is marked as candidate corner pixel. When θi=maxj−i≤Rθj, pi is contour corner. The curvature symbol ai is defined by curvature angle:(29)ai=0,θi≤T2,1,θi>T2,−1,θi<T2,where T2 is the default curvature angle reference value. According to the curvature symbols corresponding to each point, the different feature pixels of the image contour are distinguished, and the multilevel image contour feature detection is completed.


## 3.1. Multithreshold Optimization Based on Genetic Algorithm

Through the analysis of multilevel image contour features, the threshold is set for multilevel image features to obtain the latest membership function [13], so as to complete the multithreshold optimization. The specific process is as follows.Based on the analysis of multilevel image contour features, the multilevel image is transformed into image fuzzy space according to the gray data space. However, the membership function of multilevel image contour fuzzy generally consumes too much time. If it is replaced by a simple linear function, the membership function matrixG of the multilevel image can be transformed quickly:(20)Pmn=xmmxT,xmm≤xT,xTxmm,xmm>xT,where xmm represents the gray value of multilevel image pixels and xT represents multithreshold.In the definition of multilevel image fuzzy matrix,Pmn represents the maximum membership degree of image pixel gray level xmm relative to the threshold xT. This method is used to define fuzzy matrix for low gray range and high gray range of multilevel image contour features, so as to reduce the information loss of low gray range of multilevel image contour features and achieve better results.Based on formula (20), the inverse transformation of G−1 is as follows:(21)xmm=Pmn×xT,xmm≤xT,Pmn×xT,xT≤xmm≤xmax.Since the gray level of the multilevel image is 0–255, the multithreshold is regarded as a chromosome. According to the 12 bit binary code, the threshold is set for each code. Two hundred individuals with different contour points are randomly selected from the multilevel image matrix, or all of them are taken as the initial population. The fitness function is given as follows:(22)f=w1u1−v2+w2u2−v2+Pmn,where u1 and u2 represent the average gray values of the two intervals of the multilevel image divided by T, w1 and w2 represent the sum of the probabilities when the gray values of the multilevel image are less than T and greater than T, and v represents the average gray values of the contour feature information of the whole multilevel image.According to the genetic algorithm, the optimal threshold is optimized, and then, a fluctuation thresholdA is set, and the maximum interclass variance is evaluated in the range of xT−A,xT+A to obtain the optimal image multithreshold.


## 3.2. Multilevel Image Contour Feature Detection Optimization

Adaptive smoothing is used to process the contour of the object in the multilevel image, and the geometric center values of the two adjacent contour points within the contour range are calculated. According to the calculation results, the curvature angle is further calculated, and the curvature symbol is obtained. According to the curvature symbol, the feature information is detected. The specific process is as follows.Edge detection and contour detection are performed on the multilevel image to obtain the contour line of the object in the image, which is recorded asP, P=pi, and pi represents the pixels on the contour line. The closed contour line is divided into two one-dimensional discrete curves xi and yi, and the description formula is as follows:(23)P=pi=xi,yi|i=0,1,…,m−1,where i is the number of pixels and m is the total number of pixels [14]. Affected by the error and noise in the process of image formation, xi and yi are not smooth. The adaptive smoothing method is used to process the curve. Let Sx represent the discrete signal on the unsmoothed curve, and the smooth signal St+1x is obtained by t+1 iterations:(24)St+1x=PW∑i=−NNStx+iktx+i,W=∑i=−NNktx+i,where ktx+i≥0−N≤i≤N is convolution weight [15]. In the process of adaptive smoothing, N=1, and ktx is(25)ktx=St+1xe∂S′tx2/2,where S′tx is the derivative result of signal Stx and ∂ is the smoothing coefficient. The larger the coefficient is, the stronger the smoothing effect is. Too strong smoothing effect will lead to the loss of uneven points and the passivation of the curve, resulting in the poor shrinkage of the image contour. The size of the coefficient needs to be selected according to the degree of unsmooth contour and image noise.After smoothing, the curvature angle of the contour is calculated with the image range ofpi as the center and R as the radius, so as to reduce the error and noise of the image. The image area composed of pixel pi and each point in radius R is Si:(26)Si=ktxpi=xj,yj,where j is the pixel number within the radius R around pi, j=i−R,i−R+1,…,i,…,i+R−1,i+R.The direction anglesθfi and θbi of the vectors composed of the two regions adjacent to pi whose center points are pfi, pbi, and pi are calculated as follows:(27)θfi=arctanyi−yfixi−xfi,θbi=arctanybi−yixbi−xi,where xfi and yfi are the abscissa and ordinate of pfi, respectively, and xbi and ybi are the abscissa and ordinate of pbi, respectively. The curvature angle θi of the contour line is obtained:(28)θi=Siθbi−θfi.When the curvature ofθi and pi is proportional, set the reference value T1 of the curvature angle. When θi>T1, pi is marked as candidate corner pixel. When θi=maxj−i≤Rθj, pi is contour corner. The curvature symbol ai is defined by curvature angle:(29)ai=0,θi≤T2,1,θi>T2,−1,θi<T2,where T2 is the default curvature angle reference value. According to the curvature symbols corresponding to each point, the different feature pixels of the image contour are distinguished, and the multilevel image contour feature detection is completed.


## 4. Experimental Analysis

In order to verify the overall effectiveness of multilevel image edge detection algorithm based on visual perception, simulation test is needed. The visual images used in the experiment were all 512 × 512. The experiment was carried out in the MATLAB R2010a environment. The hardware conditions were 4.0 GB memory, 3.30 GHz frequency, Intel (R) Core (TM) I3-2120 CPU. Multilevel image edge detection algorithm based on visual perception (the algorithm in this paper), the algorithm in [4], and the algorithm in [5] are used to test the sample image processing, PSNR (peak signal-to-noise ratio), reconstruction speed, and three parameters.The experimental parameters of the multilevel image edge detection algorithm are shown in Table1:Table 1
Parameter settings.
NameParameterImage partitioning8 × 8 size block, and each block contains 64 pixelsImage color space conversionY = 1.587Cb + 0.5884Cr = 2.0454Significant digit8Actual value0.0001AC coefficient brightnessStroke/size: 0/5, code length: 5, and code word: 11010AC coefficient chromaStroke/size: F/A, code length: 16, and code word: 11111111111111111110Chaotic systemLogistic mappingPseudorandom sequence generation methodThreshold methodImage scrambling methodBaker mappingThe multilevel image sample diagram is shown in Figure1:Figure 1
Multilevel image sample diagram.According to the detection process of the algorithm in this paper, the samples in Figure1 are detected and processed. In the same experimental conditions, the algorithm in [4] and the algorithm in [5] are used for detection and processing. The results are shown in Figure 2.Figure 2
Sample image processing results under different algorithms. (a) Present algorithm. (b) The algorithm in [4]. (c) The algorithm in [5].
(a)(b)(c)As can be seen from Figure2, the detection results of the proposed algorithm are similar to those of the sample image, while the detection results of the algorithm in [4] and the algorithm in [5] are far from those of the sample image. The reason is that the proposed algorithm sets thresholds for the multilevel image features by analyzing the contour features of the multilevel image, obtains the latest membership function, and completes multithreshold optimization, which is in favor of optimizing the detection results of the sample image to a certain extent.Figure3 shows the results of reconstruction time and PSNR of different algorithms for 16 × 16 block images with different sampling rates.Figure 3
Performance diagrams of various algorithms under different sampling rates. (a) Change in peak signal-to-noise ratio. (b) Change in reconfiguration time.
(a)(b)From the analysis of Figure3, we can see that the algorithm can get good image reconstruction results in a short time when the sampling rate is below 0.5. Ding and Tu [4] and Xia et al. [5] have significantly improved reconstruction performance with increasing sampling rates, but take longer to run because Shang et al. [16] need to determine the sparsity of the image signal, Xiang and Tang [17] need to compute thresholds based on the noise level of the visual image, and the two coefficients do not exist in the visual image and therefore take a longer time. Before the reconstruction of the visual image, the variational model and the learning dictionary are combined to remove the noise, shorten the reconstruction time, and improve the PSNR.Throughout the comparison of all simulation results, the method in this paper has better image reconstruction capabilities than other methods. With the increase of the sampling rate, the methods proposed in [17] and [18] have peak signal-to-noise ratio which is constantly improving, and [18] is significantly better than [17]. However, when the sampling rate is 80%, [17] is better than [18] because, at this time, the sparsity and noise level of the image signal have the least impact on [17], so its reconstruction ability is better than the references of the same period [18].As can be seen from Table2, the time of multilevel image morphological operation is usually proportional to the size of the structure element. By decomposing the structure element of the multilevel image, the operation time can be reduced. The smaller the size of the structural elements is, the more the image details can be protected.Table 2
The parameter selection of multilevel image cross structure element.
ParameterScore3× 387.623× 386.357× 785.67In order to further verify the overall effectiveness of the algorithm, the image resolution as a test index, the better the image resolution, the higher the quality of image reconstruction; this algorithm, [4] algorithm, and [5] algorithm of the image resolution are shown in Figure 4.Figure 4
Image resolution results from different algorithms.Analysis of the data in Figure4 shows that the image resolution of the proposed algorithm is higher than that of [4, 5] in many iterations because the small atomic size dictionary is used to preserve the edge and texture information in the image during the denoising process, and the larger atomic size dictionary is used to distinguish the noise and the original signal in the image, thus improving the image denoising effect and the image resolution.The detection results of the multilevel image edge contour detection algorithm based on visual perception are similar to those of the sample image, and good image reconstruction results can be obtained in a relatively short time when the sampling rate is lower than 0.5. Before the reconstruction of visual images, the variational model and learning dictionary are combined to denoising the images, which eliminates the interference caused by noise on image reconstruction, shortens the reconstruction time, and improves the peak signal-to-noise ratio. The algorithm in this paper has a higher image resolution in multiple iterations.


## 5. Conclusion and Prospect

### 5.1. Conclusion

The results of multilevel image edge contour detection algorithm based on visual perception are close to the sample image, and good image reconstruction results can be obtained in a short time when the sampling rate is lower than 0.5. Before reconstructing the visual image, the image is denoised by combining the variational model and learning dictionary, which eliminates the interference of noise on image reconstruction, shortens the reconstruction time, and improves the peak signal-to-noise ratio. The image resolution of this algorithm is higher in multiple iterations.


### 5.2. Prospects

The multilevel image edge detection algorithm based on visual perception has achieved good results, and there are many problems to be further studied and solved in the process of research.(1)
For the detection of edge contour features, different window sizes have different effects on different features. Windows of different sizes are selected to detect the features of pixel points, which avoid the influence of window size on edge contour features detection. Among them, the optimal window size is not conclusive, and the most significant value is selected from the result. Much work needs to be done to analyze the influence of different window sizes on different features.(2)
For the clustering analysis of filter response vector, the speed of clustering algorithm greatly affects the overall speed of multilevel image edge detection algorithm, which is also of great significance to speed up and optimize the clustering algorithm.(3)
The optimization of multilevel image edge detection algorithm will greatly improve the final detection effect. Visual perception is only one of them, and other fusion algorithms need to be further studied.


## 5.1. Conclusion

The results of multilevel image edge contour detection algorithm based on visual perception are close to the sample image, and good image reconstruction results can be obtained in a short time when the sampling rate is lower than 0.5. Before reconstructing the visual image, the image is denoised by combining the variational model and learning dictionary, which eliminates the interference of noise on image reconstruction, shortens the reconstruction time, and improves the peak signal-to-noise ratio. The image resolution of this algorithm is higher in multiple iterations.


## 5.2. Prospects

The multilevel image edge detection algorithm based on visual perception has achieved good results, and there are many problems to be further studied and solved in the process of research.(1)
For the detection of edge contour features, different window sizes have different effects on different features. Windows of different sizes are selected to detect the features of pixel points, which avoid the influence of window size on edge contour features detection. Among them, the optimal window size is not conclusive, and the most significant value is selected from the result. Much work needs to be done to analyze the influence of different window sizes on different features.(2)
For the clustering analysis of filter response vector, the speed of clustering algorithm greatly affects the overall speed of multilevel image edge detection algorithm, which is also of great significance to speed up and optimize the clustering algorithm.(3)
The optimization of multilevel image edge detection algorithm will greatly improve the final detection effect. Visual perception is only one of them, and other fusion algorithms need to be further studied.



---

*Source: 3502041-2022-01-10.xml*