如何使图像具有尘土飞扬,颜色褪色的旧外观? [英] How to give an image an old, dusty appearance with faded colours?

查看:92
本文介绍了如何使图像具有尘土飞扬,颜色褪色的旧外观?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有旧画的图像.这些画很旧而且尘土飞扬,褪色了,如这里.

I have images of old paintings. The paintings are old and dusty with faded colours as shown here.

如何为任何图像赋予这种旧"外观?我找不到任何过滤器或openCV函数来实现这种外观?

How do I give any image this type of an 'old' appearance? I couldn't find any filters or openCV functions to achieve this type of look?

编辑:我的问题有所不同,另一个问题是使用棕褐色滤镜和颗粒效果解决了该问题.我不是在寻找那种外观.我希望我的图像看起来像一幅损坏的旧画.这意味着颜色应该褪色,并且应该具有整体多灰尘的外观.

EDIT: My question is different as the other one solves the problem using the sepia filter and using the grain effect. I'm not looking for that sort of an appearance. I want my image to look like an old damaged painting. This means that the colours should be faded and it should have an overall dusty appearance.

推荐答案

实际上不需要编写任何代码并使用 OpenCV ,因为您可以在命令行上使用 ImageMagick ,它已安装在大多数Linux发行版中,并且可用于macOS和Windows.

There's no real need to write any code and use OpenCV, since you can do all that on the command-line with ImageMagick which is installed on most Linux distros and is available for macOS and Windows.

首先,褪色.这可以通过降低图像的饱和度来模拟.因此,如果我们从蒙娜丽莎的这张图片开始:

First, fading. This can be simulated by reducing the saturation of an image. So if we start with this Mona Lisa image:

我们可以使用此命令淡化她,使亮度保持其原始值的100%不变,并将饱和度降低至其原始值的50%.我故意将所有内容都过度修饰" ,以便您可以清楚地看到它.您也许应该更加微妙.

We can fade her using this command to leave the brightness unchanged at 100% of its original value and reduce the saturation to 50% of its original value. I am intentionally "over-egging" everything so you can see it clearly. You should maybe be more subtle.

convert mona.jpg -modulate 100,50 result.jpg

下一步,渐晕-或暗角.您可以使用以下内容:

Next, vignetting - or dark corners. You can use something like this:

convert mona.jpg \
   \( +clone -fill white -colorize 100 -background "gray(50%)" -vignette 0x15+1+1% \) \
   -compose multiply -composite result.jpg

0x15控制滚降或更改的程度,因此,如果要平滑滚降,请增大0x15,如果要滚降更难,请降低到0x5. +1+1%表示椭圆将比图像的宽度小1%,比图像的高度小1%.因此,如果您想要较小的光孔和较大的暗角,请使用+10+10%.变暗的程度由gray(50%)控制,因此您可以对其进行微调,直到您也满意为止:-)

The 0x15 controls the roll-off, or how gradual the change is, so increase the 0x15 if you want a smoother roll-off or go down to 0x5 if you want it harder. The +1+1% means that the ellipse will be 1% smaller than the width of the image and 1% smaller than the height of the image. So if you want a smaller light hole and bigger dark corners, go for +10+10%. The degree of darkening is controlled by the gray(50%) so you can diddle with that till you are happy too :-)

最后是灰尘.最好的办法是获取一些灰尘的PNG图像,调整其大小以使其与图像的大小相匹配,然后将其覆盖.

Finally, dust. Best thing is to get a PNG image of some dust, resize it to match the size of your image and overlay it.

首先获取蒙娜丽莎的大小:

First get the size of Mona:

identify mona.jpg
mona.jpg JPEG 403x600 403x600+0+0 8-bit sRGB 57130B 0.000u 0:00.000

所以,她是403x600.这是一些灰尘的样本-再次,您可能会更微妙-我只是举手示意,所以它显示:

So, she is 403x600. Here is a sample of some dust - again, you can be more subtle - I am just being heavy-handed so it shows:

让我们调整灰尘的大小以匹配并覆盖它:

Let's resize the dust to match and overlay it:

convert mona.jpg \( dust.png -resize 403x600\! \) -composite result.jpg

然后,您可以将褪色,渐晕和灰尘这三种效果组合到一个命令中:

Then you can combine all three effects, fading, vignetting and dust, into a single command:

convert mona.jpg -modulate 100,50% \
   \( +clone -fill white -colorize 100 -background "gray(50%)" -vignette 0x15+1+1% \) \
  -compose multiply -composite     \
  \( dust.png -resize 403x600\! \) -composite result.jpg

如果要处理大量图像,则可以使用 GNU Parallel 非常轻松地并行编写全部脚本-请参阅我的其他一些答案作为示例.

If you have lots of images to process, you can script the whole lot to be done in parallel very easily with GNU Parallel - see some of my other answers for examples.

关键字::人工老化,图像老化,命令行,命令行,ImageMagick,magick,旧,旧照片,照片效果,转换,灰尘,划痕,褪色,褪色.

Keywords: artificial ageing, image ageing, command-line, command line, ImageMagick, magick, old, old photo, photo effect, convert, dust, scratches, fading, faded.

这篇关于如何使图像具有尘土飞扬,颜色褪色的旧外观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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