From: rain h. on
Here is my homework for the upcoming week I have some few questions:
{
We know a digital image is a quantized version of some underlying “continuous” image. For an 8-bit grey-level image, we have 256 levels in quantization. We can further quantize the 256 levels into, say, only 8 levels. In this problem, you are asked to do the following in MATLAB. Your submission should include the resultant images and the code you write to do the job.
(1) Read the image into MATLAB and quantize it uniformly into 8 levels. Evaluate the mean squared error between the original image and the quantized image. Turn in the quantized image.
(2) Generate random noise uniformly distributed over [-d/2, d/2], where d is the step size for quantization in part (1), and add this noise to the original image to get a new (dithered) image. Quantize this dithered image uniformly into 8 levels. Evaluate the mean squared error between the original image and the quantized image. Turn in the quantized image.

Display the two versions of quantized images from (1) and (2). Which one looks better to you?


Problem 2. Resize an image.
Write a MATLAB code to scale the input image of 256x256 to a smaller image of 160x160 using the bilinear interpolation method discussed in the class. Use the MATLAB’s built-in function imresize to do the same thing (e.g., with the ‘bilinear’ option). Compare your result and the result from imresize by computing the mean squared error between two obtained 160x160 images. Turn in both images and your code.

}
1-Firstly the professor asked to quantize the grayscale into fewer levels so no DCT, I don't know what he means and how should I program it(if I can figure this question I am pretty sure I can do the rest myself.)
2- Secondly I understand the bilinear interpolation but because of my matlab weakness I can't translate it into an actual program(any help) here is the pseudocode that I sketched
[ foreach yy in new coordinates
calculate y in old coordinates
round to neighbours y1 and y2
foreach xx in new coordinates
calculate x in old coordinates
round to neighbours x1 and x2
apply bilinear formulas
store result at (xx,yy)
next
next ]

Thanks for reading and a million thanks for helping
From: Rune Allnor on
On 28 Sep, 02:44, "rain h." <reda02...(a)gmail.com> wrote:

> 1-Firstly the professor asked to quantize  the grayscale into fewer levels so no DCT, I don't know what he means and how should I program it(if I can figure this question I am pretty sure I can do the rest myself.)

You should ask the professor what he means if you are
uncertain.

I would *guess* that he means that you should convert
the pixels in some image from the range [0,255] to the
range [0,7].

Rune