1. 程式人生 > >每日積累(20171013-day-28)(編譯matlab 讀寫 exr格式圖片外掛)

每日積累(20171013-day-28)(編譯matlab 讀寫 exr格式圖片外掛)

首先編譯Windows下安裝編譯IlmBase,Zlib,OpenEXR,把dll檔案路徑新增到環境變數中

然後下載http://www.mit.edu/~kimo/software/matlabexr/原始碼檔案,解壓,開啟matlab,進入資料夾

在matlab中編譯外掛

mex exrwrite.cpp -LX:\path\to\ilmbase\x64\lib -LX:\path\to\openexr\x64\lib -lHalf -lIlmImf -IX:\path\to\ilmbase\x64\include\OpenEXR -IX:\path\to\openexr\x64\include\OpenEXR
mex exrread.cpp -LX:\path\to\ilmbase\x64\lib -LX:\path\to\openexr\x64\lib -lHalf -lIlmImf -IX:\path\to\ilmbase\x64\include\OpenEXR -IX:\path\to\openexr\x64\include\OpenEXR
mex exrinfo.cpp -LX:\path\to\ilmbase\x64\lib -LX:\path\to\openexr\x64\lib -lHalf -lIlmImf -IX:\path\to\ilmbase\x64\include\OpenEXR -IX:\path\to\openexr\x64\include\OpenEXR

問題,


在exrread.cpp,exrinfo.cpp和exrwrite.cpp的第一行新增

#define OPENEXR_DLL


使用方法

>> im = exrread(filename);
>> [im,mask] = exrread(filename);

>> exrwrite(im,filename)
>> exrwrite(im,mask,filename)