entropy encoding for images

is there any source codes available for entropy encoding for images, please help

2 comentarios

Walter Roberson
Walter Roberson el 24 de Dic. de 2012
What difficulty are you having with the code version of it that you wrote?
FIR
FIR el 25 de Dic. de 2012
I am using 2010a version
code is
[dict,avglen] = huffmandict(symbols,p)
comp = huffmanenco(img,dict);
but taking long time to run and crashes out

Iniciar sesión para comentar.

Respuestas (2)

Image Analyst
Image Analyst el 24 de Dic. de 2012

0 votos

8 comentarios

FIR
FIR el 25 de Dic. de 2012
Editada: Walter Roberson el 25 de Dic. de 2012
i used code for arthimetic encoding but returns error
original=imread('Lena.bmp'); % Read an image Lena 512*512 to original variable
seq=original(:); % convert the matrix original into a vector by morton scan order which is a fucntion i made up by myself
seq=double(seq);
ta=tabulate(seq); % create a three column with the internal function ... first column is the symbol... second is the times it occured ... third is the propability
count=ta(:,2); %copy the count column into count variable from ta variable
code=arithenco(seq,count);
nnz(seq)
ans =
65536
>> nnz(count)
ans =
230
please tell how to correct it
error
Error using ==> arithenco at 36
The symbol counts parameter must be a vector of positive finite integers.
Error in ==> sample6 at 63
code=arithenco(seq,count);
Image Analyst
Image Analyst el 25 de Dic. de 2012
You correct it by stepping through your code in the debugger. I can't do it because I don't have those functions. I know you know how to use the debugger by now. Evidently seq or count is not "a vector of positive finite integers" and you can find out why by examining the variable in the debugger.
FIR
FIR el 25 de Dic. de 2012
i have not used Debugger till now,can u tell how to debub please
Image Analyst
Image Analyst el 25 de Dic. de 2012
It's hard to believe you have used MATLAB for this long and have never stepped through your code or looked at variables. That is usually taught in the first hour of MATLAB training. Nevertheless, you can learn how to debug your code here: http://blogs.mathworks.com/videos/2010/09/02/using-debugger-to-walk-through-code/ You will absolutely need to learn how to debug your code because "debugging via the Answers forum" is a very inefficient and lengthy way to debug your code.
FIR
FIR el 25 de Dic. de 2012
Sorry that debugging know very well,i thought it was some thing new
FIR
FIR el 25 de Dic. de 2012
is there any codes available for shanon fano encoding
Walter Roberson
Walter Roberson el 25 de Dic. de 2012
what does
length(count)
show? And also
sum(count <= 0)
?
FIR
FIR el 25 de Dic. de 2012
length(count)
ans =
238
>> sum(count <= 0)
ans =
8

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 25 de Dic. de 2012
Editada: Walter Roberson el 25 de Dic. de 2012

0 votos

If x is a numeric array, TABLE is a numeric matrix. If the elements of x are nonnegative integers, TABLE includes 0 counts for integers between 1 and max(x) that do not appear in x.
But you already read the documentation so you already knew that, so somehow you must have gotten some negative counts. What does
count(counts <= 0)
show, and what does class(count) show?

10 comentarios

FIR
FIR el 25 de Dic. de 2012
count(count <= 0)
ans =
0
0
0
0
0
0
0
0
class(count)
ans =
double
Walter Roberson
Walter Roberson el 25 de Dic. de 2012
Then your data being tabulated is non-negative integers and some of the integers between the lowest value and the maximum value do not happen to have any pixels with that value, so as documented, tabulate() generated entries with 0 counts for those values. Consider removing the entries that have the 0 counts.
FIR
FIR el 25 de Dic. de 2012
can we replace it with 0.1,or it can be removed
Walter Roberson
Walter Roberson el 25 de Dic. de 2012
The error message you quoted was,
The symbol counts parameter must be a vector of positive finite integers.
0 is not a positive integer, so counts of 0 are not permitted. You must remove all entries with count of 0.
FIR
FIR el 25 de Dic. de 2012
ok walter thanks a lot ,can u tell why my matlab crashed when using
[dict,avglen] = huffmandict(s,q)
its taking longtime to run
FIR
FIR el 25 de Dic. de 2012
like huffman is there and code for shanon fanon
Walter Roberson
Walter Roberson el 25 de Dic. de 2012
I do not have that toolbox, so I do not know why it is taking so long. Have you tried using the profiler? Did you manage to find the reason why it was giving you infinite recursion ?
FIR
FIR el 25 de Dic. de 2012
No walter i could not findout,so walter is there any codes for shanon fanon
FIR
FIR el 25 de Dic. de 2012
after deleting zeros i get error
Error using ==> arithenco at 36
The symbol sequence parameter can take values only between 1 and the length of the
symbol counts parameter.
Error in ==> sample6 at 79
code=arithenco(seq,count);
Walter Roberson
Walter Roberson el 25 de Dic. de 2012
Sorry, Google doesn't seem to be accessible to me tonight. Perhaps you could try it from your end?

Iniciar sesión para comentar.

Categorías

Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.

Preguntada:

FIR
el 24 de Dic. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by