作者CBET ( )
看板MATLAB
標題Re: [問題] 如何開啟Lena.dat
時間Sun Jan 4 11:51:25 2015
檔案內是以 row major 的方式儲存圖片的 256 * 256 數值
使用 fread 把值讀出即可,但須注意 Matlab 是 column major
- -
% 讀出數值
fid = fopen('Lena.dat');
img = fread(fid, [1, inf]);
fclose(fid);
% 將數值排成圖片矩陣
img = reshape(img, 256, 256)';
figure, imshow(img, [0, 255])
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.230.138.45
※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1420343487.A.2A6.html
推 soracho: 謝謝你!^^ 01/04 23:41
推 soracho: 終於可以順利開啟了!感動,謝謝你幫了大忙。 01/05 16:43