how can i compute probabalies in haffmaneco

1 vue (au cours des 30 derniers jours)
Yusuf lamah
Yusuf lamah le 7 Fév 2020
Commenté : Walter Roberson le 10 Fév 2020
how i can i compute probabalties to compress all letters small capital and numbers
  3 commentaires
Yusuf lamah
Yusuf lamah le 8 Fév 2020
how i can compute P in this dict = huffmandict(symbols,p); to compresss text contain letters capital, small and numbers
Walter Roberson
Walter Roberson le 8 Fév 2020
You are right, my response of huffmandict() was not correct.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Fév 2020
[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.
  1 commentaire
Yusuf lamah
Yusuf lamah le 8 Fév 2020
thank you very much for your help

Connectez-vous pour commenter.

Plus de réponses (3)

Yusuf lamah
Yusuf lamah le 8 Fév 2020
thank you very much for your reply but i need to know how compute the probabaleties as input of dict
  2 commentaires
Walter Roberson
Walter Roberson le 10 Fév 2020
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 le 10 Fév 2020
yes,thank you very much its working

Connectez-vous pour commenter.


Yusuf lamah
Yusuf lamah le 8 Fév 2020
this function to compute dict i need to compute probabelties

Yusuf lamah
Yusuf lamah le 10 Fév 2020
how to hide text in an image using LSB technique
  1 commentaire
Walter Roberson
Walter Roberson le 10 Fév 2020
That is not a continuation of this question.
You should first use Google Scholar to research the topic.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Tags

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by