问题描述
我有一组彩色/黑白图像,其中大多数具有不同的亮度和饱和度.
I have a collection of colored/black-white images and most of them have different levels of brightness and saturation.
How can I normalize those images to make them all at the same "**scale**"?
就我而言,某些图像可能还包含大量的白色像素,因为它们是对某些旧照片的扫描.
In my case, some of the images might also have a huge amount of white pixels as they are the scans of some old photos.
谢谢
推荐答案
很难在不看到图像的情况下提出非常具体的建议,但是一个想法可能是转到基于亮度和饱和度的色彩空间,然后再做在感兴趣的两个通道上进行自动伽玛校正.
It's hard to suggest anything very concrete without seeing your images, but one idea might be to move to a colourspace that is based on Brightness and Saturation and then to do an auto-gamma correction on the two channels of interest.
它可能会造成可怕的混乱,因此请先备份您的图像!
因此,我建议采取以下措施:
So, I am suggesting something along the lines of:
convert Original.jpg -colorspace HSL -channel B -auto-gamma -colorspace sRGB BrightnessNormalised.jpg
在我转到色调,饱和度和亮度" 色彩空间的位置,选择 Lightness
通道(这是第三个通道,因此它是 B
从 RG& B
中删除),并对 Lightness
进行自动伽玛处理,然后另存为经过亮度校正的sRGB JPEG.
where I move to "Hue, Saturation and Lightness" colourspace, select the Lightness
channel (it is the 3rd one so it is B
out of RG&B
) and do an auto-gamma of the Lightness
and save back as a brightness-corrected, sRGB JPEG.
同样,要标准化饱和度,您可以执行以下操作:
Likewise, to normalise the saturation, you could do:
convert Original.jpg -colorspace HSL -channel G -auto-gamma -colorspace sRGB SaturationNormalised.jpg
通过使用 -channel GB
,您可以同时执行以下两项操作:
And you could do both at once, by using -channel GB
like this:
convert Original.jpg -colorspace HSL -channel GB -auto-gamma -colorspace sRGB Normalised.jpg
对灰度图像进行饱和度归一化可能不是一个好主意,但需要进行一些测试.
Normalising the saturation is probably not a good idea for greyscale images but do some tests.
如果您有喜怒无常的低调照片或通风,明亮,高调的照片,则对图像的亮度进行归一化并不是一个好主意.挂上该备份-只需制作一个ZIP/压缩的tar球并将其保留即可.
Normalising the brightness of images is not really a good idea if you have moody, low-key photographs or airy, light, high-key photographs. Hang onto that backup - just make a ZIP/compressed tar-ball and keep it around.
这篇关于归一化图像亮度和饱和度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!