- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我已经开始使用 OpenEXR 加载 EXR 图像。我必须使用浮点类型获取 RGB 像素。
对于 RGB 图像,加载没有问题,使用以下代码:
ImfInputFile *iFile = ImfOpenInputFile(filename);
FrameBuffer fb;
const Header &iHeader = iFile.header();
bool hasRed = false, hasGreen = false, hasBlue = false;
bool hasY = false;
Box2i dw = iHeader.dataWindow();
int width = dw.max.x-dw.min.x+1;
int height = dw.max.y-dw.min.y+1;
for (ChannelList::ConstIterator it = iHeader.channels().begin(), ite = iHeader.channels().end(); it != ite; it++) {
if ((strcmp(it.name(), "R") == 0)) { hasRed = true; }
if ((strcmp(it.name(), "G") == 0)) { hasGreen = true; }
if ((strcmp(it.name(), "B") == 0)) { hasBlue = true; }
if (it.channel().type != HALF) {
HDR_LOG("Unable to open EXR file \"%s\" (unsupported data type %s)", filename, it.channel().type);
return (IEFileCantOpen);
}
}
if ((hasRed == true) || (hasGreen == true) || (hasBlue == true)) {
fb.insert("R", Slice(
Imf::FLOAT, (char*)((char*)image->data + (sizeof(float) * 0)),
sizeof(float) * 3,
sizeof(float) * width * 3,
1, 1,
0.0
)
);
fb.insert("G", Slice(
Imf::FLOAT, (char*)((char*)image->data + (sizeof(float) * 1)),
sizeof(float) * 3,
sizeof(float) * width * 3,
1, 1,
0.0
)
);
fb.insert("B", Slice(
Imf::FLOAT, (char*)((char*)image->data + (sizeof(float) * 2)),
sizeof(float) * 3,
sizeof(float) * width * 3,
1, 1,
0.0
)
);
iFile.setFrameBuffer(fb);
if (ReadImage(filename, iFile, dw.min.y, dw.max.y) == IEFileReadError) {
HDR_LOG("There was a generic error on loading the EXR image \"%s\". Image could be corrupted.", filename);
return (IEFileReadError);
}
image->unproc = 1;
return (IENoError);
} else {
char sChannels[2048] = { '\0' };
for (ChannelList::ConstIterator it = iHeader.channels().begin(), ite = iHeader.channels().end(); it != ite; it++) {
strcat(sChannels, it.name());
strcat(sChannels, " ");
}
HDR_LOG("Unable to open EXR file (unknown channels set: %s)", sChannels);
return (IEFileReadError);
}
}
但我想知道这个库如何解码/转换 Y-RY-GY 图像(亮度 + 色度 channel )并获取浮点 RGB 像素数据。
最佳答案
看看 Technical Introduction .有一个关于亮度/色度图像的部分。
似乎有三个 channel :Y(亮度,单独使用,用于灰度图像,或与 RY 和 BY 组合用于彩色图像。),RY,BY(亮度/色度的色度)。
有点像
fb.insert("Y" /* <- channel name */, Slice(...)
应该可以解决。
关于c++ - OpenEXR 图像加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2435642/
我已经开始使用 OpenEXR 加载 EXR 图像。我必须使用浮点类型获取 RGB 像素。 对于 RGB 图像,加载没有问题,使用以下代码: ImfInputFile *iFile = ImfOpen
在尝试执行 OpenGL SuperBible 第 5 版中的示例时,我遇到了很多问题。来自 Chapter09/hdr_bloom。 问题是由链接 OpenEXR 库引起的,所以我手动构建它们并用作
我正在尝试使用这个dataset要做Exposure Meging (Fusion)在Python中。数据集中的每个图像都有 OpenEXR可以下载的文件(我对此文件格式没有太多经验)。 我想从具有不
我正在尝试使用这个dataset要做Exposure Meging (Fusion)在Python中。数据集中的每个图像都有 OpenEXR可以下载的文件(我对此文件格式没有太多经验)。 我想从具有不
我尝试创建一个解决方案,允许我在 Java 中读取 OpenExr 图像并在 JOGL 中使用纹理的像素数据。因为 Java 中没有免费的 OpenExr 库(没有找到任何有效的东西),所以我的想法是
我正在尝试在windows7上使用mingw编译openexr。我收到此错误: main.cpp: In function 'int main(int, char**)': main.cpp:213:
GetPixels() 来自使用 FreeImage 库(96 位:3 x 32 位 IEEE 浮点)加载的 EXR 图像。这个想法是将像素数据转换为 QImage::Format_RGB888。 编
我正在尝试使用 cygwin 编译 OpenEXR,但我遇到了麻烦。 到目前为止我做了什么: cd ilmbase-X.X.X ./configure make make install make c
我在项目中使用 PyInstaller 3.3.1 和 OpenEXR 1.3.0。 我使用 --onefile 选项创建单个文件可执行文件。 这按预期工作: import sys if getatt
我在为包含 OpenEXR 定义的半类型的 Imf::Rgba 结构赋值时遇到问题。似乎存在与从 float 到 half 的转换有关的链接器错误。 Linking CXX executable gr
我正在尝试使用一个 channel 加载 OpenEXR 格式的深度图像,但是,我无法根据以下文档找出我需要使用的格式:http://www.openexr.com/documentation/Rea
我已经在我的 Mac 上使用 pip install openexr 成功安装了 openexr,但同样的命令在 Ubuntu 上失败了: OpenEXR.cpp:9:22: fatal error:
如果之前已经回答过这个问题,我深表歉意。我尝试了很多选择,但似乎无法解决我的问题。 我有一系列 OpenEXR 图像,我想将它们合并到 WebM 中并包含透明度。这是我的 ffmpeg 命令的基础知识
我执行了 npm install在 Mac 上的 gatsby js 目录中。 macOs 是大苏尔 版本是 11.4。 Gatsby 版本是 3.11.0 gatsby-plugin-sharp 版
我在使用 CMake 为 Windows 7 构建 OpenEXR 时遇到问题。 我正在按照描述的说明进行操作 here 我运行cmake命令后的cmd输出如下: Microsoft Windows
我是一名优秀的程序员,十分优秀!