Columbia University
Digital Image Processing HW#2 Solution
02/26/2004
TA: Jessie Hsu yh2117@columbia.edu
1. Compandor Design:
|[pic] |
|(a) Idea of the compandor |
Given a pdf of the random variable u, the goal is to determine decision levels and reconstruction levels in w domain, and then tranform them back to u domain.
Thus, what we are going to do here is to
1) Determine the transform function both from u to w and from w to u
2) Quantize w, obtaining decision and reconstruction levels
3) Transform decision and reconstruction levels back to u
|[pic] |[pic] |
|(b) pdf of u |(c) pdf of w |
The pdf of u is given by
[pic] [pic]
[pic] [pic]
Determining the transform function from u to w
The tranformation w=f(u), as given in the problem, is
As [pic]
[pic] [pic]
As [pic]
[pic] [pic]
[pic] [pic]
as illustrated in (e).
Determining the inverse transform function from w to u
Accordingly, we can derive the transformation from u back to w,
As [pic]
[pic]
pick [pic] so that u falls inside the interval [0,1][pic]
As [pic]
[pic] [pic]
pick [pic] so that u falls inside the interval [-1,0][pic]
[pic] [pic]
as illustrated in (f).
|[pic] |[pic] |
|(e) Transformation from u to w |(f) Transformation from w to u |
|[pic] |[pic] |
|(g) Quantizing w |(h) Quantizing u |
Quantizing w, obtaining decision and reconstruction levels
w can be quantized with uniform quantization,
[pic] [pic]
Transforming decision and reconstruction levels back to u
[pic]
[pic] [pic]
Calculating Mean Square Error
[pic]
[Bonus]
This quantizer is NOT optimal for u.
To show this claim, we provide a better quantizer in terms of mean square error. Sample MATLAB programs doing Lloyd-Max quantization are provided below:
|% DIP HW#2 Prob 1 Bonus |
|% Lloyd-Max Quantizer for Triangular distribution |
| |
|clear; |
| |
|N=20; % Number of iterations |
|M=2001; % Number of samples along u axis |
| |
|% pdf construction |
|u=zeros(1,M); |
|u=[-1:2/(M-1):1]; |
|pu=zeros(1,M); |
|pu(1:(M-1)/2+1)=1+u(1:(M-1)/2+1); |
|pu((M-1)/2+1:M)=1-u((M-1)/2+1:M); |
| |
|% Quantization data: thresholds and reconstruction levels |
| |
|t=zeros(N,5); |
|t(:,1)=-1; t(:,3)=0; t(:,5)=1; |
|r=zeros(N,4); |
| |
|% Iteration: Start with the levels obtained from the compandor |
| |
|MSE=zeros(1,N); |
| |
|t(1,2)=-1+1/sqrt(2); t(1,4)=1-1/sqrt(2); |
| |
|r(1,1)=-0.5; r(1,2)=-1+sqrt(3)/2; |
|r(1,3)=1-sqrt(3)/2; r(1,4)=0.5; |
| |
|MSE(1)=MSECompute(u,pu,squeeze(t(1,:)),squeeze(r(1,:))); |
| |
|for k=1:N-1 % kth iteration |
| |
|[tnew,rnew]=LloydMax( u,pu,squeeze(t(k,:)),squeeze(r(k,:)) ); |
| |
|t(k+1,:)=tnew; |
|r(k+1,:)=rnew; |
| |
|clear tnew rnew; |
| |
|MSE(k+1)=MSECompute(u,pu,squeeze(t(k+1,:)),squeeze(r(k+1,:))); |
| |
|end |
Function for computing MSE:
|function y=MSECompute(u,pu,t,r) |
| |
|% Computes quantization error (MSE) |
|% Takes input (u,pu,t,r) |
| |
|M=length(r); % Number of quantization levels |
| |
|y=0; |
| |
|tceil=0; |
|MSE=zeros(1,M); |
| |
|for k=1:M |
|% MSE in the kth interval |
|tfloor=tceil+1; |
|tceil=min( max(find( u ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- columbia university graduate programs
- columbia university career fairs
- columbia university graduate tuition
- columbia university costs
- columbia university cost per year
- columbia university tuition and fees
- columbia university book cost
- columbia university cost of attendance
- columbia university graduate school tuition
- columbia university tuition 2019
- columbia university tuition 2020 2021
- columbia university neuroscience