Problems with using a rough greyscale algorithm?

前端 未结 7 2085
生来不讨喜
生来不讨喜 2021-02-06 20:43

So I\'m designing a few programs for editing photos in python using PIL and one of them was converting an image to greyscale (I\'m avoiding the use of

7条回答
  •  囚心锁ツ
    2021-02-06 20:52

    The images look pretty similar, but your eye can tell the difference, specially if you put one in place of the other:

    For example, you can note that the flowers in the background look brighter in the averaging conversion.

    It is not that there is anything intrinsically "bad" about averaging the three channels. The reason for that formula is that we do not perceive red, green and blue equally, so their contributions to the intensities in a grayscale image shouldn't be the same; since we perceive green more intensely, green pixels should look brighter on grayscale. However, as commented by Mark there is no unique perfect conversion to grayscale, since we see in color, and in any case everyone's vision is slightly different, so any formula will just try to make an approximation so pixel intensities feel "right" for most people.

提交回复
热议问题