Filter löschen
Filter löschen

MATLAB arithenco() create encoded code of type double.

2 Ansichten (letzte 30 Tage)
Dimple Anandpara
Dimple Anandpara am 15 Okt. 2015
Beantwortet: Walter Roberson am 15 Okt. 2015
I want to compress image using arithmatic encoding I am trying following code
a=imread('C:\Users\Mitul\Desktop\index.bmp'); % figure,imshow(a)
%converting an image to grayscale I=rgb2gray(a);
%size of the image [m,n]=size(I); Totalcount=m*n;
%function which converts array to vector vec_size = 1; for p = 1:m for q = 1:n newvec(vec_size) = I(p,q); vec_size = vec_size+1; end end
% arithmatic encoding % count of symbols
for i=1:Totalcount
count(i)=1;
for j=i+1:Totalcount
if newvec(i) == newvec(j);
count(i)=count(i)+1;
end
end
end
% Seq to encode
sym=newvec;
code = arithenco(sym,count);
Here size of code is more then actual size of Image because the datatype of code is double. Give me solution for it

Antworten (1)

Walter Roberson
Walter Roberson am 15 Okt. 2015
Solution: write your own arithmetic encoding routine that uses whatever data type you please.

Community Treasure Hunt

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

Start Hunting!

Translated by