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

前端 未结 4 1703
别那么骄傲
别那么骄傲 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:54

    Take a look at YCbCr. Since Java and most computer processes colors in RGB format, you will need to do some conversion from RGB to YCbCr. There are many formulas to convert RGB to YCbCr.

    Once you get the YCbCr value, you can check the luminance value (the value Y in YCbCr).

提交回复
热议问题