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!