Read 10 bit raw image data in matlab using uint16, why it is read as 12 bit ???
14 次查看(过去 30 天)
显示 更早的评论
I read a 10bits multispectral raw image data using uint16 as follows
fid=fopen(file_name,'r');
a=fread(fid,width*height*band,'uint16');
fclose(fid);
but I got the maximum value of this data is 4095, it means that my data is read as 12-bit data. Is there anyone know why?
I also tried to read the same data in uint32 and the result becomes 28-bit data.
why there is a 4-bit difference here?
0 个评论
采纳的回答
Walter Roberson
2018-6-7
When a manufacturer makes two devices with different precision, the manufacturer often "left justifies" the lower-precision values to the width of the higher precision, so that the value range is still the same between the two devices, but the higher precision device returns values that are more precise.
For the same reason, it is not uncommon for manufacturers to output 12 bit values as the left-most 12 bits (12 most significant) in a 16 bit field -- leaving room for a future more precise device with the same value range but higher accuracy. This relieves the need to rewrite processing software.
You should look at min(diff(unique(a))) . If it is 4 then you have 10 bits worth of data; if it is 1 then you have 12 actual bits worth of data.
Another thing that happens is that 10 bit data that has been recorded raw with a bayer mosaic might be left shifted and interpolated to 12 bits of RGB
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!