How do I create RAW image files in MATLAB?

I would like to use MATLAB in order to create binary RAW-files to store images.
The images I try to create using FWRITE do not open properly in Adobe Photoshop.

 采纳的回答

In order to create RAW-files for images in MATLAB, use the FWRITE function with 'uint8' or 'uint16' as the precision specifier, as in the example below (which creates a black image (all zeros) of size 100x100
 
cmodel=(zeros(300,100,1));
fid=fopen('blackimage.raw','w+');
cnt=fwrite(fid,cmodel,'uint8');
fclose(fid);

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息

产品

版本

R2006a

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by