How can i read and show a image (64*64), 2 byte integer format, and plot a profile across mid section of it?
3 views (last 30 days)
Show older comments
How can i read and show a image (64*64), 2 byte integer format, and plot a profile across mid section of it?
1 Comment
Guillaume
on 17 Apr 2015
Edited: Guillaume
on 17 Apr 2015
What do you mean by " image (64*64), 2 byte integer format"? Your image is a file of just the raw byte values of the pixels? In that case, you also need to know the number of colour channels (1 = monochrome, 3 = RGB).
Or is your image in a standard image format (PNG, BMP, or other)?
Answers (1)
Guillaume
on 17 Apr 2015
Possibly, the following may work to read the file:
img = multibandread('somefile', [64 64 1], 'uint16=>uint16', 0, 'bsq', 'ieee-le');
Replace the 1 by 3 if a colour image. You may also need to change the byteorder or the interleave option of multibandread.
Once loaded, displaying the image is just
imshow(img)
1 Comment
Guillaume
on 17 Apr 2015
Edited: Guillaume
on 17 Apr 2015
Akshit comment moved here: yes, i have a raw data and it's color, i used the multiband read, but it did not work.
As mentioned for a colour image replace the 1 in [64 64 1] by a 3, so [64 64 3].
As also mentioned you may need to try a different option for interleave (most likely bip) and / or for the endianness.
Without more information about your file, I can't help you more.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!