A Convex Model for Edge-Histogram Specification with Applications to Edge-preserving Smoothing

The goal of edge-histogram specification is to find an image whose edge image has a histogram that matches a given edge-histogram as much as possible. Mignotte has proposed a non-convex model for the problem [M. Mignotte. An energy-based model for the image edge-histogram specification problem. IEEE Transactions on Image Processing, 21(1):379--386, 2012]. In his work, edge magnitudes of an input image are first modified by histogram specification to match the given edge-histogram. Then, a non-convex model is minimized to find an output image whose edge-histogram matches the modified edge-histogram. The non-convexity of the model hinders the computations and the inclusion of useful constraints such as the dynamic range constraint. In this paper, instead of considering edge magnitudes, we directly consider the image gradients and propose a convex model based on them. Furthermore, we include additional constraints in our model based on different applications. The convexity of our model allows us to compute the output image efficiently using either Alternating Direction Method of Multipliers or Fast Iterative Shrinkage-Thresholding Algorithm. We consider several applications in edge-preserving smoothing including image abstraction, edge extraction, details exaggeration, and documents scan-through removal. Numerical results are given to illustrate that our method successfully produces decent results efficiently.


Introduction
Histogram specification is a process where the image histogram is altered such that the histogram of the output image follows a prescribed distribution. It is one of the many important tools in image processing with numerous applications such as image enhancement [15,16,40], segmentation [5,33,34] among many others.
The goal of edge-histogram specification is to find an image whose edge image has a histogram that matches a given edge-histogram as much as possible. In [19], Mignotte proposed a non-convex model for the problem. Given a discrete input image I of size m-by-n, let r ∈ R k be a vector storing the pairwise differences r s,t := |I s − I t |, s = 1, 2, · · · mn, t ∈ N s , where I i denotes the value of the i-th pixel of I, and N s denotes a neighbourhood of the s-th pixel. Here k = mn|N s | with |N s | the number of elements in N s . Given a target edge-histogram h, one can perform histogram specification on r to obtain d: r = (r s 1 ,t 1 , · · · , r s k ,t k ) In [19], the author used a two-step procedure to accomplish (2). First, the ordering algorithm in [7] is applied to get a total order of r. Then, with the total order, the entries of r can be re-ordered according to h to get d.
After (2), one get the output image X by solving the minimization problem min X mn s=1 t∈Ns Model (3) is solved by a conjugate gradient procedure followed by a stochastic local search. However, the non-convex nature of the model hinders the computations, and it is difficult to include additional constraints. In this paper, we propose a convex model that can include additional constraints based on different applications in edge-preserving smoothing. Edge-preserving smoothing is a popular topic in image processing and computer graphics. Its aim is to suppress insignificant details and keep important edges intact. As an example, the input image in Figure 3a contains textures on the slate and the goal of edgepreserving smoothing is to remove such textures and keep only the object boundaries as in Figure 3c. Numerous methods have been introduced to perform the task. Anisotropic diffusion [2,25] performs smoothing by means of solving a non-linear PDE. Bilateral filtering [4,24,35,41] is a method combining domain filters and range filters. They are widely used because of their simplicity. Optimization frameworks such as the weighted least squares (WLS) [9] and TV regularization [3,26] are also introduced. In WLS, a regularization term is added to minimize the horizontal and vertical gradients with corresponding smoothness weights. Recently, models based on l 0 -gradient minimization [6,20,22,23,31,43] have become popular. These models focus on the l 0 -norm of the image gradients.
One application of edge-preserving smoothing is scan-through removal. Written or printed documents are usually subjected to various degradations. In particular, two-sided documents can be suffered from the effect of back-to-front interference, known as "seethrough", see Figure 10. The problem is especially severe in old documents, which is caused by the bad quality of the paper or ink-bleeding. These effects greatly reduce the readability and hinder optical character recognition. Therefore it is of great importance to remove such interference. However, physical restoration is difficult as it may damage the original contents of the documents, which is clearly undesirable as the contents may be important. Consequently, different approaches in the field of image processing are considered to restore the images digitally.
These approaches can be mainly classified into two classes: Blind and Non-blind methods. Non-blind methods [11, 17, 18, 27-30, 38, 39] require the information of both sides. These methods usually consist of two steps. First, the two sides of the images are registered. Then, the output image is computed based on the registered images. It is obvious that these methods strongly depend on the quality of registration; therefore highly accurate registration is needed. However, perfect registration is hard to achieve in practice due to numerous sources of errors including local distortions and scanning errors. Furthermore, information from the back page is not available in some occasions. Therefore, blind methods which do not assume the availability of the back page are also developed in solving the problem, see [8,21,32,36,37,42].
In this paper, we propose a convex model for applications in edge-preserving smoothing. In our work, we modify the objective function in the non-convex model in [19] so that we only need to solve a convex minimization problem to obtain the output. The simplicity of our model allows us to incorporate different useful constraints such as the dynamic range constraint; and the convexity of our model allows us to compute the output efficiently by Fast Iterative Shrinkage-Thresholding Algorithm (FISTA) [1] or Alternating Direction Method of Multipliers (ADMM) [10,12]. We introduce different edge-histograms and suitable constraints in our model, and apply them to different imaging tasks in edgepreserving smoothing, including image abstraction, edge extraction, details exaggeration, and scan-through removal.
The outline of the paper is as follows: Section 2 describes the proposed convex model, Section 3 presents the applications of our model with numerical results, and conclusions are then presented in Section 4.

Our Model
In our model, we do not consider the edge magnitudes as in (1). Instead, we directly consider the image gradients and define r with entries r s,t := I s − I t .
Similar to [19], our model consists of two parts. First, given r, we perform histogram specification on r to obtain d as in (2). In the second part, we solve a minimization problem to obtain the output X. Instead of solving the non-convex model (3), we propose a convex model. In Section 2.1, we present our convex model and its solvers. In Sections 2.2 to 2.4, we apply our model to specific applications in edge-preserving smoothing.
In the following discussions, we consider only grayscale images. For colored images, we apply our method to R, G, B channels separately.

Proposed convex model
Instead of (3), we propose the convex model where p = 1 or 2, C is a convex set to be discussed in Section 2.4, and ι C denotes the indicator function of C. The choice of p and C depends on applications. Let x be a vector such that its s-th entry is X s . Then we can rewrite (4) as In our tests, we use N s = {s v , s h }, where s v and s h denote the pixel above and at the left of the s-th pixel. Hence we can write which can be solved by ADMM [10,12].

Construction of target edge-histogram
For the applications we considered in this paper, one objective is to remove textures in the images where their edges have small magnitude. As an example, the textures on the slate in Figure 1a produce smaller edge magnitudes compared to the boundaries of the slate and the letters on the slate, see Figures 1b and 1c. To eliminate those textures, we could set the values of edges with small magnitude to zero. Hence, in this paper, we propose to use edge-histograms similar to that shown in Figure 2b as target edge-histogram which is obtained by thresholding the input edge-histogram in Figure 2a. In particular, the target edge-histogram is dependent on the input image. We remark here that it is not uncommon to construct the target histogram based on the input. For example, such construction is used in image segmentation [33].
Since we are just thresholding the edges with small values to zero, the edge-histogram specification (2) can be done easily as follows. Given any input image Y , we first compute its gradients y s,t = Y s − Y t . Then we set The thresholded z s,t , where its histogram is shown in Figure 2b, will be used as the vector d in (5) to obtain the output x. It is obvious that different λ gives different outputs, see Figure 3. We see that the smoothness of the output increases with λ.

Gaussian smoothing and iterations
Strong textures can produce edges with large magnitude that cannot be eliminated using a thresholded edge-histogram as in Figure 2b. To suppress them, the input image I will first pass through a Gaussian filter with standard deviation σ to get the initial guess X (0) . Larger σ will have a greater effect in suppressing strong textures, but at the same time blur the image. Hence, σ should be chosen small enough so that the Gaussian-filtered image is visually equal to I. Let X (0) be the Gaussian-filtered image. Whenever such suppression is unnecessary, we set σ = 0 and hence X (0) = I. As mentioned in Section 2.2, one of our objectives is to map small edges to zero. This can be done by changing the λ in the thresholded edge-histogram or by solving (5) repeatedly. More specifically, given X (0) , we construct d using (6) and solve (5) to obtain X (1) . Then we repeat the process to obtain X (2) and so on. Figure 4 shows a comparison; while we see in Figure 4b that the result after one iteration still contains textures in the grasses, almost all of them are removed after three iterations, see Figure 4c.
For example, consider the case when one defines h such that every pixel of r is doubled. In the absence of (7), it is easy to get an exact solution X of (3) if any one of the pixel values is given. However, there is no guarantee that the pixel values of X lies within [0, 255]. Therefore, when X is converted back to the desired dynamic range, either by stretching or clipping, the edge-histogram is no longer preserved. To avoid this, it is better to include the dynamic range constraint in the objective function. Therefore, we use the following constraint in all our applications: In scan-through removal, we assume the background in books and articles have a lighter intensity than the ink in all color channels. Therefore, in addition to the dynamic range constraint, we also keep the value of the background pixels unchanged. Hence, we set where α is the approximate intensity of the background to be defined in Section 3.4.

Applications and Comparisons
Edge-preserving smoothing includes many different applications. In this section, we consider four applications, namely image abstraction, edge extraction, details exaggeration, and scan-through removal. For the first three applications, we use p = 2 in (5) and solve it by FISTA with the input image as initial guess. We compare with four existing methods: bilateral filtering [24], weighted-least square [9], l 0 -smoothing [43], and l 0 -projection [22]. For the scan-through removal, we use p = 1 in (5) and solve it by ADMM with the input image and d as the initial guesses. We compare with one blind method [21] and three non-blind methods [14,17,37]. In all applications, the number of iterations is fixed at 3. The values λ and σ vary for different images and will be stated separately.
For the tests below, we select the parameters which give the output image with the best visual quality. Some of the comparison results are obtained directly from the authors' work and some are done by ourselves. For the results done by ourselves, we list out the parameters we have used.

Image abstraction
The goal of image abstraction is to remove textures and fine details so that the output looks un-photorealistic. This can be done by solving (5) with constraint (8). As shown in Figure 5, the textures of the objects in the photorealistic input image in Figure 5a is removed and our output in Figure 5f becomes un-photorealistic. We see that our model successfully eliminate almost all object textures and keep the object boundaries intact. As we see in Figure 5f, the details in the basketball net in our output are kept intact, while it disappears in the output of other models.

Edge extraction
Object textures are sometimes misclassified as edges during the edge detection process. In order to reduce misclassifications, image abstraction as discussed in the last section can be used to suppress object textures. Given an input image as shown in Figure 6a, objects of less importance such as clouds and grasses can be eliminated by image abstraction. Using our method, a smooth image as in Figure 6f is obtained. Edge detection or segmentation can then be applied to the output image to obtain a result with much fewer distortions. Figure 7 shows the results of applying the Canny edge detector to the grayscale version of Figure 6. We see that while the output of other models keep unnecessary details, our model produces result containing only salient edges, and removes unimportant details.

Details exaggeration
Details exaggeration is to enhance the fine details in an image as much as possible. Given an input image I, we obtain a smooth image X by our method where the textures in I are removed, see in Figure 8b. As seen in Figure 8c, the image |I − X| has small values in regions with insignificant textures and large values in the parts containing strong textures. (c) WLS [9], α = 2, λ = 2 (d) l 0 -smoothing [43] (e) l 0 -projection [22], α = 9264 (f) Ours, λ = 10, σ = 0.7 Figure 6: Comparison of our method with other methods in edge extraction.
By enhancing (I − X) and adding it back to X, a details-exaggerated image J can be obtained, see Figure 8d. Mathematically, we have J = X + s(I − X), where s > 1 is a parameter controlling the extent of exaggeration. Figure 9 shows a comparison with the results by other methods. In Figure 9f we see that our model successfully produces better result with more exaggerated details.

Scan-through removal
Two-sided documents can be suffered from the effect of back-to-front interference, known as "see-through". Usually, "see-through" produces relatively small gradient fluctuations than the main content we want to preserve, see Figure 10. By considering the edges, one can identify interferences and eliminate them. Recall in (9), we also impose a constraint that background pixels will not be modified. Here background pixels refer to the pixels with values not less than α. To find a suitable α, we first need to locate background regions-regions which contain only insignificant intensity change, i.e. the standard deviation of the intensity within the region should be small. Motivated by this, we design a multi-scale sliding window method to compute a suitable α. A sliding window with size w is used to scan through an input image Y with stride w/5 . At each location p, the mean intensity m p of the sliding window is computed and if its standard deviation σ p is smaller than a parameterσ, m p will be stored for future selection. After scanning through the whole image, we set α to the largest stored value to avoid choosing regions with purely foreground or interference. If σ p ≥σ for all p, we replace w by w/2 and scan through the image again. At the worst case when w = 1, it is  [24] (c) WLS [9] (d) l 0 -smoothing [43] (e) l 0 -projection [22] (f) Ours, λ = 10, σ = 0.7 Figure 7: Applying Canny edge detector to the grayscale version of Figure 6. equivalent to setting α to the maximum intensity of the image. In our tests, we useσ = 3. The reason for using a varying window size is that a small region will have a chance of capturing extreme value and a large window will have a chance of failing in capturing purely background. Therefore, we start from a large window and stop once we find at least one region with small standard deviation. The initial window we use is the largest square window of length w = 2 that can fit inside the given image. Figure 10 shows the windows (red-colored squares) obtained by the procedure above. We see that it successfully locates regions with pure background. The background level α is the mean intensity of the corresponding square.
With α found, we solve our model (5) with constraint (9) to obtain the output. We test our method using the first image in Figure 10. Our output is shown in Figure 11b, where we see that the contents are kept and the back-page interferences are removed. Figure 11a shows a comparison with the blind method from [21]. We also compare our (c) WLS [9] (d) l 0 -smoothing [43] (e) l 0 -projection [22] α = 127920, s = 2 (f) Ours λ = 13, s = 2.5, σ = 0 result with three non-blind methods [14,17,37]. For copyright reasons, we can only refer readers to the papers [17,37] to see the resulting images from the three methods. Our method outperforms the blind method and is comparable to the non-blind methods, while these non-blind methods require information from both sides.

Conclusion
We have proposed a convex model with suitable constraints for edge-preserving smoothing tasks including image abstraction, edge extraction, details exaggeration, and documents scan-through removal. Our convex model allows us to solve it efficiently by existing algorithms.
In this paper, because of the special applications we considered, we use only the thresholded histograms as target edge-histograms. In the future, we would investigate more general shapes of edge-histograms and apply them to a wider class of problems.