How to import a .uint16 file as matrix / image into MATLAB?

8 次查看(过去 30 天)
How to import a .uint16 file as grayscale image (or matrix) into MATLAB?
Thank you

回答(1 个)

Sindhu Karri
Sindhu Karri 2021-5-3
Hii,
You can use imread function to read image file and store them as an array variable.Use rgb2gray function to convert RGB image or colormap to grayscale.
  3 个评论
DGM
DGM 2021-5-6
编辑:DGM 2021-5-6
Do you know what format the file is in? The only thing that the extension implies is that it's 16 bit unsigned integer. It doesn't say anything about it having any format.
I'm inclined to assume it's just raw data, in which case you can probably just treat it like any .bin file and read it with fread(). You'll need to know its geometry in order to get anything useful out of it.
If you know what you're looking for, you might be able to peek at it with a hex editor to see if there's anything revealing in the beginning of the file.
If the file isn't confidential (or huge), you may consider attaching it.
Marco Pillon
Marco Pillon 2021-5-10
I confirm that with the command fread (), with the right size, the file is correctly read.
The idea on the hex editor is interesting.
Thank you

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by