how can i compute probabalies in haffmaneco

1 次查看(过去 30 天)
how i can i compute probabalties to compress all letters small capital and numbers
  3 个评论
Yusuf lamah
Yusuf lamah 2020-2-8
how i can compute P in this dict = huffmandict(symbols,p); to compresss text contain letters capital, small and numbers
Walter Roberson
Walter Roberson 2020-2-8
You are right, my response of huffmandict() was not correct.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2020-2-8
[unique_symbols, ~, bin_number] = unique(YourText(:));
symbol_counts = accumarray(bin_number, 1);
symbol_probs = symbol_counts ./ numel(YourText);
Alternately,
sparse_count = sparse(1, double(YourText(:)), 1);
[~, unique_symbols, symbol_counts] = find(sparse_count);
unique_symbols = char(unique_symbols.');
symbol_probs = symbol_counts.' ./ numel(YourText);
In both cases, after the code, unique_symbols will be a column vector of characters that exist in the text, and symbol_probs will be the corresponding probability.
The sparse() version has a minor flaw that it will fail if any characters in the text are binary 0.

更多回答(3 个)

Yusuf lamah
Yusuf lamah 2020-2-8
thank you very much for your reply but i need to know how compute the probabaleties as input of dict
  2 个评论
Walter Roberson
Walter Roberson 2020-2-10
Are you certain that this remark about needing to know how to compute the probabilities is the answer that you needed to your question? You Accepted it ?

请先登录,再进行评论。


Yusuf lamah
Yusuf lamah 2020-2-8
this function to compute dict i need to compute probabelties

Yusuf lamah
Yusuf lamah 2020-2-10
how to hide text in an image using LSB technique
  1 个评论
Walter Roberson
Walter Roberson 2020-2-10
That is not a continuation of this question.
You should first use Google Scholar to research the topic.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

标签

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by