How do I determine if a color is closer to white or black?

前端 未结 4 1600
别那么骄傲
别那么骄傲 2021-02-01 07:26

I am dealing with images and would like to determine if a set of pixels are closer to white or black.

So given a set of colors/pixles, how does one det

4条回答
  •  深忆病人
    2021-02-01 07:30

    • Convert the colour to grayscale (a grayscale colour has all 3 RGB components equal, see convert color image to grayscale).

    • Check if grayscale is closer to black (0) or white (255)

提交回复
热议问题