フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how to get the compressed image from huffman

1 回表示 (過去 30 日間)
juveria fatima
juveria fatima 2018 年 3 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i am using huffman dictioanry to encode n decode
how do i get the compressed image entropy, average length
this is my code
clc
clear all
inputImage=imread('cameraman.bmp');
[row col] =size(inputImage);
quantizedValue=10;
QuantizedImage= inputImage/quantizedValue;
QuantizedImage=round(QuantizedImage);
%QuantizedImage=uint8(QuantizedImage);
%ImageArray=reshape(QuantizedImage,[1 row*col]);
GrayValueDict=(1:256);
ProbDict=zeros(1,256);
%{
for(i=0:255)
GrayValueDict(i+1)=i;
end
%}
for(i=0:255)
for(r=1:row)
for(c=1:col)
if(i==QuantizedImage(r,c))
ProbDict(i)=ProbDict(i)+1;
end
end
end
end
ProbDict= ProbDict/(row*col) ;
%ProbDict= round(ProbDict,3);
dict = huffmandict(GrayValueDict,ProbDict,5);
sig=reshape(QuantizedImage,[1 row*col]);
hcode = huffmanenco(sig,dict);
dhsig = huffmandeco(hcode,dict);
out= reshape(dhsig, [256 256]);
out=out*10;
subplot(1,2,1);
imshow(inputImage,[]);
subplot(1,2,2);
imshow(out,[]);
isequal(sig,dhsig);

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by