Digital Image Processing Lectures 7 & 8

Digital Image Processing Lectures 7 & 8

Image Quantization Lloyd-Max Quantizer Image Transforms Digital Image Processing Lectures 7 & 8 M.R. Azimi, Professor Department of Electrical and Computer Engineering Colorado State University February 2011 M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Quantization Process A quantizer maps the continuous variable x into a discrete xq which takes values from a finite set fr1; : : : ; rLg of numbers. This mapping is generally a staircase function as shown below. Quantization Rule: Define ftk; k = 1;:::;L + 1g as a set of transition or decision levels with t1 and tL+1 as the Min. and Max. values of x, respectively. If x lies in the interval [tk; tk+1), then xq = rk, where rk is called the kth reconstruction level. M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Properties: Quantization mapping is irreversible, i.e. for a given quantizer output, the input value cannot be determined uniquely. Quantization incurs distortion. The design is a trade-off between simplicity and performance (minimum distortion). Quantization is a "zero-memory" operation, i.e. output depends on only one input. Uniform Quantizer: Simplest and most commonly used (e.g., PCM, differential PCM and transform coding) quantizer. Let the output of an image sensor takes values between 0 to A. If samples are quantized uniformly to L (e.g. L = 256) levels, then transition and reconstruction levels are A(k−1) tk = L k = 1;:::;L + 1 A=2 rk = tk + L k = 1;:::;L ∆ The interval q == tk − tk−1 = rk − rk−1 is constant for different values of k and is called "quantization interval". M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Minimum Mean Squared or Lloyd-Max Quantizer This quantizer minimizes the mean squared error for a given number of quantization levels. Let x, with 0 ≤ x ≤ A be a real scalar random variable with a continuous PDF pX (x). It is desired to find optimum the decision levels tk and the reconstruction levels rk for an L-level quantizer such that the mean square error (MSE) (or quantization distortion) Z tL+1 2 2 = E[(x − xq) ] = (x − xq) pX (x)dx t1 is minimized. Note that pX (x) is the PDF of the amplitude of x i.e. R A 0 pX (x)dx = 1. The MSE can be rewritten as L Z ti+1 X 2 = (x − ri) pX (x)dx i=1 ti M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms To minimize w.r.t. tk and rk @ 2 2 = 0 ) (tk − rk−1) pX (tk) − (tk − rk) pX (tk) = 0 @tk @ Z tk+1 = 0 ) 2 (x − rk)pX (x)dx = 0; k 2 [1;L] @rk tk where the first derivative is obtained using the fact that tk ≤ x < tk+1 ) xq = rk, simplification of the above equations gives r + r t = k k−1 (1) k 2 R tk+1 xpX (x)dx tk rk = (2) R tk+1 pX (x)dx tk i.e. the optimum transition levels lie halfway between the optimum reconstruction levels, which in turn lie at the center of mass of the PDF in between the optimum transition levels. M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms These non-linear equations must be solved simultaneously given the bounding values t1 and tL+1. In practice, these equations can be solved by an iterative scheme such as the Newton method. When the No. of quantization levels is large, an approximate solution can be obtained by modeling the PDF pX (x) as a piecewise constant function i.e., t + t p (x) ' p (t^ ); t^ =∆ j j+1 ; t ≤ x ≤ t X X j j 2 j j+1 M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Using this approximation and performing the required minimization, the equation for optimum transition level becomes (t − t ) R ak [p (x)]−1=3dx L+1 1 t1 X tk+1 ≈ + t1 R tL+1 [p (x)]−1=3dx t1 X with k(t − t ) a = L+1 1 + t ; k 2 [0;L] k L 1 Thus, this together with optimum reconstruction level in (2) i.e. tk+tk+1 rk = 2 are now de-coupled. The quantizer MS distortion is t 1 Z L+1 1 3 3 ≈ 2 f [pX (x)] dxg 12L t1 M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Properties of Lloyd-Max Quantizers 1 Unbiased in the mean i.e. E[X] = E[Xq]. Proof: Since Xq is a discrete r.v. we have L X E[Xq] = rkpXq (xq = rk) k=1 Using the staircase mapping of quantizer, the PMF at rk is Z tk+1 pXq (xq = rk) = pX (x)dx tk Thus, using Eq. (2) of Llyod-Max quantizer we get L L X Z tk+1 X Z tk+1 E[Xq] = rk pX (x)dx = xpX (x)dx k=1 tk k=1 tk which can be reduced to Z tL+1 E[Xq] = xpX (x)dx = E[X] t1 M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms 2 Orthogonality of error with output i.e. E[(X − Xq)Xq] = 0. 2 Proof: To prove we show E[XXq] = E[Xq ]. Using the correlation definition L X Z tk+1 E[XXq] = xxqpX;Xq (x; xq = rk)dx k=1 tk When x 2 Ωk i.e. segment k, joint PDF pX;Xq (x; xq = rk) can be expressed as pXq (xq = rkjx 2 Ωk)pX (x 2 Ωk) = pX (x 2 Ωk). Thus, L X Z tk+1 E[XXq] = rk xpX (x)dx k=1 tk Using Eq. (2) of Llyod-Max quantizer and result in property 1, L L Z tk+1 X X 2 2 E[XXq] = rk xpX (x)dx = rkpXq (xq = rk) = E[Xq ] k=1 tk k=1 Byproduct: Eq. (2) can be expressed as conditional mean estimator Z tk+1 rk = xpXq (xqjx 2 Ωk)dx = E[XqjX 2 Ωk] tk M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Remarks 1 Two commonly used PDF's for quantization of image related data are: 1 (x − µ)2 pX (x) = exp(− ) Gaussian p 2 2 2πσx 2σx α p (x) = exp(−αjx − µj) Laplacian X 2 2 µ is the mean, σx is the variance (variance of the Laplacian PDF is 2 2 σx = α ). 2 For uniform distribution, the Lloyd-Max quantizer become a linear quantizer. Let 1 t1 ≤ x ≤ tL+1 p (x) = tL+1−t1 X 0 otherwise 2 2 (tk+1−tk) tk+1+tk Then from (2) we get rk = = . Now combining 2(tk+1−tk) 2 tk+1+tk−1 this result with (1) yields tk = 2 . Thus, ∆ tk − tk−1 = tk+1 − tk = constant = q. M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Also t − t q = L+1 1 ; t = t + q; r = t + q=2 L k k−1 k k and we have rk − rk−1 = tk − tk−1 = q. i.e. all transition and reconstruction levels are equally spaced. The ∆ quantization error e = x − xq is uniformly distributed over the interval (−q=2; q=2); hence MSE is 1 Z q=2 q2 = α2dα = q −q=2 12 2 The variance σx of a uniform random variable (original image) whose range is A is A2=12. For a uniform quantizer having B bits L = 2B, we have q = A=2B. This gives σ2 x = 22B ) SNR = 10log 22B = 6B dB dB 10 i.e. in this special case the SNR achieved is 6dB/bit. M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Image Transforms 2-D unitary transforms have found numerous applications in DIP. The followings are some examples. 1 Data compression using transform coding: reduce the bandwidth by discarding or grossly quantizing low magnitude transform coefficients. 2 Feature extraction: extract salient features of a pattern e.g. in FT high frequency components correspond to the edge information in the image. 3 Dimensionality reduction to principal components: reduce the dimensionality of the image space by discarding the small components. 4 Image filtering: Wiener filter and standard 2-D filters. M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms Discrete Space Fourier Transform The discovery of FFT for computing the FT of sampled signals made it possible for the Fourier analysis of signals to be performed efficiently using digital computers. The computational saving made possible by FFT are even more important in the 2-D case when a large amount of data is involved. In what follows we start with 2-D DSFT and then show the relation between 2-D DSFT and 2-D DFT. Spatial Sampling of Band-limited Images and DSFT We saw that the 2-D FT of a continuous space image x(u; v) is ZZ 1 −j!1u −j!2v X(!1;!2) = x(u; v)e e dudv −∞ and the inverse FT is 1 ZZ 1 j(!1u+!2v) x(u; v) = 2 X(!1;!2)e d!1d!2 4π −∞ M.R. Azimi Digital Image Processing Image Quantization Lloyd-Max Quantizer Image Transforms For the sampled image i.e. x(m∆u; n∆v) or simply x(m; n) the FT becomes 1 1 X X −j!1m∆u −j!2n∆v X(!1;!2) = x(m; n)e e m=−∞ n=−∞ ∆u; ∆v are sampling intervals.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    17 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us