R
R
researcher11112018-04-23 14:10:42
Python
researcher1111, 2018-04-23 14:10:42

Finding the smallest RGB value?

There is a black and white image, with various shades of gray. There is also an array with decoded RGB data for each pixel. Actually, a question. How to find the blackest pixel and the lightest one from an array?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-04-23
@Rsa97

A black and white image has two colors - black and white.
A grayscale image has one channel.
If you have three channels (RBG) - then this is a full-color image.
The brightness (or luminosity) of a point can be calculated using one of the formulas, depending on the color model:
L = 0.2126 * R + 0.7152 * G + 0.0722 * B
L = 0.299 * R + 0.587 * G + 0.114 * B
L = sqrt(0.299 * R * R + 0.587 * G * G + 0.114 * B * B)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question