HDR Image encoding formats

HDR图像编码存储格式总结
本文介绍了HDR图像的编码格式,包括RGBE、TIFF(LogLuv24、LogLuv32)和EXR。RGBE通过ldr值和exponent还原HDR颜色,TIFF的LogLuv利用Luminance和uv值存储,EXR则采用half浮点数存储。理解这些格式有助于掌握PBR和IBL中的HDR处理。

HDR图像的编码与存储是PBR、IBL中的一个重要问题。其主要是将scene-referred的颜色信息存储并保存后在渲染时进行使用,然后通过tone-mapping这样的操作将其映射到output-referred的R8G8B8的颜色值并输出到终端显示器上。当然,一般来说不需要直接存储并读取HDR图像,但如果要实现一些PBRT的效果或是一个自己的LightMap baker的话,那么HDR的存取就是必不可少的了。这里总结一下HDR的存储编码格式。

主要有以下三种格式:

  • HDR;对应的编码方式主要是RGBE/XYZE
  • TIFF;对应的编码方式主要是RGB/LogLuv24/LogLuv32
  • EXR;对应的编码方式主要是HalfRGB

1.    HDR格式

其编码方式为RGBE,即通过ldr的rgb值,配合一个该组值对应的exponent来还原最初的HDR颜色信息。在一个32bits的RGBE中,通常是R8G8B8E8的占位方式。假设场景中的原始scene-referred的颜色为RsGsBs,那么将其向RGBE的映射操作如下式所示:

codecHandlesFormat: no format, so no extra checks 2025-10-31 10:14:07.929 5301-5301 MediaCodecList com.tencent.yolov5ncnn D codecHandlesFormat: no format, so no extra checks 2025-10-31 10:14:07.938 5301-5349 CCodec com.tencent.yolov5ncnn D allocate(c2.goldfish.h264.decoder) 2025-10-31 10:14:07.942 5301-5349 ApexCodecsLazy com.tencent.yolov5ncnn I Failed to load libcom.android.media.swcodec.apexcodecs.so: dlopen failed: library "libcom.android.media.swcodec.apexcodecs.so" not found 2025-10-31 10:14:07.943 5301-5349 Codec2Client com.tencent.yolov5ncnn I Available Codec2 services: "default" "software" 2025-10-31 10:14:07.945 5301-5349 CCodec com.tencent.yolov5ncnn I setting up 'default' as default (vendor) store 2025-10-31 10:14:07.959 5301-5349 CCodec com.tencent.yolov5ncnn I Created component [c2.goldfish.h264.decoder] for [c2.goldfish.h264.decoder] 2025-10-31 10:14:07.965 5301-5349 CCodecConfig com.tencent.yolov5ncnn D read media type: video/avc 2025-10-31 10:14:07.972 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: algo.buffers.max-count.values 2025-10-31 10:14:07.975 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: output.subscribed-indices.values 2025-10-31 10:14:07.975 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: input.buffers.allocator-ids.values 2025-10-31 10:14:07.975 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: output.buffers.allocator-ids.values 2025-10-31 10:14:07.981 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: algo.buffers.allocator-ids.values 2025-10-31 10:14:07.981 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: output.buffers.pool-ids.values 2025-10-31 10:14:07.982 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D extent() != 1 for single value type: algo.buffers.pool-ids.values 2025-10-31 10:14:07.984 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D ignored struct field coded.color-format.locations 2025-10-31 10:14:07.986 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D ignored struct field resources.needed.values 2025-10-31 10:14:07.987 5301-5349 CCodecConfig com.tencent.yolov5ncnn D ignoring local param raw.size (0xd2001800) as it is already supported 2025-10-31 10:14:07.987 5301-5349 CCodecConfig com.tencent.yolov5ncnn D ignoring local param default.color (0x5200180b) as it is already supported 2025-10-31 10:14:07.987 5301-5349 ReflectedParamUpdater com.tencent.yolov5ncnn D ignored struct field raw.hdr-static-info.mastering 2025-10-31 10:14:07.992 5301-5349 CCodecConfig com.tencent.yolov5ncnn I query failed after returning 12 values (BAD_INDEX) 2025-10-31 10:14:07.993 5301-5349 CCodecConfig com.tencent.yolov5ncnn D c2 config diff is Dict { c2::u32 coded.pl.level = 20496 c2::u32 coded.pl.profile = 20481 c2::u32 coded.vui.color.matrix = 0 c2::u32 coded.vui.color.primaries = 0 c2::u32 coded.vui.color.range = 2 c2::u32 coded.vui.color.transfer = 0 c2::u32 default.color.matrix = 0 c2::u32 default.color.primaries = 0 c2::u32 default.color.range = 0 c2::u32 default.color.transfer = 0 c2::u32 input.buffers.max-size.value = 6291456 c2::u32 input.delay.value = 0 string input.media-type.value = "video/avc" c2::u32 output.delay.value = 8 string output.media-type.value = "video/raw" c2::u32 raw.color.matrix = 0 c2::u32 raw.color.primaries = 0 c2::u32 raw.color.range = 2 c2::u32 raw.color.transfer = 0 c2::u32 raw.max-size.height = 240 c2::u32 raw.max-size.width = 320 c2::u32 raw.pixel-format.value = 35 c2::i32 raw.rotation.flip = 0 c2::i32 raw.rotation.value = 0 c2::u32 raw.sar.height = 1 c2::u32 raw.sar.width = 1 c2::u32 raw.size.height = 240 c2::u32 raw.size.width = 320 c2: 2025-10-31 10:14:07.993 5301-5349 ColorUtils com.tencent.yolov5ncnn W expected specified color aspects (2:0:0:0) 2025-10-31 10:14:08.013 5301-5301 MediaCodec com.tencent.yolov5ncnn E Media Quality Service not found. 2025-10-31 10:14:08.016 5301-5348 SurfaceUtils com.tencent.yolov5ncnn D connecting to surface 0x7fb26d4de740, reason connectToSurface 2025-10-31 10:14:08.016 5301-5348 MediaCodec com.tencent.yolov5ncnn I [c2.goldfish.h264.decoder] setting surface generation to 5428225 2025-10-31 10:14:08.016 5301-5348 SurfaceUtils com.tencent.yolov5ncnn D disconnecting from surface 0x7fb26d4de740, reason connectToSurface(reconnect) 2025-10-31 10:14:08.017 5301-5348 SurfaceUtils com.tencent.yolov5ncnn D connecting to surface 0x7fb26d4de730, reason connectToSurface(reconnect-with-listener) 2025-10-31 10:14:08.021 5301-5349 CCodecBufferChannel com.tencent.yolov5ncnn I Using latch times for frame rendered signals - present fences not supported 2025-10-31 10:14:08.021 5301-5349 CCodec com.tencent.yolov5ncnn D [c2.goldfish.h264.decoder] buffers are bound to CCodec for this session 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for color-format 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for track-id 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for frame-count 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for language 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for display-width 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for csd-1 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for durationUs 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for display-height 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for native-window 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for native-window-generation 2025-10-31 10:14:08.022 5301-5349 CCodecConfig com.tencent.yolov5ncnn D no c2 equivalents for flags 2025-10-31 10:14:08.026 5301-5349 CCodecConfig com.tencent.yolov5ncnn D c2 config diff is c2::u32 coded.pl.level = 20494 c2::u32 coded.pl.profile = 20484 c2::u32 raw.size.height = 1296 c2::u32 raw.size.width = 2304 2025-10-31 10:14:08.032 5301-5349 Codec2Client com.tencent.yolov5ncnn W query -- param skipped: index = 1107298332. 2025-10-31 10:14:08.032 5301-5349 CCodec com.tencent.yolov5ncnn D client requested max input size 574215, which is smaller than what component recommended (6291456); overriding with component recommendation. 2025-10-31 10:14:08.032 5301-5349 CCodec com.tencent.yolov5ncnn W This behavior is subject to change. It is recommended that app developers double check whether the requested max input size is in reasonable range. 2025-10-31 10:14:08.032 5301-5349 CCodec com.tencent.yolov5ncnn D encoding statistics level = 0 2025-10-31 10:14:08.032 5301-5349 CCodec com.tencent.yolov5ncnn D setup formats input: AMessage(what = 0x00000000) = { int32_t height = 1296 int32_t level = 16384 int32_t max-input-size = 6291456 string mime = "video/avc" int32_t profile = 8 int32_t width = 2304 Rect crop(0, 0, 2303, 1295) } 2025-10-31 10:14:08.032 5301-5349 CCodec com.tencent.yolov5ncnn D setup formats output: AMessage(what = 0x00000000) = { int32_t android._color-format = 2135033992 int32_t android._video-scaling = 1 int32_t rotation-degrees = 0 int32_t color-standard = 1 int32_t color-range = 2 int32_t color-transfer = 3 int32_t sar-height = 1 int32_t sar-width = 1 Rect crop(0, 0, 2303, 1295) int32_t width = 2304 int32_t height = 1296 int32_t max-height = 240 int32_t max-width = 320 string mime = "video/raw" int32_t android._dataspace = 260 int32_t color-format = 2135033992 } 2025-10-31 10:14:08.033 5301-5349 CCodecConfig com.tencent.yolov5ncnn I query failed after returning 12 values (BAD_INDEX) 2025-10-31 10:14:08.033 5301-5349 CCodecConfig com.tencent.yolov5ncnn D c2 config diff is c2::u32 raw.max-size.height = 1296 c2::u32 raw.max-size.width = 2304 2025-10-31 10:14:08.041 5301-5349 Codec2Client com.tencent.yolov5ncnn W query -- param skipped: index = 1342179345. 2025-10-31 10:14:08.042 5301-5349 Codec2Client com.tencent.yolov5ncnn W query -- param skipped: index = 2415921170. 2025-10-31 10:14:08.042 5301-5349 Codec2Client com.tencent.yolov5ncnn W query -- param skipped: index = 1610614798. 2025-10-31 10:14:08.042 5301-5349 Codec2Client com.tencent.yolov5ncnn W query -- param skipped: index = 2684356609. 2025-10-31 10:14:08.043 5301-5349 C2Store com.tencent.yolov5ncnn D Using DMABUF Heaps 2025-10-31 10:14:08.047 5301-5349 CCodecBufferChannel com.tencent.yolov5ncnn D [c2.goldfish.h264.decoder#393] Created input block pool with allocatorID 16 => poolID 17 - OK (0) 2025-10-31 10:14:08.048 5301-5349 CCodecBufferChannel com.tencent.yolov5ncnn D [c2.goldfish.h264.decoder#393] Query output surface allocator returned 0 params => BAD_INDEX (6) 2025-10-31 10:14:08.050 5301-5349 CCodecBufferChannel com.tencent.yolov5ncnn I [c2.goldfish.h264.decoder#393] Created output block pool with allocatorID 18 => poolID 25 - OK 2025-10-31 10:14:08.051 5301-5349 CCodecBufferChannel com.tencent.yolov5ncnn D [c2.goldfish.h264.decoder#393] Configured output block pool ids 25 => OK 2025-10-31 10:14:08.052 5301-5349 Codec2-Out...ufferQueue com.tencent.yolov5ncnn D remote graphic buffer migration 0/0 2025-10-31 10:14:08.052 5301-5349 Codec2Client com.tencent.yolov5ncnn D setOutputSurface -- failed to set consumer usage (6/BAD_INDEX) 2025-10-31 10:14:08.052 5301-5349 Codec2Client com.tencent.yolov5ncnn D setOutputSurface -- generation=5428225 consumer usage=0x900 2025-10-31 10:14:08.059 5301-5349 Codec2Client com.tencent.yolov5ncnn D Surface configure completed 2025-10-31 10:14:08.060 5301-5349 DMABUFHEAPS com.tencent.yolov5ncnn I Using DMA-BUF heap named: system 2025-10-31 10:14:08.264 5301-5349 CCodecConfig com.tencent.yolov5ncnn D c2 config diff is c2::u32 raw.crop.height = 1296 c2::u32 raw.crop.left = 0 c2::u32 raw.crop.top = 0 c2::u32 raw.crop.width = 2304 2025-10-31 10:14:08.270 5301-5301 System.out com.tencent.yolov5ncnn I image == null!!!!!!!!!!! 2025-10-31 10:14:08.270 5301-5301 System.out com.tencent.yolov5ncnn I surfaceChanged!!!!!!!!!!!!!!! 2025-10-31 10:14:08.972 5301-5301 Choreographer com.tencent.yolov5ncnn I Skipped 41 frames! The application may be doing too much work on its main thread. 2025-10-31 10:14:08.979 5301-5325 HWUI com.tencent.yolov5ncnn I Davey! duration=954ms; Flags=1, FrameTimelineVsyncId=53495, IntendedVsync=2809136577648, Vsync=2809136577648, InputEventId=0, HandleInputStart=2809138486400, AnimationStart=2809138526700, PerformTraversalsStart=2809138583400, DrawStart=2809632751300, FrameDeadline=2809153244314, FrameStartTime=2809138462300, FrameInterval=16666666, WorkloadTarget=16666666, SyncQueued=2809633289100, SyncStart=2809838331200, IssueDrawCommandsStart=2809838546200, SwapBuffers=2809840024200, FrameCompleted=2810296163000, DequeueBufferDuration=454788300, QueueBufferDuration=351100, GpuCompleted=2810054319600, SwapBuffersCompleted=2810296163000, DisplayPresentTime=0, CommandSubmissionCompleted=2809840024200, 2025-10-31 10:14:09.027 5301-5301 InsetsController com.tencent.yolov5ncnn D hide(ime(), fromIme=false) 2025-10-31 10:14:09.027 5301-5301 ImeTracker com.tencent.yolov5ncnn I com.tencent.yolov5ncnn:87efbc8a: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN 2025-10-31 10:14:13.051 5301-5352 BufferPoolAccessor2.0 com.tencent.yolov5ncnn D bufferpool2 0x7fb23d4b7b78 : 6(37748736 size) total buffers - 4(25165824 size) used buffers - 0/6 (recycle/alloc) - 6/6 (fetch/transfer) 2025-10-31 10:14:13.051 5301-5352 BufferPoolAccessor2.0 com.tencent.yolov5ncnn D evictor expired: 1, evicted: 1
最新发布
11-01
Bio-Formats 是一个用于读取和写入多种格式的生物医学图像数据的开源库,它与 ImageJ 的集成使得用户能够方便地处理如 TIFF、DICOM 等在内的多维图像数据。以下是关于在 ImageJ 中使用 Bio-Formats 插件的一些相关信息: ### 安装方法 为了安装 Bio-Formats 插件,首先需要确保已经下载并安装了 ImageJ。可以从其官方网站获取适用于 Windows、MacOS 或 Linux 的版本[^3]。一旦 ImageJ 被正确安装到计算机上之后,可以通过以下步骤来安装 Bio-Formats 插件: 1. 启动 ImageJ。 2. 选择 `Help` > `Update...` 来打开更新管理器。 3. 在更新管理器中点击 `Manage update sites` 按钮。 4. 在弹出窗口中勾选 `Bio-Formats` 更新站点以添加该插件到可用更新列表中。 5. 返回更新管理器主界面,确认所有待安装/更新的组件后点击 `Apply changes` 开始安装过程。 完成上述步骤后,重启 ImageJ 应用程序使新安装的 Bio-Formats 插件生效。 ### 使用方法 安装完毕后,利用 Bio-Formats 功能非常直观。例如,当想要打开支持的文件格式时,只需通过标准的 `File` > `Open...` 对话框选择相应的图像文件即可;此时 ImageJ 将自动调用 Bio-Formats 来解析并加载所选文件中的图像数据。对于更高级的操作比如特定切片或通道的选择,则可以借助于 Bio-Formats 提供的专门对话框或者直接编写脚本代码实现[^1]。 此外,如果用户希望进行编程级别的开发工作,比如创建自定义插件或宏命令,那么了解如何使用 Java 编程语言结合 Bio-Formats API 进行操作就变得尤为重要了。这通常涉及到导入必要的类库以及调用相关的方法来访问图像元数据、像素值等信息。 ### 功能介绍 Bio-Formats 支持广泛的图像格式,并且能够处理包含多个时间点、Z 层次及颜色通道的数据集。这意味着研究人员可以在不转换原始数据的情况下直接分析复杂的显微镜图像序列。除此之外,它还提供了对 OME-TIFF 标准的支持,这是一种旨在促进科学图像数据交换的标准格式。借助这些特性,ImageJ 用户可以获得更加灵活高效的工作流程体验[^1]。 ```java // 示例:使用BioFormats读取图像的第一个切片 import loci.formats.ImageReader; import loci.formats.out.TiffWriter; import loci.formats.services.IFormatReader; public class ReadFirstPlane { public static void main(String[] args) { try { // 创建ImageReader实例 ImageReader reader = new ImageReader(); // 设置文件名 reader.setId("path/to/your/image.tif"); // 替换为你的图像文件路径 // 获取图像尺寸 int width = reader.getSizeX(); int height = reader.getSizeY(); // 读取第一个切片 byte[] pixels = reader.readPlane(0, 0, 0); // 参数分别为z, c, t // (这里可以添加保存或进一步处理像素数组的代码) } catch (Exception e) { e.printStackTrace(); } } } ``` 这段示例代码演示了如何使用 Bio-FormatsImageReader 类来加载指定路径下的图像文件,并从中提取第一个平面(即第一帧)的像素数据。请注意替换 `"path/to/your/image.tif"` 为实际存在的图像文件路径以便测试此段代码的功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值