I have a binary Band Sequential (1-band, BSQ file), which is an unsigned 16-bit (2-byte) integer.
Currently I’m reading the whole (image) through multibandread:
img=multibandread('IMAGE.bsq',[400 400 1],'uint16',0,'bsq','n');
What process in MATLAB would allow me to read both bytes individually? i.e. I would like to read the file into 2 new arrays in MATLAB e.g. byte1 (400x400x1) and byte2 (400x400x1).
Can this be achieved through fread? I note in the ‘precision’ section it is possible to skip source values (e.g. 'N*source=>output'), but I’m unsure of the exact process.
One way would be splitting your current
imgwith bitwise operations. The LSB image would be:and the MSB image would be:
Not mandatory, but maybe you’ll also want to convert these into
uint8s: