Next Article in Journal
On the Quantification of Visual Texture Complexity
Next Article in Special Issue
A Model of Pixel and Superpixel Clustering for Object Detection
Previous Article in Journal
Towards More Accurate and Complete Heterogeneous Iris Segmentation Using a Hybrid Deep Learning Approach
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Local Contrast-Based Pixel Ordering for Exact Histogram Specification

Department of Media Design, Faculty of Design, Kyushu University, 4-9-1 Shiobaru, Minamiku, Fukuoka 815-8540, Japan
*
Author to whom correspondence should be addressed.
J. Imaging 2022, 8(9), 247; https://doi.org/10.3390/jimaging8090247
Submission received: 29 June 2022 / Revised: 29 August 2022 / Accepted: 8 September 2022 / Published: 10 September 2022
(This article belongs to the Special Issue Imaging and Color Vision)

Abstract

:
Histogram equalization is one of the basic image processing tasks for contrast enhancement, and its generalized version is histogram specification, which accepts arbitrary shapes of target histograms including uniform distributions for histogram equalization. It is well known that strictly ordered pixels in an image can be voted to any target histogram to achieve exact histogram specification. This paper proposes a method for ordering pixels in an image on the basis of the local contrast of each pixel, where a Gaussian filter without approximation is used to avoid the duplication of pixel values that disturbs the strict pixel ordering. The main idea of the proposed method is that the problem of pixel ordering is divided into small subproblems which can be solved separately, and then the results are merged into one sequence of all ordered pixels. Moreover, the proposed method is extended from grayscale images to color ones in a consistent manner. Experimental results show that the state-of-the-art histogram specification method occasionally produces false patterns, which are alleviated by the proposed method. Those results demonstrate the effectiveness of the proposed method for exact histogram specification.

1. Introduction

Histograms represent the distribution of pixel values in images, and can offer various image statistics [1] to us, i.e., histograms have useful information for image processing applications such as image enhancement, compression, and segmentation [2,3,4]. Therefore, histograms are the basis for numerous spatial domain processing techniques [5], which include intensity transformation as a special case where the smallest neighborhood of size 1 × 1 is used. Histogram equalization, which theoretically transforms an input image into the corresponding output image having a uniform histogram, is one of the intensity transformation techniques for contrast enhancement [5]. More generally, the method for generating an output image that has a specified target histogram is called histogram specification or histogram matching [5], in which histogram equalization is included as a special case [6]. It is pointed out that histogram equalization may cause over enhancement [7]. In such situations, histogram specification will be a good candidate for substitute methods because it accepts any shape of histograms. In this paper, although we would like to use a Gaussian distribution constantly for the target histogram in histogram specification to simplify our explanation, other choices such as bimodal or multimodal distribution may work well.
For digital images that are composed of pixels with quantized values, it is usual that the number of pixels in an image is greater than the number of possible quantized pixel values. Therefore, there are a large number of pixels that share the same quantized pixel value in a digital image, which means that exact histogram specification for digital images is an ill-posed problem [8]. For the effective utilization of all possible quantized pixel values and the suppression of the occurrence of false contours, a number of research works have been conducted for more than four decades since Hall published his work on discrete distribution transformation [9]. In addition to these technical needs, it is our genuine curiosity to make and see exactly histogram-equalized or specified images because the solution of the ill-posed problem is not unique. A promising approach to exact histogram specification is to obtain a meaningful strict ordering of all pixels in an image. Once we obtain the ordering of pixels, we can assign a limited number of pixel values to the ordered pixels so that the resultant histogram coincides with a specified target histogram.
The simplest way of pixel ordering is random ordering [10]. However, the random ordering is not a meaningful ordering. Coltuc et al. [11] described the process of exact histogram specification when a strict ordering is given, and proposed an ordering method, which is called the local mean method (LM), based on a filter bank of multiple moving average filters. Wan and Shi [12] proposed a wavelet-based exact pixel ordering algorithm (WA) for both exact histogram specification and image enhancement, which takes into account not only local mean intensity values, but also local edge information. Nikolova and Steidl [13] proposed a fast ordering algorithm for exact histogram specification based on a variational approach, which is equivalent to an iterative nonlinear filtering, and demonstrated that their variational ordering method outperforms both LM [11] and WA [12]. They also applied their algorithm to hue and range preserving enhancement of color images [14], where the histogram of an intensity image is exactly equalized or specified, and then an affine transform is applied to each color in a hue and range preserving manner.
In this paper, we propose a local contrast-based pixel ordering method for exact histogram specification, which computes the local contrast of each pixel by using a Gaussian filter [15] without approximation, and compare the proposed method with the state-of-the-art method by Nikolova and Steidl [13]. Furthermore, the proposed method for grayscale images is extended to that for color images in a consistent manner. Experimental results demonstrate that Nikolova and Steidl’s method can produce false patterns in flat areas of images, which are alleviated by the proposed method. For color images, it is experimentally shown that the proposed method outputs exactly histogram-equalized or specified images with closer hue to original images than that obtained by a separable method that utilizes Nikolova and Steidl’s method for exact histogram equalization and specification of each color channel. These results demonstrate the effectiveness of the proposed method compared with the state-of-the-art method.
The rest of this paper is organized as follows: Section 2 provides a brief review of some related works. Section 3 briefly summarizes conventional histogram equalization. Section 4 summarizes conventional histogram specification and Nikolova and Steidl’s exact histogram specification [13]. Section 5 proposes a local contrast-based exact histogram specification method, which is extended to that for color images. Section 6 shows experimental results, where the proposed method is compared with the state-of-the-art methods by Nikolova and Steidl [13] and Ramos et al. [16]. Finally, Section 7 concludes this paper.

2. Related Work

In this section, we review recent related works on histogram equalization and specification. Recently, Pallavi et al. [17] reviewed state-of-the-art techniques for image enhancement, in which the techniques of histogram equalization are also included such as contrast limited adaptive histogram equalization (CLAHE) [18] and brightness preserving bi-histogram equalization (BBHE) [19]. Trongtirakul and Agaian [20] proposed a weighted histogram equalization using entropy of probability density function, which outperformed related methods including a low-rank regularized retinex model (LR3M) [21]. More recently, Zhang et al. [22] proposed an unsupervised low-light image enhancement method via a histogram equalization prior (HEP) based on the observation that the feature maps of histogram equalization enhanced image and the ground truth are similar.
Hussain et al. [23] proposed a locally transformed histogram-based technique for dark image enhancement, which does not get affected from the over-enhancement problem. Balado [24] examined an optimum exact histogram specification problem and the inverse problem, and presented their closed-form performance analyses. Ramos et al. [16] proposed two algorithms for histogram specification and quantile transformation of data without local information. As one of the state-of-the-art algorithms for histogram specification, we implemented the first algorithm of Ramos et al. in this paper as described below. However, their algorithm does not produce an output image having the histogram being exactly identical to the target one.
The above review of recent related works draws a conclusion that Nikolova and Steidl’s algorithm [13] is still one of the state-of-the-art algorithms for exact histogram specification.

3. Histogram Equalization

Let F = [ f i j ] be a grayscale image for i = 1 , 2 , , m and j = 1 , 2 , , n , where f i j { 0 , 1 , , L } denotes the pixel value at the position ( i , j ) on the image plane with m rows and n columns. The maximum pixel value L is typically given by L = 2 8 1 = 255 in an 8-bit grayscale. Then, the histogram of the pixel values in F is given by h = [ h 0 , h 1 , , h L ] whose kth element is computed by
h k = i = 1 m j = 1 n δ k , f i j
for k = 0 , 1 , , L , where δ k , f i j denotes the Kronecker delta function defined by δ k , f i j = 0 for k f i j , and 1 for k = f i j . Note that the histogram h is not normalized, i.e., k = 0 L h k = m n 1 . The corresponding cumulative histogram is given by H = [ H 0 , H 1 , , H L ] whose lth element is defined by
H l = k = 0 l h k
for l = 0 , 1 , , L , and recursively computed by H l = H l 1 + h l for l = 1 , 2 , , L with H 0 = h 0 . Histogram equalization converts a pixel value f i j into
f i j H E = ϕ h H E ( f i j ) : = round L H f i j H f min H f max H f min ,
where f min = min i , j { f i j } , f max = max i , j { f i j } , and the ‘round’ operator rounds a given argument toward the nearest integer, and ϕ h H E denotes the function of converting pixel values in histogram equalization.
Figure 1 shows an example of histogram equalization, where an original image in Figure 1a is converted into the image in Figure 1d, and their histograms and cumulative ones are shown in Figure 1b,c and Figure 1e,f, respectively, where the horizontal axis of each graphic denotes the pixel value ranging from 0 to 255, and the vertical axis denotes the (cumulative) number of pixels for each (cumulative) histogram. As shown in Figure 1e, the resultant histogram is not equalized actually, but the cumulative one is linearized as shown in Figure 1f. That is, to be more precise, the conventional histogram equalization is a cumulative histogram linearization.

4. Histogram Specification

In this section, we summarize conventional histogram specification, which is not an exact method, and then briefly summarize the state-of-the-art method for exact histogram specification by Nikolova and Steidl [13]. After that, we propose a local contrast-based method for exact histogram specification, whose objects to be processed are extended from grayscale images to color images.

4.1. Conventional Histogram Specification

Let h ^ = [ h ^ 0 , h ^ 1 , , h ^ L ] be a target histogram into which we want to convert the histogram h of the original image F, where we assume that k = 0 L h ^ k = k = 0 L h k for convenience. Then, we can compute the cumulative histogram H ^ = [ H ^ 0 , H ^ 1 , , H ^ L ] from h ^ in the same manner as above. Theoretically, we can describe the relationship between the target histogram h ^ and the original one h as
f i j H S = ϕ h ^ H E 1 f i j H E = ϕ h ^ H E 1 ϕ h H E ( f i j ) ,
where f i j H S denotes the output pixel value of histogram specification corresponding to an input pixel value f i j , and ( ϕ h ^ H E ) 1 denotes the inverse function of ϕ h ^ H E which equalizes the target histogram h ^ . However, in the digital condition, the functions ϕ h H E and ϕ h ^ H E become staircase functions, which are not bijective. Therefore, they have no inverse functions.
A prescription for this situation may be the use of linear interpolation as follows: Assume that ϕ h ^ H E ( l 1 ) < ϕ h H E ( f i j ) ϕ h ^ H E ( l ) for l { 0 , 1 , , L } , where we define that ϕ h ^ H E ( 1 ) = 0 . Then, we can determine the output pixel value of histogram specification by
f i j H S round ϕ h ^ H E ( l ) ϕ h H E ( f i j ) max { l 1 , 0 } + ϕ h H E ( f i j ) ϕ h ^ H E ( l 1 ) l ϕ h ^ H E ( l ) ϕ h ^ H E ( l 1 )
corresponding to an input pixel value f i j .
Figure 2 shows an example of histogram specification, where the resultant image in Figure 2a is obtained with a Gaussian target histogram with mean 127.5 and standard deviation 50 from the original image in Figure 1a. Figure 2b shows the obtained histogram, which is not Gaussian, but the cumulative one fits into the target cumulative histogram as shown in Figure 2c, where a blue solid line denotes the target one, and the yellow dashed line denotes the obtained one. That is, to be more precise, the conventional histogram specification is a cumulative histogram specification.

4.2. Nikolova and Steidl’s Method

In this subsection, we briefly summarize Nikolova and Steidl’s fast ordering algorithm for exact histogram specification [13]. They proposed a fixed point algorithm that attains the minimizer of fully smoothed l 1 -TV (total variation) functional as follows:
J ( u , f ) : = ι = 1 m n θ ( u ι f ι ) + β κ = 1 r θ ( ( G u ) κ ) ,
where β > 0 , f = [ f 1 , f 2 , , f m n ] T = vec ( F ) = [ f 11 , f 21 , , f m 1 , n , f m n ] T is the vectorization [25] of F where the superscript T denotes the matrix transpose [26], ( G u ) κ denotes the κ th component of G u R r with r = 2 m n m n , where R denotes the set of real numbers, and G is a forward difference operator given by
G : = I n D m D n I m R r , m n ,
where ⊗ denotes the Kronecker product, I n is the n × n identity matrix, D n denotes the forward difference matrix defined by
D n : = 1 1 1 1 1 1 R n 1 , n ,
and the function θ is defined by
θ ( t ) : = | t | α log 1 + | t | α
with a constant α > 0 , which is a smooth approximation of l 1 norm, and has the derivative z = θ ( t ) = t α + | t | . The inverse function of θ is defined by ξ ( z ) : = ( θ ) 1 ( z ) = α z 1 | z | , whose derivative is given by ξ ( z ) = α ( 1 | z | ) 2 . These functions are illustrated in Figure 3, where blue lines denote the functions for l 1 norm, and orange lines denote their smooth approximations.
From J u ι = θ ( u ι f ι ) + β κ = 1 r θ ( ( G u ) κ ) G κ , ι = 0 where G κ , ι means the ( κ , ι ) th element of G, we have u ι = f ι ξ ( β κ = 1 r θ ( ( G u ) κ ) G κ , ι ) for ι = 1 , 2 , , m n , which are combined into a vector equation as u = f ξ ( β G T θ ( G u ) ) , where the functions θ and ξ are applied to each element of their arguments. This is a fixed point equation for u which gives rise to a fixed point algorithm for minimizing J ( u , f ) as described in Algorithm 1.
Algorithm 1 Fully smoothed l 1 -TV minimization algorithm [13]
Require: 
a vectorized image f = [ f 1 , f 2 , , f m n ] T , parameters β > 0 and α > 0 used in functions ξ and θ , the number of iterations T > 0
Ensure: 
the minimizer u ( T ) of a fully smoothed l 1 -TV functional J ( u , f ) in (6)
  1:
Initialize the variable u as u ( 0 ) f
  2:
for   t 1 , 2 , , T do
  3:
     u ( t ) f ξ ( β G T θ ( G u ( t 1 ) ) )
  4:
end for
In this algorithm, we set α = 0.05 , β = 0.1 and T = 5 according to Nikolova and Steidl [13]. The obtained image from u ( T ) with the input image f in Figure 1a is shown in Figure 4a. This procedure for computing u ( T ) from f can be viewed as a nonlinear filter which reduces the quantization noise in f slightly. Therefore, the image in Figure 4a is very close to that in Figure 1a. The pixel values in u ( T ) can be ordered in a strict way with a high probability [8].
Assume that the pixel values in u ( T ) = [ u 1 ( T ) , u 2 ( T ) , , u m n ( T ) ] T are ordered in ascending order: u λ 1 ( T ) < u λ 2 ( T ) < < u λ m n ( T ) where λ ι for ι = 1 , 2 , , m n denote the ordered indices, and the cumulative histogram H ^ = [ H ^ 0 , H ^ 1 , , H ^ L ] is computed from a given target histogram h ^ . Then, if H ^ l 1 < ι H ^ l with H ^ 1 = 0 for an index ι and a pixel value l, then the corresponding output pixel value is given by f i ι , j ι N S = l , where ( i ι , j ι ) denotes the pixel position corresponding to the ordered index λ ι , i.e., ( λ ι 1 ) = ( j ι 1 ) m + ( i ι 1 ) with 0 ( i ι 1 ) < m is satisfied. This procedure is repeated for ι = 1 , 2 , , m n to obtain Nikolova and Steidl’s output image F N S = [ f i j N S ] . Figure 4b shows the output image with the same Gaussian target histogram as Figure 2, and Figure 4c shows the target and obtained histograms, where we can see that they have the same Gaussian shape, which demonstrates the exactness of Nikolova and Steidl’s method.

5. Proposed Method

In this section, we propose a local contrast-based pixel ordering method for exact histogram specification. We first describe the method for grayscale images, and then it is extended to that for color images. We also give a complexity analysis of the proposed method. The main idea of our approach is that the problem of pixel ordering can be divided into 256 subproblems for an 8-bit grayscale image. We solve the downsized subproblems separately to have 256 groups of ordered pixels, and then concatenate them to have a sequence of all ordered pixels.

5.1. Local Contrast-Based Exact Histogram Specification for Grayscale Images

As demonstrated above, we can transform the histogram of a digital image into the specified one, when all pixels in the image are ordered in a strict and faithful way [13]. In most cases, pixels in a digital image take a limited number of discrete values, e.g., 256 values are available for 8-bit grayscale images, which is smaller than the number of pixels in the image, e.g., m × n = 256 × 256 = 65 , 536 256 for the above image in Figure 1a. Therefore, many pixels share the same pixel value with each other in the image, and the ordering of the pixels with the same values becomes an ill-posed problem [8]. However, it is fortunate for us that we have a rough ordering of 256 groups of pixels in the image, which means that the entire pixel ordering problem can be divided into 256 subproblems that can be solved separately. In this subsection, we propose a method for ordering pixels in each group on the basis of the local contrast of each pixel, and then the separately ordered subgroups are finally merged into an entire pixel ordering.
The first step of the proposed method is Gaussian filtering without approximation, which means that the weighted mean of all pixels is outputted at each pixel, where the weights are given by a Gaussian function as follows:
f i j G F = k = 1 m l = 1 n exp ( i k ) 2 + ( j l ) 2 2 σ 2 f k l k = 1 m l = 1 n exp ( i k ) 2 + ( j l ) 2 2 σ 2 = k = 1 m exp ( i k ) 2 2 σ 2 l = 1 n exp ( j l ) 2 2 σ 2 f k l k = 1 m exp ( i k ) 2 2 σ 2 l = 1 n exp ( j l ) 2 2 σ 2
for i = 1 , 2 , , m and j = 1 , 2 , , n , where σ denotes the standard deviation positive constant. Let F G F = [ f i j G F ] be an m × n matrix which expresses the Gaussian-filtered image of F. Then, we can compute F G F by the following matrix operations. The numerator of (10) is computed by
N u = G L F G R ,
where the left matrix G L is given by G L = exp ( D L D L / 2 σ 2 ) with
D L = 1 m 1 2 m + 1 2 m T 1 m T 2 1 2 m T 1 2 m ,
where ⊙ denotes the Hadamard product or elementwise product of matrices, and 1 m denotes the m-dimensional column vector of ones. Similarly, the right matrix G R in (11) is given by G R = exp ( D R D R / 2 σ 2 ) with
D R = 1 n 1 2 n + 1 2 n T 1 n T 2 1 2 n T 1 2 n .
On the other hand, the denominator of (10) is computed by
D e = G L E G R ,
where E denotes the m × n matrix of ones. Then, we have the Gaussian-filtered image by F G F = N u D e , where ⊘ denotes the Hadamard division or elementwise division of matrices.
Next, we define the local contrast (LC) of each pixel by d i j : = f i j f i j G F which is added to the corresponding pixel as an attribute, and divide the m n pixels in F into ( L + 1 ) groups as S k : = { ( f i j , d i j ) | f i j = k } , where we have that h k = | S k | for k = 0 , 1 , , L , i.e., h k is the cardinality of S k . Then, we sort the elements of S k in the ascending order of d i j for k = 0 , 1 , , L , and concatenate them to have a sequence. As a result, we expect to have the entire pixel ordering μ ι { 1 , 2 , , m n } for ι = 1 , 2 , , m n , from which the corresponding pixel position ( i ι , j ι ) is given as the integer part ( j ι 1 ) and remainder ( i ι 1 ) of the division ( μ ι 1 ) / m , i.e., ( μ ι 1 ) = ( j ι 1 ) m + ( i ι 1 ) , and { d i j } is ordered as follows:
d i 1 , j 1 < < d i ι , j ι < < d i m n , j m n .
For exact histogram specification, we would like to have a strict ordering as described in (15). That is, for different pixels with the same pixel value as f i j = f i j with i i or j j , it is expected that d i j d i j or f i j G F f i j G F . For conventional Gaussian filters with finite kernel sizes such as 3 × 3 , 5 × 5 and 7 × 7 pixels, the lower bounds of the probability of f i j G F = f i j G F are ( 1 256 ) 7 × 7 < ( 1 256 ) 5 × 5 < ( 1 256 ) 3 × 3 0 . However, some symmetric patterns may result in the case of f i j G F = f i j G F accidentally. To reduce the probability of such cases, we adopt the Gaussian filter with sufficiently large kernel size as described in (10).
For an input image F with a target histogram h ^ and its cumulative version H ^ = [ H ^ 0 , H ^ 1 , , H ^ L ] , the proposed method outputs a histogram-specified image F L C = [ f i j L C ] , where each pixel value is given by f i ι , j ι L C = l for the index μ ι satisfying H ^ l 1 < ι H ^ l with H ^ 1 = 0 as well as Nikolova and Steidl’s method summarized in Section 4.2. The proposed method is summarized in Algorithm 2.
Algorithm 2 Local contrast-based exact histogram specification
Require: 
a grayscale image F = [ f i j ] , a positive constant σ and a target histogram h ^
Ensure: 
a histogram-specified image F L C = [ f i j L C ]
  1:
Compute the Gaussian-filtered image F G F of F with a positive constant σ
  2:
Compute the local contrast D = [ d i j ] by D = F F G F
  3:
Make ( L + 1 ) groups S k = { ( f i j , d i j ) | f i j = k } for k = 0 , 1 , , L
  4:
ι 1
  5:
for   k 0 , 1 , , L   do
  6:
      Sort the elements of S k in the ascending order of d i j as d i 1 , j 1 < < d i u , j u < < d i | S k | , j | S k |
  7:
      for  u 1 , 2 , , | S k |  do
  8:
             μ ι m ( j u 1 ) + i u
  9:
             ι ι + 1
10:
       end for
11:
end for
12:
Compute the target cumulative histogram H ^ = [ H ^ 0 , H ^ 1 , , H ^ L ] from h ^
13:
for   ι 1 , 2 , , m n   do
14:
      Search for l satisfying H ^ l 1 < ι H ^ l with H ^ 1 = 0
15:
       f i ι , j ι L C l , where ( j ι 1 ) and ( i ι 1 ) are the integer part and remainder of ( μ ι 1 ) / m
16:
end for
Additionally, we can make an image whose pixel values indicate ordered numbers as F I = [ f i j I ] , where each pixel value is given by f i ι , j ι I = ι for ι = 1 , 2 , , m n . For histogram equalization, the number of pixels to which the same pixel value is assigned is given by h ¯ = m n / ( L + 1 ) , where x denotes the floor function that gives the largest integer less than or equal to x [27]. That is, we make a target histogram h ^ = [ h ^ k ] as h ^ k = h ¯ for k = 0 , 1 , , L . However, the truncation by the floor function may cause the shortage of total amount in the histogram: k = 0 L h ^ k < m n . To cover the shortage, if Q = m n k = 0 L h ^ k > 0 , then we add 1 to h ^ 0 , h ^ 1 , , h ^ Q 1 to have k = 0 L h ^ k = m n . This modified histogram can be inputted to Algorithm 2 as a target histogram for exact histogram equalization.
Figure 5 shows the results of the proposed method, where Figure 5a,b show the results of the histogram equalization and specification with σ = 50 for the original image in Figure 1a, respectively, and Figure 5c shows their histograms, where we can see that both exact histogram equalization and specification are achieved.

5.2. Extension to Color Images

In this subsection, we extend the above proposed method for grayscale images to color images. Let C = [ c i j ] be an RGB color image, where c i j = [ c i j 1 , c i j 2 , c i j 3 ] denotes the RGB color vector of the ( i , j ) th pixel in C, and c i j k { 0 , 1 , , L } for k = 1 , 2 and 3. Then, we make a histogram into which all RGB values in C are united as follows:
h C = [ h 0 C , , h l C , , h L C ] , h l C = i = 1 m j = 1 n k = 1 3 δ l , c i j k for l = 0 , 1 , , L .
For example, Figure 6 shows an RGB color image and its histogram defined in (16).
The first step of our exact histogram specification is Gaussian filtering applied to each color channel in C. Let C G F = [ c i j G F ] be the resultant image, where c i j G F = [ c i j 1 G F , c i j 2 G F , c i j 3 G F ] denotes the RGB color vector of each pixel in C G F . Then, we compute the LC as D C = [ d i j C ] = C C G F where d i j C = [ d i j 1 C , d i j 2 C , d i j 3 C ] = c i j c i j G F , each element of which is added to the corresponding element of the corresponding pixel as an attribute: ( c i j k , d i j k C ) for i = 1 , 2 , , m ; j = 1 , 2 , , n and k = 1 , 2 , 3 , and divide them into ( L + 1 ) groups as S l : = { ( c i j k , d i j k C ) | c i j k = l } , where we have that h l C = | S l | for l = 0 , 1 , , L . Then, we sort the elements of S l in the ascending order of d i j k C for l = 0 , 1 , , L , and concatenate them to have a sequence. As a result, we expect to have the entire element ordering η ι { 1 , 2 , , 3 m n } for ι = 1 , 2 , , 3 m n , each of which is connected with the corresponding pixel position ( i ι , j ι ) and channel number k ι by satisfying
d i 1 , j 1 , k 1 C < < d i ι , j ι , k ι C < < d i 3 m n , j 3 m n , k 3 m n C .
Let h ^ C be a target histogram with the cumulative one H ^ C = [ H ^ 0 C , H ^ 1 C , , H ^ L C ] . Then, the histogram-specified image C L C = [ c i j L C ] is given by c i j L C = [ c i j 1 L C , c i j 2 L C , c i j 3 L C ] with c i ι , j ι , k ι L C = l for the index η ι satisfying H ^ l 1 C < ι H ^ l C with H ^ 1 C = 0 . This procedure for color images is summarized in Algorithm 3.
Algorithm 3 Local contrast-based exact histogram specification for color images
Require: 
a color image C = [ c i j ] , a positive constant σ and a target histogram h ^ C
Ensure: 
a histogram-specified image C L C = [ c i j L C ]
  1:
Compute the Gaussian-filtered image C G F of C with a positive constant σ
  2:
Compute the local contrast D C = [ d i j C ] by D C = C C G F where d i j C = [ d i j 1 C , d i j 2 C , d i j 3 C ]
  3:
Make ( L + 1 ) groups S l = { ( c i j k , d i j k C ) | c i j k = l } for l = 0 , 1 , , L
  4:
ι 1
  5:
for   l 0 , 1 , , L   do
  6:
      Sort the elements of S l in the ascending order of d i j k C as d i 1 , j 1 , k 1 C < < d i u , j u , k u C < < d i | S l | , j | S l | , k | S l | C
  7:
       for  u 1 , 2 , , | S l |  do
  8:
              η ι m n ( k u 1 ) + m ( j u 1 ) + i u
  9:
              ι ι + 1
10:
        end for
11:
end for
12:
Compute the target cumulative histogram H ^ = [ H ^ 0 , H ^ 1 , , H ^ L ] from h ^
13:
for   ι 1 , 2 , , 3 m n   do
14:
      Search for l satisfying H ^ l 1 < ι H ^ l with H ^ 1 = 0
15:
       c i ι , j ι , k ι L C l , where i ι , j ι and k ι are related to η ι by η ι = m n ( k ι 1 ) + m ( j ι 1 ) + i ι
16:
end for
Figure 7 shows the results of the proposed method for color images, where Figure 7a,b show the results of the histogram equalization and specification with σ = 50 for the original color image in Figure 6a, respectively, and Figure 7c shows their histograms, where we can also see that both exact histogram equalization and specification are achieved.

5.3. Complexity Analysis

In this subsection, we analyze the complexity of the proposed method in Algorithm 2. Let N = m n be the input size. The computation of Gaussian filtering in line 1 is described as matrix calculations. The time complexity of the numerator (11) is estimated as m n 2 + m 2 n = m n ( m + n ) = N ( m + n ) N 3 / 2 , which is the same as that of the denominator (14). The Hadamard division requires N elementwise divisions. Then, the order of time complexity of Gaussian filtering is O ( N 3 / 2 ) . The next main procedure is sort in line 6, which is repeated L + 1 times. Assume that the cardinality | S l | is N L + 1 on average. Then, the time complexity of the sorting procedure is estimated as ( L + 1 ) × N L + 1 log N L + 1 = N [ log N log ( L + 1 ) ] from which we have O ( N log N ) . The time complexity of the remaining procedures is bounded by O ( N ) . Consequently, the time complexity of the proposed method is given by O ( N 3 / 2 ) .
The space complexities of images F , F G F , D , and F L C are O ( N ) , and that of ( L + 1 ) groups S k for k = 0 , 1 , , L in line 3 is also O ( N ) . Histogram arrays h ^ and H ^ require O ( L + 1 ) . Selecting the largest one, we can see that the space complexity of the proposed method is O ( N ) .

6. Experimental Results

In this section, we show experimental results in comparison with Nikolova and Steidl’s method [13]. First, we show the results with a synthetic input image shown in Figure 8a. Nikolova and Steidl’s method summarized in Section 4.2 outputs the image in Figure 8b, where we can see that vertical stripes appear in the flat areas in the original image. As a result, Nikolova and Steidl’s method achieves the equalized histogram shown in Figure 8c. Figure 8d shows the horizontal profile of the output image in Figure 8b, where the vertical and horizontal axes denote the pixel value and the column index j, respectively. Although the pixel values fluctuate with small steps, the pixel values on the left side are larger than that on the right side as well as the original image.
Figure 9 shows the results of the proposed method described in Section 5, where Figure 9a,b show the output images of exact histogram equalization and specification with the Gaussian target histogram used in the previous section. Their histograms are shown in Figure 9c. The proposed method enhances the edge in the center of the input image in Figure 8a, and does not produce the pseudo-stripes observed in Figure 8b that are graphically confirmed by the horizontal profiles in Figure 9d.
Next, we compare the ability in strict ordering by Nikolova and Steidl’s and the proposed methods. Figure 10 compares the filter outputs used in the two methods with the input image in Figure 1a. Nikolova and Steidl’s filter in Algorithm 1 outputs u ( T ) , the values in which are sorted in ascending order in Figure 10a where the vertical and horizontal axes denote the pixel value and index, respectively. The differences between the neighboring pixel values in Figure 10a are very small, and therefore, we take the logarithm of them as shown in Figure 10b. Similarly, we sort the values of the output of the Gaussian filter in (10) as shown in Figure 10c, and take the logarithm of the difference values in Figure 10c as shown in Figure 10d, where we can see that the minimum value is greater than that in Figure 10c, which is preferable for strict ordering because the larger the difference is, the clearer the ordering is. The minimum values of the differences without taking logarithm are 4.23 × 10 12 and 1.66 × 10 8 for Figure 10b,d, respectively.
The proposed method has a parameter σ in (10), the effect of which is investigated in Figure 11a, where the vertical and horizontal axes denote the minimum difference in the sorted output values of the Gaussian filter and the parameter σ , respectively, for the input image in Figure 1a. In this figure, although we cannot find clear tendency of the minimum difference as a function of σ , the obtained difference values are larger than that of u ( T ) given by Algorithm 1 that exemplifies the insensitivity of the proposed method to σ . Figure 11b,c show the results of histogram equalization with σ = 1 and 70, respectively. These images demonstrate that the proposed method is insensitive to the values of parameter σ .
We investigate the limitation of the proposed method on the value of σ . Figure 12 shows the results of histogram equalization for the input image in Figure 8a, where Figure 12a,b correspond to σ = 10 8 and 5 × 10 8 , respectively. Figure 12a is similar to Figure 9a. However, in Figure 12b, we observe an artifact. As a result, we estimate that the limitation of the value of σ exists between 10 8 and 5 × 10 8 , and recommend using the value of σ smaller than 10 8 .
Figure 13 shows twelve grayscale images in the Standard Image Data-BAse (SIDBA) [28], which are enhanced by Nikolova and Steidl’s exact histogram equalization as shown in Figure 14, where the contrast of all images is enhanced well because the histogram of each image is exactly equalized.
Similarly, Figure 15 shows the results by the proposed method, which also equalizes the histogram of each image exactly. Therefore, the output images of both methods are similar to each other.
Figure 16a shows the root mean squared error (RMSE) between Nikolova and Steidl’s output image and the corresponding output image by the proposed method, where “Text” image shown in (b) get the largest RMSE value, but the difference is small as visualized in (c), where error-free pixels have the neutral gray value 127.
We also compare the results of exact histogram specification with the Gaussian target histogram, which are shown in Figure 17 and Figure 18 for Nikolova and Steidl’s and the proposed methods, respectively. In Figure 17, we observe that the obtained contrast is not so high as that of Figure 14 because the Gaussian target histogram suppresses the numbers of extremely dark and bright pixels, and assigns many pixel values to middle-range gray pixels. As a result, the dynamic range of gray pixels is boosted relatively. The output images in Figure 18 have a similar tendency to that in Figure 17 because the proposed method also obtains an exact Gaussian target histogram as well as Nikolova and Steidl’s method.
Figure 19a shows the RMSE between the corresponding output images in Figure 17 and Figure 18, where three images “Bui.”, “Lig.” and “Tex.” have relatively large RMSE values. We can find the differences at the bottom of those images as shown in Figure 19b, where the bottom areas of “Bui.”, “Lig.” and “Tex.” are arranged from top to bottom. The corresponding results by Nikolova and Steidl’s and the proposed methods are shown in Figure 19c and Figure 19d, respectively, where we can see artifacts in (c) similar to that in Figure 8b. On the other hand, Figure 19d has no such artifacts.
Figure 20 shows twelve color images in the SIDBA image dataset [28], which are enhanced by a separable histogram equalization that applies Nikolova and Steidl’s exact histogram equalization algorithm to each color channel separately as shown in Figure 21, where we can see that the contrast of every image is enhanced, but the hue has changed from the original images in Figure 20.
Figure 22 shows the results from the proposed histogram equalization method described in Section 5.2, where we can see that the hue of each image is closer to the original one than that in Figure 21.
Figure 23 shows the RMSE of hue of each output image from the corresponding original image, where the vertical and horizontal axes denote the RMSE value and the images, respectively, and the blue and orange bars denote the separable and proposed methods, from which we observe that the proposed method preserves the original hue better than the separable method.
Figure 24 shows the results of a separable histogram specification that applies Nikolova and Steidl’s exact histogram specification algorithm to each color channel separately. Similarly to the above results of histogram equalization in Figure 21, here we can see the hue change from the original images.
On the other hand, Figure 25 shows the results by the proposed histogram specification method, where we can also see that the hue of each image is closer to the original one than that in Figure 24.
Figure 26 shows the RMSE of hue of each output image from the corresponding original image, from which we also observe that the proposed method preserves the original hue better than the separable method.
The above experimental results demonstrate the effectiveness of the proposed local contrast-based pixel ordering method for exact histogram equalization and specification compared with the state-of-the-art method by Nikolova and Steidl [13]. A drawback of Nikolova and Steidl’s algorithm observed in Figure 8b, where a stripe pattern occurred on flat areas, may be a newfound phenomenon. The proposed method can avoid the occurrence of such false patterns.
In the above experiments, although we used a Gaussian target histogram for histogram specification constantly, we can choose other candidates such as multimodal distributions without any problems.
For the implementation of Nikolova and Steidl’s algorithm described in Algorithm 1, we need to use sparse matrices even if the input image is not so large, e.g., the original image in Figure 1a with 256 × 256 pixels because the difference operator G in (7) becomes a very large matrix with r × m n 8.56 × 10 9 elements. On the other hand, the proposed method can be implemented without sparse matrices.
Additionally, we implemented Ramos’s recent algorithm for histogram specification [16]. Figure 27 shows the result of Ramos’s histogram specification, where Figure 27a shows the output image computed from the input image in Figure 1a with the Gaussian target histogram with mean 127.5 and standard deviation 50. Figure 27b shows the obtained histogram of the output image in Figure 27a in a blue line with the target histogram in the orange line. This figure shows that Ramos’s algorithm is not an exact histogram specification method, and the obtained histogram is similar to that of the conventional histogram specification shown in Figure 2b. On the other hand, the proposed method gives exactly the same histogram as a prescribed target histogram as shown in Figure 2c. In Ramos’s formulation of l p norm minimization, we set p = . For details, please refer to Ramos’s original paper [16]. For the implementation of Ramos’s algorithm, we need to use sparse matrices with about m n × L elements as well as Nikolova and Steidl’s one.
A limitation of the proposed method is that users need to prepare a target histogram for histogram specification. However, it may be difficult to know the optimal shape of the histogram for a given image in advance. The estimation of suitable target histograms for given images will be a subject to be considered in the future.

7. Conclusions

In this paper, we proposed a method for ordering pixels in an image for exact histogram specification, and compared it with the state-of-the-art algorithm by Nikolova and Steidl [13]. We divided the problem of pixel ordering into small subproblems which can be solved memory-efficiently. This idea makes the problem of exact histogram specification more tractable than ever. The proposed method uses the Gaussian filter without approximation instead of the nonlinear filter used in Nikolova and Steidl’s algorithm. We use the local contrast defined with the Gaussian-filtered image as a key to ordering pixels. As a result, it was experimentally demonstrated that we could avoid the occurrence of false patterns that were observed in the results obtained by Nikolova and Steidl’s algorithm.
We also extended the proposed method for grayscale images to that for color images. Experimental results showed that the proposed method keeps the hue of the original images better than conventional separable methods of histogram equalization and specification for color images.
Our future work will include the development of a method for making a preferable target histogram for histogram specification depending on a given input image.

Author Contributions

Conceptualization, K.I.; methodology, K.I.; software, K.I.; validation, N.O. and K.H.; formal analysis, K.I.; investigation, K.I.; resources, K.I.; data curation, K.I.; writing—original draft preparation, K.I.; writing—review and editing, N.O. and K.H.; visualization, K.I.; supervision, K.H.; project administration, K.I.; funding acquisition, K.I. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by JSPS KAKENHI Grant No. JP21K11964.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

SIDBA, the Standard Image Data-BAse can be downloaded from http://www.ess.ic.kanagawa-it.ac.jp/app_images_j.html (accessed on 21 June 2022).

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
LMLocal mean method
WAWavelet-based exact pixel ordering algorithm
TVTotal variation
SIDBAThe Standard Image Data-BAse
RMSERoot mean squared error

References

  1. Pouli, T.; Reinhard, E.; Cunningham, D.W. Image Statistics in Visual Computing, 1st ed.; A. K. Peters, Ltd.: Natick, MA, USA, 2013. [Google Scholar]
  2. Naik, S.K.; Murthy, C.A. Hue-preserving color image enhancement without gamut problem. IEEE Trans. Image Process. 2003, 12, 1591–1598. [Google Scholar] [CrossRef] [PubMed]
  3. Rahman, M.A.; Fazle Rabbi, M.M.; Rahman, M.M.; Islam, M.M.; Islam, M.R. Histogram modification based lossy image compression scheme using Huffman coding. In Proceedings of the 2018 4th International Conference on Electrical Engineering and Information & Communication Technology (iCEEiCT), Dhaka, Bangladesh, 13–15 September 2018; pp. 279–284. [Google Scholar] [CrossRef]
  4. Qin, K.; Xu, K.; Liu, F.; Li, D. Image segmentation based on histogram analysis utilizing the cloud model. Comput. Math. Appl. 2011, 62, 2824–2833. [Google Scholar] [CrossRef]
  5. Gonzalez, R.C.; Woods, R.E. Digital Image Processing; Prentice Hall: Upper Saddle River, NJ, USA, 2008; pp. 150–161. [Google Scholar]
  6. Gonzalez, R.C.; Fittes, B.A. Gray-level transformations for interactive image enhancement. Mech. Mach. Theory 1977, 12, 111–122. [Google Scholar] [CrossRef]
  7. Raheja, A.; Chawla, R.; Gupta, S.; Vashist, A. Controlling Over Enhancement of Images Using Histogram Equalization Technique. IOP Conf. Ser. Mater. Sci. Eng. 2020, 804, 012055. Available online: https://iopscience.iop.org/article/10.1088/1757-899X/804/1/012055 (accessed on 28 June 2022). [CrossRef]
  8. Nikolova, M.; Wen, Y.W.; Chan, R. Exact Histogram Specification for Digital Images Using a Variational Approach. J. Math. Imaging Vis. 2013, 46, 309–325. [Google Scholar] [CrossRef]
  9. Hall, E.L. Almost Uniform Distributions for Computer Image Enhancement. IEEE Trans. Comput. 1974, C-23, 207–208. [Google Scholar] [CrossRef]
  10. Rosenfeld, A.; Kak, A.C. Digital Picture Processing: Volume 1 and 2; Academic Press: Orlando, FL, USA, 1982; ISBN 0-12-597301-2/0-12-597302-0. [Google Scholar]
  11. Coltuc, D.; Bolon, P.; Chassery, J.-M. Exact histogram specification. IEEE Trans. Image Process. 2006, 15, 1143–1152. [Google Scholar] [CrossRef] [PubMed]
  12. Wan, Y.; Shi, D. Joint Exact Histogram Specification and Image Enhancement Through the Wavelet Transform. IEEE Trans. Image Process. 2007, 16, 2245–2250. [Google Scholar] [CrossRef] [PubMed]
  13. Nikolova, M.; Steidl, G. Fast Ordering Algorithm for Exact Histogram Specification. IEEE Trans. Image Process. 2014, 23, 5274–5283. [Google Scholar] [CrossRef] [Green Version]
  14. Nikolova, M.; Steidl, G. Fast Hue and Range Preserving Histogram Specification: Theory and New Algorithms for Color Image Enhancement. IEEE Trans. Image Process. 2014, 23, 4087–4100. [Google Scholar] [CrossRef]
  15. Lindeberg, T. Scale-space for discrete signals. IEEE Trans. Pattern Anal. Mach. Intell. 1990, 12, 234–254. [Google Scholar] [CrossRef]
  16. Ramos, V.S.; Silveira, L.F.d.Q.; Silveira Júnior, L.G.d.Q. Histogram Specification by Assignment of Optimal Unique Values. arXiv 2021, arXiv:2102.02378. [Google Scholar]
  17. Pallavi, S.; Sannidhan, M.S.; Abhir Bhandary. A Comprehensive Review on Various State-of-the-Art Techniques for Image Enhancement. Int. J. Eng. Technol. 2018, 7, 86–864. Available online: https://www.sciencepubco.com/index.php/ijet/article/view/19576 (accessed on 28 June 2022).
  18. Yadav, G.; Maheshwari, S.; Agarwal, A. Contrast limited adaptive histogram equalization based enhancement for real time video system. In Proceedings of the 2014 International Conference on Advances in Computing, Communications and Informatics (ICACCI), Delhi, India, 24–27 September 2014; pp. 2392–2397. [Google Scholar] [CrossRef]
  19. Kim, Y.-T. Contrast enhancement using brightness preserving bi-histogram equalization. IEEE Trans. Consum. Electron. 1997, 43, 1–8. [Google Scholar] [CrossRef]
  20. Trongtirakul, T.; Agaian, S. Weighted Histogram Equalization Using Entropy of Probability Density Function. In Proceedings of the 44th Electrical Engineering Conference (EECON 44), Nan, Thailand, 17–19 November 2021; Volume 1, pp. 461–464. Available online: https://arxiv.org/ftp/arxiv/papers/2111/2111.08578.pdf (accessed on 28 June 2022).
  21. Ren, X.; Yang, W.; Cheng, W.-H.; Liu, J. LR3M: Robust Low-Light Enhancement via Low-Rank Regularized Retinex Model. IEEE Trans. Image Process. 2020, 29, 5862–5876. [Google Scholar] [CrossRef] [PubMed]
  22. Zhang, F.; Shao, Y.; Sun, Y.; Zhu, K.; Gao, C.; Sang, N. Unsupervised Low-Light Image Enhancement via Histogram Equalization Prior. arXiv 2021, arXiv:2112.01766. [Google Scholar]
  23. Hussain, K.; Rahman, S.; Rahman, M.; Khaled, S.M.; Wadud, A.A.; Hossain Khan, M.A.; Shoyaib, M. A histogram specification technique for dark image enhancement using a local transformation method. IPSJ Trans. Comput. Vis. Appl. 2018, 10, 3. [Google Scholar] [CrossRef]
  24. Balado, F. Optimum Exact Histogram Specification. In Proceedings of the 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Calgary, AB, Canada, 15–20 April 2018; pp. 1413–1417. [Google Scholar] [CrossRef] [Green Version]
  25. Vectorization (Mathematics) From Wikipedia, the Free Encyclopedia. Available online: https://en.wikipedia.org/wiki/Vectorization_(mathematics) (accessed on 28 June 2022).
  26. Weisstein, E.W. “Transpose.” From MathWorld—A Wolfram Web Resource. Available online: https://mathworld.wolfram.com/Transpose.html (accessed on 29 May 2022).
  27. Weisstein, E.W. “Floor Function.” From MathWorld—A Wolfram Web Resource. Available online: https://mathworld.wolfram.com/FloorFunction.html (accessed on 13 June 2022).
  28. The Standard Image Data-BAse (SIDBA). Available online: http://www.ess.ic.kanagawa-it.ac.jp/app_images_j.html (accessed on 21 June 2022).
Figure 1. Histogram equalization: (a) an original image with 256 × 256 pixels; (b) the histogram of the original image; (c) the cumulative histogram of the original image; (d) the histogram-equalized image; (e) the histogram of the image in (d); (f) the cumulative histogram of the image in (d).
Figure 1. Histogram equalization: (a) an original image with 256 × 256 pixels; (b) the histogram of the original image; (c) the cumulative histogram of the original image; (d) the histogram-equalized image; (e) the histogram of the image in (d); (f) the cumulative histogram of the image in (d).
Jimaging 08 00247 g001
Figure 2. Histogram specification: (a) histogram-specified image computed from the original image in Figure 1a with a Gaussian target histogram; (b) the histogram of the image (a); (c) the target (blue solid line) and obtained (yellow dashed line) cumulative histograms.
Figure 2. Histogram specification: (a) histogram-specified image computed from the original image in Figure 1a with a Gaussian target histogram; (b) the histogram of the image (a); (c) the target (blue solid line) and obtained (yellow dashed line) cumulative histograms.
Jimaging 08 00247 g002
Figure 3. Nikolova and Steidl’s smooth approximation of l 1 norm: (a) l 1 norm denoted by a blue line is smoothly approximated by θ ( t ) denoted by an orange line; (b) the derivatives of l 1 norm and θ ( t ) ; (c) the inverse functions of l 1 norm and θ ( t ) , which is denoted by ξ ( z ) ; (d) the derivatives of the inverse functions.
Figure 3. Nikolova and Steidl’s smooth approximation of l 1 norm: (a) l 1 norm denoted by a blue line is smoothly approximated by θ ( t ) denoted by an orange line; (b) the derivatives of l 1 norm and θ ( t ) ; (c) the inverse functions of l 1 norm and θ ( t ) , which is denoted by ξ ( z ) ; (d) the derivatives of the inverse functions.
Jimaging 08 00247 g003
Figure 4. Nikolova and Steidl’s exact histogram specification: (a) the output u ( T ) of Algorithm 1 is visualized as an 8-bit grayscale image; (b) the output image; (c) Gaussian target (blue solid line) and obtained (yellow dashed line) histograms.
Figure 4. Nikolova and Steidl’s exact histogram specification: (a) the output u ( T ) of Algorithm 1 is visualized as an 8-bit grayscale image; (b) the output image; (c) Gaussian target (blue solid line) and obtained (yellow dashed line) histograms.
Jimaging 08 00247 g004
Figure 5. Exact histogram equalization and specification: (a) histogram-equalized image of the original image in Figure 1a; (b) the histogram-specified image with a Gaussian target histogram; (c) equalized (blue line) and specified (orange line) histograms.
Figure 5. Exact histogram equalization and specification: (a) histogram-equalized image of the original image in Figure 1a; (b) the histogram-specified image with a Gaussian target histogram; (c) equalized (blue line) and specified (orange line) histograms.
Jimaging 08 00247 g005
Figure 6. Color image and its histogram: (a) an RGB color image with 256 × 256 pixels; (b) the histogram of the color image (a).
Figure 6. Color image and its histogram: (a) an RGB color image with 256 × 256 pixels; (b) the histogram of the color image (a).
Jimaging 08 00247 g006
Figure 7. Exact histogram equalization and specification for a color image: (a) histogram-equalized image of the original color image in Figure 6a; (b) the histogram-specified image with a Gaussian target histogram; (c) equalized (blue line) and specified (orange line) histograms.
Figure 7. Exact histogram equalization and specification for a color image: (a) histogram-equalized image of the original color image in Figure 6a; (b) the histogram-specified image with a Gaussian target histogram; (c) equalized (blue line) and specified (orange line) histograms.
Jimaging 08 00247 g007
Figure 8. Nikolova and Steidl’s exact histogram equalization: (a) input image with 200 × 282 pixels, where the dark and bright areas have pixel values 100 and 200, respectively. (b) vertical stripes are generated in the output image; (c) the obtained histogram confirms that Nikolova and Steidl’s method exactly equalizes the histogram; (d) horizontal profile in (b) shows the fluctuation of pixel values, but it preserves the original ordering in (a).
Figure 8. Nikolova and Steidl’s exact histogram equalization: (a) input image with 200 × 282 pixels, where the dark and bright areas have pixel values 100 and 200, respectively. (b) vertical stripes are generated in the output image; (c) the obtained histogram confirms that Nikolova and Steidl’s method exactly equalizes the histogram; (d) horizontal profile in (b) shows the fluctuation of pixel values, but it preserves the original ordering in (a).
Jimaging 08 00247 g008
Figure 9. Exact histogram equalization and specification by the proposed method: (a) histogram-equalized image has the enhanced central edge; (b) histogram-specified image also has the enhanced edge; (c) histograms of the output images in (a,b) are equalized and specified to be Gaussian, respectively; (d) horizontal profiles in (a,b) have no fluctuation observed in Figure 8d.
Figure 9. Exact histogram equalization and specification by the proposed method: (a) histogram-equalized image has the enhanced central edge; (b) histogram-specified image also has the enhanced edge; (c) histograms of the output images in (a,b) are equalized and specified to be Gaussian, respectively; (d) horizontal profiles in (a,b) have no fluctuation observed in Figure 8d.
Jimaging 08 00247 g009
Figure 10. Comparison of filter outputs u ( T ) and F G F : (a) The values in the output u ( T ) in Algorithm 1 visualized in Figure 4a are sorted in ascending order. (b) The values of log ( u λ ι + 1 ( T ) u λ ι ( T ) ) for ι = 1 , 2 , , m n 1 are plotted. (c) The values of the output of the Gaussian filter in (10) with σ = 50 are sorted in ascending order. (d) The logarithm of the difference of the sorted values in (c) are plotted.
Figure 10. Comparison of filter outputs u ( T ) and F G F : (a) The values in the output u ( T ) in Algorithm 1 visualized in Figure 4a are sorted in ascending order. (b) The values of log ( u λ ι + 1 ( T ) u λ ι ( T ) ) for ι = 1 , 2 , , m n 1 are plotted. (c) The values of the output of the Gaussian filter in (10) with σ = 50 are sorted in ascending order. (d) The logarithm of the difference of the sorted values in (c) are plotted.
Jimaging 08 00247 g010
Figure 11. Insensitivity to parameter σ : (a) the minimum difference in the sorted values of F G F as a function of σ . The positive values mean that there are no pixels with the same pixel value in Gaussian-filtered image F G F , from which we have a strict ordering; (b) histogram equalization with σ = 1 ; (c) histogram equalization with σ = 70 .
Figure 11. Insensitivity to parameter σ : (a) the minimum difference in the sorted values of F G F as a function of σ . The positive values mean that there are no pixels with the same pixel value in Gaussian-filtered image F G F , from which we have a strict ordering; (b) histogram equalization with σ = 1 ; (c) histogram equalization with σ = 70 .
Jimaging 08 00247 g011
Figure 12. Histogram equalization by the proposed method with relatively large values of σ : (a) No artifact is generated with σ = 10 8 . (b) An artifact is generated with σ = 5 × 10 8 .
Figure 12. Histogram equalization by the proposed method with relatively large values of σ : (a) No artifact is generated with σ = 10 8 . (b) An artifact is generated with σ = 5 × 10 8 .
Jimaging 08 00247 g012
Figure 13. Grayscale images in the SIDBA image dataset [28]: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Figure 13. Grayscale images in the SIDBA image dataset [28]: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Jimaging 08 00247 g013
Figure 14. Nikolova and Steidl’s exact histogram equalization: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Figure 14. Nikolova and Steidl’s exact histogram equalization: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Jimaging 08 00247 g014
Figure 15. The proposed exact histogram equalization: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Figure 15. The proposed exact histogram equalization: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Jimaging 08 00247 g015
Figure 16. Comparison between Figure 14 and Figure 15: (a) RMSEs of twelve grayscale images; (b) The “Text” image obtains the largest RMSE value in (a); (c) Difference from the neutral gray indicates the difference between Nikolova and Steidl’s and the proposed methods. (a) Root mean squared error; (b) Text (identical to Figure 13k); (c) Difference image.
Figure 16. Comparison between Figure 14 and Figure 15: (a) RMSEs of twelve grayscale images; (b) The “Text” image obtains the largest RMSE value in (a); (c) Difference from the neutral gray indicates the difference between Nikolova and Steidl’s and the proposed methods. (a) Root mean squared error; (b) Text (identical to Figure 13k); (c) Difference image.
Jimaging 08 00247 g016
Figure 17. Nikolova and Steidl’s exact histogram specification: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Figure 17. Nikolova and Steidl’s exact histogram specification: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Jimaging 08 00247 g017
Figure 18. The proposed exact histogram specification: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Figure 18. The proposed exact histogram specification: (a) Airplane, (b) Barbara, (c) Boat, (d) Bridge, (e) Building, (f) Cameraman, (g) Girl, (h) Lax, (i) Lenna, (j) Lighthouse, (k) Text, (l) Woman.
Jimaging 08 00247 g018
Figure 19. Comparison between Figure 17 and Figure 18: (a) RMSEs of twelve grayscale images; (b) The bottom areas of the original “Bui.”, “Lig.” and “Tex.” images are arranged from top to bottom; (c) the same parts of the results by Nikolova and Steidl’s method; (d) the same parts of the results by the proposed methods.
Figure 19. Comparison between Figure 17 and Figure 18: (a) RMSEs of twelve grayscale images; (b) The bottom areas of the original “Bui.”, “Lig.” and “Tex.” images are arranged from top to bottom; (c) the same parts of the results by Nikolova and Steidl’s method; (d) the same parts of the results by the proposed methods.
Jimaging 08 00247 g019
Figure 20. Color images in the SIDBA image dataset [28]: (a) Aerial, (b) Airplane, (c) Balloon, (d) Couple, (e) Earth, (f) Girl, (g) Lenna, (h) Mandrill, (i) Milkdrop, (j) Parrots, (k) Peppers, (l) Sailboat.
Figure 20. Color images in the SIDBA image dataset [28]: (a) Aerial, (b) Airplane, (c) Balloon, (d) Couple, (e) Earth, (f) Girl, (g) Lenna, (h) Mandrill, (i) Milkdrop, (j) Parrots, (k) Peppers, (l) Sailboat.
Jimaging 08 00247 g020
Figure 21. Results of separable histogram equalization with Nikolova and Steidl’s exact histogram equalization algorithm.
Figure 21. Results of separable histogram equalization with Nikolova and Steidl’s exact histogram equalization algorithm.
Jimaging 08 00247 g021
Figure 22. Results of the proposed exact histogram equalization.
Figure 22. Results of the proposed exact histogram equalization.
Jimaging 08 00247 g022
Figure 23. Comparison of the RMSE of hue of the images in Figure 21 and Figure 22 from the original images.
Figure 23. Comparison of the RMSE of hue of the images in Figure 21 and Figure 22 from the original images.
Jimaging 08 00247 g023
Figure 24. Results of the separable histogram specification with Nikolova and Steidl’s exact histogram specification algorithm.
Figure 24. Results of the separable histogram specification with Nikolova and Steidl’s exact histogram specification algorithm.
Jimaging 08 00247 g024
Figure 25. Results of the proposed exact histogram specification.
Figure 25. Results of the proposed exact histogram specification.
Jimaging 08 00247 g025
Figure 26. Comparison of the RMSE of hue of the images in Figure 24 and Figure 25 from the original images.
Figure 26. Comparison of the RMSE of hue of the images in Figure 24 and Figure 25 from the original images.
Jimaging 08 00247 g026
Figure 27. Histogram specification by Ramos’s algorithm [16]: (a) histogram specified image; (b) obtained and target histograms.
Figure 27. Histogram specification by Ramos’s algorithm [16]: (a) histogram specified image; (b) obtained and target histograms.
Jimaging 08 00247 g027
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Inoue, K.; Ono, N.; Hara, K. Local Contrast-Based Pixel Ordering for Exact Histogram Specification. J. Imaging 2022, 8, 247. https://doi.org/10.3390/jimaging8090247

AMA Style

Inoue K, Ono N, Hara K. Local Contrast-Based Pixel Ordering for Exact Histogram Specification. Journal of Imaging. 2022; 8(9):247. https://doi.org/10.3390/jimaging8090247

Chicago/Turabian Style

Inoue, Kohei, Naoki Ono, and Kenji Hara. 2022. "Local Contrast-Based Pixel Ordering for Exact Histogram Specification" Journal of Imaging 8, no. 9: 247. https://doi.org/10.3390/jimaging8090247

APA Style

Inoue, K., Ono, N., & Hara, K. (2022). Local Contrast-Based Pixel Ordering for Exact Histogram Specification. Journal of Imaging, 8(9), 247. https://doi.org/10.3390/jimaging8090247

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop