替换iOS中特定颜色的图像 [英] Replace particular color of image in iOS

查看:508
本文介绍了替换iOS中特定颜色的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用其他用户选择的颜色替换图像的特定颜色。在替换图像颜色时,我想保持原始颜色的渐变效果。例如,请参阅附加的图像。


I want to replace the particular color of an image with other user selected color. While replacing color of image, I want to maintain the gradient effect of that original color. for example see the attached images.

我试过使用CoreGraphics&我成功取代了颜色。但替换颜色不能保持图像中原始颜色的渐变效果。

I have tried to do so with CoreGraphics & I got success to replace color. But the replacing color do not maintain the gradient effect of the original color in the image.

有人可以帮我吗? CoreGraphics是正确的方法吗?
先谢谢。

Can someone help me on this? Is the CoreGraphics is right way to do this? Thanks in advance.

推荐答案

我在我的图片之间进行了大量的色彩转换/混合/替换/交换项目并发现以下出版物非常有用,均由Erik Reinhard撰写:

I do a lot of color transfer/blend/replacement/swapping between images in my projects and have found the following publications very useful, both by Erik Reinhard:

  • Color Transfer Between Images
  • Real-Time Color Blending of Rendered and Captured Video

不幸的是我现在无法发布任何源代码(或图像),因为结果正在提交给即将举行的会议,但我已经实现了上述算法的变体,结果令人满意。我肯定会有一些调整(并且有点耐心)你可能会得到你想要的东西!

Unfortunately I can't post any source code (or images) right now because the results are being submitted to an upcoming conference, but I have implemented variations of the above algorithms with very pleasing results. I'm sure with some tweaks (and a bit of patience) you might be able to get what you're after!

编辑:

此外,真正的挑战在于分离不同的图片元素(例如隔离墙)。这与Photoshop的魔棒工具不同,后者显然需要大量的处理能力和复杂的算法(并且仍然不完美)。

Furthermore, the real challenge will lie in separating the different picture elements (e.g. isolating the wall). This is not unlike Photoshop's magic wand tool which obviously requires a lot of processing power and complex algorithms (and is still not perfect).

这篇关于替换iOS中特定颜色的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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