Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In MATLAB, a grey - scale image is stored a a matrix of numbers, all between 0 ( black ) and 2 5 5 (

In MATLAB, a grey-scale image is stored a a matrix of numbers, all between 0(black) and 255(white). Since there are 256 possible values, 8 bits are needed or each pixel, in contrast to a normal integer, which is 64 bits.To save memory, grey-scale images are stored with a special data type, uint8(unsigned 8-bit integer). In computer terminology, 8 bits =1 byte.
Even at one byte per pixel, a large image can consume a lot of memory. For example, a 1000x1000-pixel image takes 1 million bytes (which is a little less than 1 megabyte, since by convention 1 Mbyte =2^20 bytes).
One technique for reducing the size of an image is quantization - reducing the number of allowable levels from 256 to something smaller. Surprisingly, most images can be quantized by a large factor without losing much information. In this problem, you will quantize a grey-scale image to only 4 levels, so that it could (in principle) be stored as 2 bits per pixel.
The template will read in an image file. Your job is to loop over all rows and columns of the image matrix, N, and set each pixel to 0,1,2, or 3 as follows:
original pixel value new pixel value
0-640
65-1281
129-1922
193-2553
Use imshow to display the original and modified images so that you can see the effect of the quantization.
Provided Script:
%Load in the color image and convert it to grey-scale
M = imread('images_L8_2.jpg');
N = uint8(mean(M,3));
imshow(N)%look at the original image
%%YOUR CODE GOES HERE
%THIS WILL DISPLAY THE QUANTIZED IMAGE -- DO EVERYTHING ABOVE THIS LINE
figure
Levels = uint8([32,96,160,224])%display each pixel as the mid-point of its range
imshow(Levels(N+1))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

=+How might you explain this phenomenon?

Answered: 1 week ago