Help with reading a binary array of intensity values from .img file?
Show older comments
I downloaded a .img file from the opportunity rover. I want to read the intensity values associated with each pixel. Currently I'm writing to a vector but I'm pretty sure I'm getting the wrong values since I'm getting a range of 0-65000. The file should just be a binary array (I removed the ascii detachable string).
There's 16 bits per pixel and I know the height and width of the image. The intensity values should be from 0-1. Does anybody have any ideas? I'm using the function 'fread' right now.
Currently, I'm doing this.
if true
fileID = fopen("filenamepath")
[A, count] = fread(fileID, [height, width], 'double')
end
I'm getting less data than I thought because using double is 8 bytes but each pixel is 2 bytes....thoughts?
Accepted Answer
More Answers (0)
Categories
Find more on Data Import and Analysis 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!