change the quantization level of data
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I want to change the quantization level of a data. The original data is acquired in 16 bit format. I want to encode it in 2 bit. How can I do this?
-saima
댓글 수: 0
채택된 답변
Walter Roberson
2013년 8월 29일
Divide the data by 2^14
댓글 수: 3
Image Analyst
2013년 8월 29일
After that you have only 4 values, so might as well cast your data to uint8 and save a byte of space per element.
data2bits = uint8(data16bits / 2^14);
and you do realize that it's still an 8 bit variable even though it has only 2 bits of information in it, don't you?
Walter Roberson
2013년 8월 30일
Watch out for rounding -- you need to decide whether you want it or do not want it. uint8() rounds as it converts.
추가 답변 (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!