D
D
Dmitry Bashinsky2018-10-23 13:36:27
C++ / C#
Dmitry Bashinsky, 2018-10-23 13:36:27

How to get gray (gray) percentage?

Hello.
I converted a color image to white with grayscale and now I need to get the percentage of grayness of the pixel, where 0 is white, 100 is black. There are no problems with obtaining color, it is the conversion from RGB to grayness that is of interest.
colorgray.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bask, 2018-10-23
@BashkaMen

R=G=B, so you can take any component, for example, R.
Range is from 0 to 255.
Normalize: percent = 100.0 * (R / 255.0);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question