伽玛曲线实验——将 2.2 转换为 1.8 的相反数?
摩托罗拉 Photon 因表现出其他人所说的“黑色挤压”而臭名昭著——在查看图片时,图像黑暗部分的大部分细节都会被压平为黑色。到目前为止,几乎每个人都将其归咎于 Pentile 显示屏。然而,当我第一次看到这种效果时,我产生了一种不同的想法……“哇,这看起来和为 Windows 编码的图片在 Linux 和 Macintosh 上使用 1.8 伽玛时的样子一样(糟糕)。而不是 Windows 的 2.2" 标准。我的理论是,在这个过程中,摩托罗拉使用摩托罗拉还是 iPhone 之前的苹果合作伙伴时编写的旧库构建了 Photon 的 Android(或者可能是采用了假设 1.8 gamma 而不是 2.2 的旧开源代码)。
为什么我这么确定?几天前,我使用旧的 Epic 4G(三星 Galaxy S)和新的 Photon 对同一网页进行了屏幕截图。出乎意料的是,Epic 的屏幕截图 .png 看起来很正常,但 Photon 的屏幕截图 .png 在我的 PC 上查看时的外观与在 Photon 屏幕上查看时的外观完全相同。当我看到它的那一刻,我想起了我之前对伽玛映射 1.8-vs-2.2 可能存在的错误的想法,并决定尝试编写一个演示应用程序来向摩托罗拉展示并说服他们这是一个可以修复的真正错误。
我想做的一个实验是拍摄一张在明亮和黑暗区域都具有高动态范围和细节的 JPEG 图像,并将其重新编码为非标准伽玛,基本上是 1.8 和 2.2 之间差异的两倍。这个想法是,如果我故意将其错误编码为相反的极端(2.6?),然后在元数据中说它是 2.2,那么在光子上查看时它看起来会很正常(因为同样的错误将 2.2 压缩为 1.8)会将 2.6 压缩为适当的 2.2)。
那么,有两个问题:
如果 2.2 伽玛图像被解码为 1.8,那么什么伽玛值与您所得到的误差相等且相反? 2.6?
是否有任何简单的方法(免费的 Photoshop/gimp 插件、JPEG 编码库等)可以故意将源图像错误编码为非标准伽马?
The Motorola Photon is infamous for exhibiting what others have called "black crush" -- when viewing pictures, most of the detail in dark parts of the image is flattened out to black. Up to now, pretty much everyone has blamed it on the Pentile display. HOWEVER, the first time I ever saw the effect, a different thought occurred to me... "Wow, that looks the same (bad) way that pictures encoded for Windows used to look on Linux and Macintosh back when they used gamma of 1.8 instead of Windows' norm of 2.2". My theory is that somewhere along the line, Motorola built the Photon's Android using an old library written back when Motorola was a pre-iPhone Apple partner (or possibly, grabbed old open-source code that assumed 1.8 gamma instead of 2.2).
Why am I so sure? A few days ago, I did a screen capture of the same web page using both my old Epic 4G (Samsung Galaxy S) and my new Photon. Unexpectedly, the Epic's screen capture .png looked normal, but the Photon's screen capture .png had exactly the same bad appearance when viewed on my PC as it did when viewed on the Photon's screen. The moment I saw it, I remembered my earlier thought about a possible gamma-mapping 1.8-vs-2.2 bug, and decided to try and write a demonstration app to show Motorola and convince them that this is a real bug that CAN be fixed.
One experiment I'd like to do would be to take a JPEG image with high dynamic range and detail in both bright and dark areas, and re-encode it to a nonstandard gamma that's basically double the difference between 1.8 and 2.2. The idea is that if I intentionally mis-encode it to the opposite extreme (2.6?), then lie in the metadata and say it's 2.2, it will look normal when viewed on the photon (because the same error that crushes 2.2 down to 1.8 will crush 2.6 down to the proper 2.2).
So, two questions:
What gamma would be equal and opposite the error you'd get if a 2.2 gamma image were decoded as though it were 1.8? 2.6?
Is there any easy way (free Photoshop/gimp plug-in, JPEG encoding library, etc) to intentionally mis-encode a source image to that nonstandard gamma?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当伽玛应用于图像时,您从 [0.0-1.0] 范围内的线性值开始,并将它们提高到 1/gamma 次方,这给出的结果也在 [0.0-1.0] 范围内。对于 1.8 的 gamma,您将其提高 0.56;对于 2.2 的 gamma,您将其提高 0.45。
如果您应用了标准 2.2 伽马值,而需要 1.8 伽马值,则可以按两个校正因子的比率再次提高它:0.56/0.45 = 1.22。
由于像素值通常在[0-255]范围内,所以在转换之前需要除以255,转换完成后再乘以255。
我不确定 Photoshop 或 Gimp 是否可以简单地做到这一点;我知道 Paint Shop Pro 有一个命令。
与伽玛相关的任何内容的权威资源是 Charles Poynton 的伽玛常见问题解答。
When gamma is applied to an image, you start with linear values in the [0.0-1.0] range and raise them to the power of 1/gamma, which gives a result that is also in the [0.0-1.0] range. For a gamma of 1.8 you raise it by 0.56, and for a gamma of 2.2 you raise it by 0.45.
If you've applied a standard 2.2 gamma and you need a 1.8 gamma instead, you raise it again by the ratios of the two correction factors: 0.56/0.45 = 1.22.
Since pixel values are usually in the range of [0-255], you need to divide by 255 before the conversion and multiply by 255 when finished.
I'm not sure if Photoshop or Gimp can do this simply; I know Paint Shop Pro has a command for it.
The definitive resource for anything gamma related is Charles Poynton's Gamma FAQ.