Line 5: Line 5:
  
  
<center><font size= 4>Implementation of Quantization</font size>
+
<center><font size= 4>Max Quantizer on Image</font size>
  
 
A [http://www.projectrhea.org/learning/slectures.php slecture] by [[ECE]] student Yitong Wang  
 
A [http://www.projectrhea.org/learning/slectures.php slecture] by [[ECE]] student Yitong Wang  
Line 13: Line 13:
 
----
 
----
 
----
 
----
==1. Introduction (''Implementation of Quantization'')==
+
==1. Introduction (''Implementation of Max Quantization'')==
Quantization is an operation to compress a signal by reducing a range of values to a single value. This slecture will describe the implementation of image quantization
+
Quantization is an operation to compress a signal by reducing a range of values to a single value. We tried Max quantizer on voice sigal in lab5. This slecture will describe the image quantization through max quantizer and the difference between it and uniform quantizier.
 
<math> f(x)= \frac{1}{5} \sin x \int_{-\infty}^\alpha \pi^y dy</math>
 
<math> f(x)= \frac{1}{5} \sin x \int_{-\infty}^\alpha \pi^y dy</math>
  
Line 23: Line 23:
 
*Since the quantization will obviously cause loss of data, we should try the quantization in different levels and the analyse the error.  
 
*Since the quantization will obviously cause loss of data, we should try the quantization in different levels and the analyse the error.  
 
==3. Theory ==
 
==3. Theory ==
To operate an uniform quantization, the first things is to determine the uniform quantization step Δ.
+
To operate an uniform quantization, the first things is to determine the uniform quantization step Δ. Although there are 256 values to represent the brightness, the Δ depends on the range of the brightness of image instead of 0 to 255.  
  
 
  <math> Δ = \frac{Max(X) - Min(X)}{N-1} </math>
 
  <math> Δ = \frac{Max(X) - Min(X)}{N-1} </math>
Line 40: Line 40:
  
  
To make the step simple, we can make a quantization function respect to input X and quantization level N
+
To make the step simple, we can make a quantization function respect to input X and quantization level N. However, the image signal is in matrix, so just simply use x(:), which convert the matrix into a vactor.
  
 
function [y] = Uquant(x,N)
 
function [y] = Uquant(x,N)
delta = (max(x(:))-min(x(:)))/(N-1);
+
 
y =  round((x-min(x(:)))/delta).*delta + min(x(:));
+
delta = (max(x(:))-min(x(:)))/(N-1); % calculate delta
 +
 
 +
y =  round((x-min(x(:)))/delta).*delta + min(x(:)); % round the quantized value then add with min(x)
 +
 
 
end
 
end
 +
 +
 +
 +
 +
  
  
  
 
----
 
----
[[Image:nature.jpg]]
+
[[Image:bit4.jpg]]
  
 
----
 
----

Revision as of 19:43, 29 November 2015


Max Quantizer on Image

A slecture by ECE student Yitong Wang

Partly based on the ECE438 Fall 2015 lecture material of Boutin.



1. Introduction (Implementation of Max Quantization)

Quantization is an operation to compress a signal by reducing a range of values to a single value. We tried Max quantizer on voice sigal in lab5. This slecture will describe the image quantization through max quantizer and the difference between it and uniform quantizier. $ f(x)= \frac{1}{5} \sin x \int_{-\infty}^\alpha \pi^y dy $


2. Background

  • The brightness of a photo at each pixel is typically distributed among integers from 0 to 255. However, since some images are desired to take only several values, the brightness value has to be rounded off to fit the size of the image.
  • Since the quantization will obviously cause loss of data, we should try the quantization in different levels and the analyse the error.

3. Theory

To operate an uniform quantization, the first things is to determine the uniform quantization step Δ. Although there are 256 values to represent the brightness, the Δ depends on the range of the brightness of image instead of 0 to 255.

$  Δ = \frac{Max(X) - Min(X)}{N-1}  $

Where X is the signal to be quantized and N is the number of quantization levels. The quantization step Δ is the range of values will to be quantized. Since the input image is not type double, it can't be processed in mathematical operation in Matlab. It should be converted to type double.


$ X = double(input) $

After this, we can do the quantization.

  • Substract X with $ Min(X) $ (To see the difference of value between the pixel and the least bright pixel)
  • Divide the result by Δ and round it to integer
  • Add the result to $ Min(X) $


To make the step simple, we can make a quantization function respect to input X and quantization level N. However, the image signal is in matrix, so just simply use x(:), which convert the matrix into a vactor.

function [y] = Uquant(x,N)

delta = (max(x(:))-min(x(:)))/(N-1); % calculate delta

y = round((x-min(x(:)))/delta).*delta + min(x(:)); % round the quantized value then add with min(x)

end






File:Bit4.jpg


4. Conclusion (Replace by appropriate section title)

Text of fourth section goes here.


5. References

  • Reference 1
  • reference 2


Questions and comments

If you have any questions, comments, etc. please post them here.


Back to 2015 Fall ECE 438 Boutin


Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett