Huffman Coding in Digital Image Processing with example & its Implementation in MATLAB ||Compression
Автор: Study with Dr. Dafda
Загружено: 2022-07-17
Просмотров: 11335
Video lecture series on Digital Image Processing, Lecture: 39,
Huffman coding in Digital Image Processing with example and its Implementation in MATLAB
Coding redundancy
Image Compression
Link of Hindi Version of this lecture: • Huffman Coding in Digital Image Processing...
Link to download ppts/lecture notes:
https://drive.google.com/drive/folder...
#DIP
#DIPwithMATLAB
#DigitalImageProcessingUsingMATLAB
#DigitalImageProcessing
#StudywithDrDafda
MATLAB code developed for the video...
%Program for Huffman encoding and decoding
close all;
clear all;
clc;
I = imread('Cameraman.tif');
I = imresize(I, [4 NaN]);
disp('the pixel values are:');
disp(I);
% % % other example I values
% I = [4 5 3 2
% 5 6 4 1
% 3 2 4 2
% 2 3 2 3];
% I = [ 3 3 3 2
% 2 3 3 3
% 3 2 2 2
% 2 1 1 0];
subplot(1,2,1);
imshow(uint8(I));
title('Original image');
[m,n] = size(I);
Totalcount=m*n;
symbols = unique(I);
disp('the unique symbols are');
disp(symbols);
counts=histc(I(:),symbols);
pro=counts./Totalcount;
disp('the probabilities are:');
disp(pro);
[dict,avglen]=huffmandict(symbols,pro);
disp('the average length of the code is :');
disp(avglen);
H=entropy(uint8(I));
disp('Entropy is:');
disp(H);
E=(H/avglen)*100;
disp('Efficiency is:');
disp(E);
disp('Compression ratio is:');
Cr=(Totalcount*8)/(Totalcount*avglen)
disp('Relative data redundancy is:');
RD = (1 - (1/Cr))*100
newvec=reshape(I.',1,[] );
hcode=huffmanenco(newvec,dict);
disp('The Huffman encoded code is:');
disp(hcode);
DD1=huffmandeco(hcode,dict);
disp('The Huffman decoded code is:');
disp(DD1);
DD=uint8(DD1);
Restore=reshape(DD,4,4);
subplot(1,2,2);
imshow(Restore.');
title('Decoded Image');
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: