Digital Signal Processing Reference
In-Depth Information
4.2.6.1 histogramequalization.m
%Histogram equalization
load mri
A=D(:,:,:,25);
A=A(1:1:127,1:1:127);
B=histeq(A)';
figure
colormap(gray)
subplot(2,2,1)
imagesc(A)
subplot(2,2,2)
plot(imhist(A))
a=imhist(A);
a(1)=0;
plot(a)
subplot(2,2,3)
B=imrotate(B,-90);
imagesc(B)
subplot(2,2,4)
b=imhist(B)
b(187)=0;
plot(b)
4.3 Image Compression
4.3.1 Discrete Cosine Transformation (DCT)
The following steps are followed to compress the image using DCT.
1. Subtract 128 from all the pixel values to obtain the DC component 0.
2. Divide the image into subblock of size 8
×
8.
3. Each subblock is subjected to 2D-DCT.
4. Divide each sub-block with the quantization mask (JPEGMask) and round it. We
get more number of zeros. The quantized data from each sublock is collected in
the zig-zag fashion and are stored using run-length and Huffmann coding.
5. Hence image is compressed using 2D-DCT. Refer Fig. 4.8 to view the original
and the corresponding compressed image obtained using 2D-DCT ( Figs. 4.9
and 4.10 ).
Search WWH ::




Custom Search