如何在iOS应用中从Adobe Lightroom重现高光和阴影效果 [英] How to reproduce Highlights and Shadow effects from Adobe Lightroom in iOS app

查看:99
本文介绍了如何在iOS应用中从Adobe Lightroom重现高光和阴影效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的iOS应用程序中重现Adobe Lightroom效果.目前,我对所有效果都使用 GPUImage ,但是发现很难重现高光"和阴影"效果.另外,我已经尝试过使用CIFilter中的 CIHighlightShadowAdjust ,但是它给我错误的结果.

I'm trying to reproduce Adobe Lightroom effect in my iOS application. Currently I'm using GPUImage for all effects, but found difficult to reproduce Highlights and Shadow effects. Also I already tried to use CIHighlightShadowAdjust from CIFilter but it gives me wrong result.

因此,我正在寻找至少由Lightroom用于此效果的算法.它们两者都与亮度更改非常相似,但是看起来它们仅用于更改图片的明暗部分,具体取决于是否使用了高光或阴影.

So I'm looking for at least algorithm which is used by Lightroom for this effects. They both are very similar to Brightness change, but seems like they are used to change only light/dark parts of picture, in depends if Highlights or Shadows was used.

任何人都可以指出正确的方向来实现相同的效果吗?如何仅更改图片的暗/亮部分的亮度?

Can anyone point in a right direction what I need to look to make same effects? How it is possible to change brightness only for dark/light part of picture?

这里是例子1.左为原始图像,右为具有+100高光调整的图像(可能的范围是-100; 100,默认设置为0).

Here is examples 1. Left is original image and right is an image with +100 highlights adjustment(possible range -100;100 with 0 as default).

您可以看到天空(图像的较亮部分)具有不同的亮度,但是雕像几乎没有变化.

You can see that sky(lighter part of image) has different brightness, but statue is almost has not changed.

  1. 左为原始图像,右为具有+100阴影调整的图像(可能的范围是-100; 100,默认值为0).

在这里您可以看到雕像(图片的较暗部分)的亮度变化很大,但天空几乎没有变化.

Here you can see that statue(darker part of picture) has big changes in brightness, but sky remain almost without changes.

推荐答案

似乎已应用了非线性亮度变换.例如,突出显示效果可能意味着仅图像的较亮部分具有更高的亮度,而阴影调整可能意味着图像的较暗部分具有更高的亮度.

It looks like a nonlinear brightness transform has been applied. For example, the highlighting effect could mean that only the brighter parts of the image have even more increased brightness and the shadow adjustment could mean that the darker parts of the image have increased brightness.

一般方法是

  • 将RGB图像数据转换为以亮度为单独维度的色彩空间,例如HSL或CIELAB.
  • 使用一个连续且单调增加但限制在允许值范围内的单个转换函数,以像素方式转换亮度/亮度/亮度.这类似于非线性拉伸或压缩亮度直方图.
  • 用转换后的亮度替换原始亮度.
  • 转换回RGB颜色空间.

亮度转换函数的一个特征是它通常仅拉伸或压缩一定的亮度范围(在示例图像中可以很好地显示出来).通常,这不仅仅需要一个参数(您需要定义受影响的直方图的范围以及强度).看来Adobe具有一些启发式的功能,即将其视为阴影,并将其视为高光(可能是亮度直方图的平均值)作为截止值,而仅提供强度作为参数.

A characteristic of the brightness transformation function is that it typically only stretches or compresses a certain brightness range (you show that nicely in the example images). This requires typically more than only a single parameter (you would need to define the range of the histogram that is affected as well as the strength). It looks like Adobe has some heuristics what it regards as shadows and what it regards as highlights (maybe the mean of the brightness histogram) as cut-off and only offers the strength as parameter.

转换的确切形状也取决于您自己的口味.我玩了一些

The exact shape of the transformation is also up to your own taste. I played around a bit

看起来像您可以使用的突出显示的突出显示部分(转换为CIELAB,Ligthness L从0-100开始)是分段线性函数:

Highlighting that looks similar to your hightlighting I can get with (transformed to CIELAB and Ligthness L goes from 0-100) a piecewise-linear function:

a = 1.5
b = 50
L(L>b)=a*L(L>b)-(a-1)*b

与您的阴影增强效果相似的阴影增强效果,我可以通过指数衰减的增强得到.

Shadow enhancement that looks similar to your shadow enhancement I can get with an exponentially decaying enhancement.

a = 4;
b = 20;
L = ((a-1)*exp(-L/b)+1) * L;

您看到我总是需要至少两个参数,并且我确信一个参数可以找到更好的转换函数,但是结果强烈表明,实际上,这无非是一个可以在iOS中复制的亮度转换.应用程序.尝试使用不同的转换函数可能会更好地了解什么是好的,什么不是.

You see that I need always at least two parameters and I'm convinced that one could find better transformation functions, but the results strongly suggest that in essence it's nothing more than just a brightness transformation, which can be reproduced in an iOS app. Playing around with different transformation functions might give a better feeling of what is good and what is not.

这篇关于如何在iOS应用中从Adobe Lightroom重现高光和阴影效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆