Shawly
April 28, 2021, 3:01pm
1
I am new to Julia and trying to port some code from Matlab. I have an image file saved as a raw binary file with 12 bit precision. In Matlab I can use fread (Read data from binary file - MATLAB fread - MathWorks United Kingdom ):
A = fread(fileID, sizeA, precision) with precision equal to 12.
In julia, I can only find methods that support a precision which is a multiple of 8. Are there any methods available?
I guess you should read 24 bits at a time and split them up.
5 Likes
Welcome to our community
uhhh, in the documentation link you gave 12
is not a valid precision, there is ubit12
and bit12
what one did you use? Did you have negative numbers?
3 Likes
Shawly
April 28, 2021, 3:27pm
4
Thanks! I figured this might be the way to go but I was hoping to avoid it.
DNF
April 28, 2021, 3:42pm
5
You can directly read 12 bit numbers in Matlab, but my experience has been that it’s very slow. Reading as ordinary bytes and splitting manually was dramatically faster.
4 Likes