[英]Splitting OpenEXR into different exposure images
I'm trying to use this dataset to do Exposure Meging (Fusion) in Python.我正在尝试使用此数据集在 Python 中进行Exposure Meging (Fusion) 。 Each image in the dataset has an OpenEXR file that can be downloaded (i don't have much experience with this file format).
数据集中的每个图像都有一个可以下载的OpenEXR文件(我对这种文件格式没有太多经验)。
I want to extract different samples (jpg or png) from the OpenEXR file with different exposures.我想从 OpenEXR 文件中提取不同曝光的不同样本(jpg 或 png)。
I managed to do that in Darktable :我设法在Darktable做到了:
The problem: I have 100 images and i want to automate this process.问题:我有 100 张图像,我想自动化这个过程。 any idea on how to do that?
关于如何做到这一点的任何想法?
Thank you in advance先感谢您
Since each increment of EV ( "Exposure Value" ) corresponds to doubling the exposure, and EXR
files are in linear light (not gamma-encoded), you would expect that you can double the pixel values in an EXR
file to add 1EV and halve them to do -1EV...由于 EV 的每个增量( “曝光值” )对应于加倍曝光,并且
EXR
文件处于线性光(未经过伽马编码),因此您可以期望您可以将EXR
文件中的像素值加倍以添加 1EV 并减半他们做-1EV...
So, I downloaded the Luxo
EXR file from here .所以,我从这里下载了
Luxo
EXR 文件。 Then I went into Photoshop and clicked:然后我进入 Photoshop 并点击:
Image -> Mode -> 8-bits/channel
and selected Method
= Exposure and Gamma
and set exposure=+1
and saved the resulting file as a JPEG
with +1
in its name.并选择
Method
= Exposure and Gamma
并设置exposure=+1
并将生成的文件保存为名称中带有+1
的JPEG
。 I repeated that for EV-3, EV-2, EV+0, EV+1, EV+2, EV+3.我对 EV-3、EV-2、EV+0、EV+1、EV+2、EV+3 重复了这一点。
I then looked at the resulting files with ImageMagick using commands like the following in the Terminal to examine the mean value of the combined RGB image:然后,我在终端中使用如下命令查看了ImageMagick生成的文件,以检查组合 RGB 图像的平均值:
magick identify -verbose image-EV+2.jpg
I then went about producing those same mean values, and found that the following works:然后我开始产生相同的平均值,并发现以下工作:
# To increase 1 EV
magick input.exr -evaluate multiply 2 result.jpg
# To increase 2 EV
magick input.exr -evaluate multiply 4 result.jpg
# To increase 3 EV
magick input.exr -evaluate multiply 8 result.jpg
And so on...等等...
So, I wrote a bash
script to do that as follows, which you could save in your HOME directory as adjust.sh
:因此,我编写了一个
bash
脚本来执行以下操作,您可以将其保存在您的 HOME 目录中为adjust.sh
:
#!/bin/bash
# Default file, if none specified
file=${1:-/Users/mark/Desktop/LuxoDoubleChecker.exr}
# Default EV of +1, if none specified
EV=${2:-1}
# Strip extension
base="${file%.*}"
# Apply given EV to file and save with new name
new="${base}EV${EV}.jpg"
echo "Applying EV $EV to $file, saving as $new"
magick "$file" -evaluate multiply $(bc -l <<< "2^$EV") "$new"
Then, just necessary once, make it executable:然后,只需一次,使其可执行:
chmod +x $HOME/adjust.sh
And then you run it like this to add +3EV to SomeImage.exr
:然后像这样运行它,将 +3EV 添加到
SomeImage.exr
:
~/adjust.sh SomeImage.exr 3
Sample Output样品 Output
Applying EV 3 to SomeImage.exr, saving as SomeImageEV3.jpg
Alternatively, if you save this script as allEVs.sh
, it will load the specified image just once and generate all 7 exposures in one go without re-reading the input EXR file 7 times:或者,如果将此脚本保存为
allEVs.sh
,它将只加载指定的图像一次并在一个 go 中生成所有 7 次曝光,而无需重新读取输入 EXR 文件 7 次:
#!/bin/bash
# Default file, if none specified
file=${1:-/Users/mark/Desktop/LuxoDoubleChecker.exr}
# Strip extension to get base without extension
base="${file%.*}"
magick "$file" \
\( +clone -evaluate multiply 0.125 -write "${base}EV-3.jpg" +delete \) \
\( +clone -evaluate multiply 0.25 -write "${base}EV-2.jpg" +delete \) \
\( +clone -evaluate multiply 0.5 -write "${base}EV-1.jpg" +delete \) \
\( +clone -evaluate multiply 1 -write "${base}EV-0.jpg" +delete \) \
\( +clone -evaluate multiply 2 -write "${base}EV+1.jpg" +delete \) \
\( +clone -evaluate multiply 4 -write "${base}EV+2.jpg" +delete \) \
-evaluate multiply 8 "${base}EV+3.jpg"
Please check carefully that this works correctly for you before basing a lifetime's analysis on it...在对它进行终生分析之前,请仔细检查它是否适合您...
Keywords : Image processing, HDR, High Dynamic Range, EXR, EV, Exposure Value, f-stop, stop, stops, exposure, increase, decrease, tone map, ImageMagick.关键词:图像处理、HDR、高动态范围、EXR、EV、曝光值、光圈、光圈、光圈、曝光、增加、减少、色调 map、ImageMagick。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.