文章:《HDR image reconstruction from a single exposure using deep CNNs》
代码:https://github.com/gabrieleilertsen/hdrcnn
关于python3运行OpenEXR的坑
安装OpenEXR的依赖库
使用sudo apt-get install libopenexr-dev
安装的是1.2.0
的版本,不过这个只能在python2.7
中使用,因此需要安装OpenEXR 2.3.0
- 方法一:源码编译:https://github.com/openexr/openexr
- 方法二:如果你是使用anaconda环境,可以直接安装,运行
conda install -c conda-forge openexr
安装OpenEXR的python库
- 完成上面步骤之后就可以安装OpenEXR的python包。
- 使用
pip3 install OpenEXR
安装的包会发生OpenEXR.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNK7Imf_2_214TypedAttributeISsE12writeValueToERNS_7OStreamEi
的错误,原因是OpenEXR.cpython-35m-x86_64-linux-gnu.so
是采用g++-4
编译的,但是第一步的库都是使用g++-5
编译的,关于std::string
在so库里面的命名发生变化,所以找不到定义。解决办法如下:- 下载 https://github.com/jamesbowman/openexrpython 源码
- 使用
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
和sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 50
命令将系统默认的g++-4
和gcc-4
变为g++-5
和gcc-5
- 安装步骤编译,安装即可
遇到的问题:
- 遇到
undefined symbol: _ZTIN7Iex_2_27BaseExcE
错误,原因是使用conda install -c conda-forge openexr
安装的是2.3.0
版本的,但是openexrpython
是依赖2.2.0版本的,因此需要安装回2.2.0版本,使用conda install -c daleydeng openexr
,相关版本可以在anaconda search这里找到。 OpenEXR.cpp:37:19: fatal error: ImfIO.h: 没有那个文件或目录
错误:因为采用的是conda安装依赖库,因此需要修改setup.py
里面依赖库和头文件的位置。/home/chuangbin/anaconda3/envs/py36/compiler_compat/ld: cannot find -lIlmImf
错误:lib文件里面缺少IlmImf.so
,创建链接即可。