- 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?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2018년 9월 7일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Cast and Quantize Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!