- histc passing in bin edges
- hist passing in bin centers
- histcounts() passing in either bin edges or bin centers with appropriate options
Is it possible to replace Scalar quantization into vector Quantization in matlab?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Shan Sha
le 7 Sep 2018
Réponse apportée : Walter Roberson
le 7 Sep 2018
I used binary quantizer and non-uniform quantizer under scalar quantization. Is it possible to replace the following code with vector quantization? If so how can I modify?
my code:
C_code = gen_binary_codes(C, K);
Ls = 3;
Lr = 5;
BINsi=Ls;
Wsi=BINsi.^(1:-1:0); % weights
BINc =2;
Wc=BINc.^(3:-1:0);
II=[1 2];JJ=[1 2 4 5];
SIcode = SI_code(:,II);
Ccode = C_code(:,JJ);
featW = SIcode*Wsi' + (Ccode*Wc')*BINsi^2;
H1=hist(featW, 0:(BINsi^2*BINc^4-1));
II=II+1; JJ=JJ+1;
SIcode = SI_code(:,II);
Ccode = C_code(:,JJ);
featW = SIcode*Wsi' + (Ccode*Wc')*BINsi^2;
H2=hist(featW, 0:(BINsi^2*BINc^4-1));
% H3
G2=C(:,1:3);
D2=C(:,4:6); % d
r=2/pi*atan(Coef*D2./G2);
R_code = atan_vq(r, Lr);
W=Lr.^(2:-1:0);
featW = R_code*W';
H3 = hist(featW, 0:Lr^3-1);
0 commentaires
Réponse acceptée
Walter Roberson
le 7 Sep 2018
You can do non-uniform quantization of arrays in multiple ways:
In the above three cases, you want to extract the bin number, which is the second output for histc or hist and the third output for histcounts. You then use the bin number as an index into an array of the representative value for each bin.
You can also quantize over arrays by using interp1() with the 'previous' or 'next' or 'nearest' option, like interp1(edges_list, representative_values_list, array_to_quantize, 'previous') . Here representative_values would be the same as the edges list if you wanted to quantize to the edge value but would be the edge centers if you wanted to quantize to the edge centers.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Cast and Quantize Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!