how to read 12bit raw data faster
17 views (last 30 days)
Show older comments
This is my way to read 12bit raw image file.
data = fread(p,[768,1024],'ubit12=>uint32',4,'l');
But it takes very long time, is there any other way to speed up the processing time?
Thanks!
2 Comments
Walter Roberson
on 6 Feb 2012
Is the data really packed in groups of 12 consecutive bits? It is not impossible, but it would be somewhat unusual.
Accepted Answer
Jan
on 7 Feb 2012
You can read all 16 bits and set the upper 4 bits to zero:
data = fread(p, [768,1024], 'uint16');
b = uint32(rem(data, 4096));
I assume you can use the format 'uint16=>uint32' directly - please test if this is faster and if rem works on UINT32 arrays.
More Answers (0)
See Also
Categories
Find more on Import, Export, and Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!