Answered step by step
Verified Expert Solution
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 greyscale image is stored a a matrix of numbers, all between black and white Since there are possible values, bits are needed or each pixel, in contrast to a normal integer, which is bits.To save memory, greyscale images are stored with a special data type, uintunsigned bit integer In computer terminology, bits byte.
Even at one byte per pixel, a large image can consume a lot of memory. For example, a xpixel image takes million bytes which is a little less than megabyte, since by convention Mbyte bytes
One technique for reducing the size of an image is quantization reducing the number of allowable levels from to something smaller. Surprisingly, most images can be quantized by a large factor without losing much information. In this problem, you will quantize a greyscale image to only levels, so that it could in principle be stored as 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 or as follows:
original pixel value new pixel value
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 greyscale
M imreadimagesLjpg;
N uintmeanM;
imshowNlook at the original image
YOUR CODE GOES HERE
THIS WILL DISPLAY THE QUANTIZED IMAGE DO EVERYTHING ABOVE THIS LINE
figure
Levels uintdisplay each pixel as the midpoint of its range
imshowLevelsN
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started