I designed a simple uniform quantizer, it is a part of project, I used 'leena.jpg' image the original size is about 65.8 KB, after running this code:
img = imread('leena.jpg');figure(1)imshow(img)[m,n] = size(img);M = 8; K = 256/M;for i = 1:m for j = 1:n quant_img(i,j) = floor(img(i,j)/K) * K + (K/2); endendfigure(2)imshow(quant_img)
—————–
It is clear the image quality reduced, but when I save the two figures (the original and the quantized) as jpg format, I got 14.4 KB for the original and 16.5 KB for the quantized image! When I increase the number of levels (M = 32) the size decrease to 14.8 KB! Why the size of the image is decreasing with increasing the number of levels!! It should be the reverse, right?
Best Answer