1

Topic: Color, brightness, visibility...

For a long time searched for formulas for operation with color;
Probably badly searched, but and did not come to simple and clear formulas;
In which it would be possible to expose available ( R, G, B )
And to change their values, type - color, brightness, visibility .
Therefore tried to write the in this program...
the Program (formulas - in a window, from below on center "to leave a tick on - to change color RGB")
With the code I am on friendly terms badly, all brakes and  swear.
Someone can knows normal "formulas"?
Thankful in advance...

2

Re: Color, brightness, visibility...

3

Re: Color, brightness, visibility...

From Google:
Brightness (standard for certain color spaces): (0.2126*R + 0.7152*G + 0.0722*B)
Luminance (a variant 1): (0.299*R + 0.587*G + 0.114*B)
Luminance (a variant 2, more slowly for calculation): sqrt (0.241*R^2 + 0.691*G^2 + 0.068*B^2) or
sqrt (0.299*R^2 + 0.587*G^2 + 0.114*B^2)
Judging by arguings, 3rd formula the most exact.
Remaining formulas find in Google.

4

Re: Color, brightness, visibility...

It is a new virus such - through docx it is spread?

5

Re: Color, brightness, visibility...

GraphUtil. ColorRGBToHLS
GraphUtil. ColorHLSToRGB

6

Re: Color, brightness, visibility...

d7i;
Well here I will substitute the values R, G, B in this formula
"sqrt (0.299*R^2 + 0.587*G^2 + 0.114*B^2)"
And how to make brightness it is more, less?

7

Re: Color, brightness, visibility...

Kazantsev Alexey;
Not a program method, and by means of formulas

8

Re: Color, brightness, visibility...

schi;
After downloading  the document, at it the format is for some reason lost.
In file name I add.docx and then opens.

9

Re: Color, brightness, visibility...

I am sorry,  the document in the form of the image tried to load.: \
to Change color (R, G, B)

10

Re: Color, brightness, visibility...

_333 wrote:

Not a program method, and by means of formulas

Look at implementation of these methods, there and you will find formulas.

11

Re: Color, brightness, visibility...

_333 wrote:

d7i;
Well here I will substitute the values R, G, B in this formula
"sqrt (0.299*R^2 + 0.587*G^2 + 0.114*B^2)"
And how to make brightness it is more, less?

We calculate current brightness:
Y=sqrt (0.299*R^2 + 0.587*G^2 + 0.114*B^2);
The changed brightness (increased by coefficient):
Y1=K*sqrt (0.299*R^2 + 0.587*G^2 + 0.114*B^2);
Value Y1 is known to us.
We calculate new values RGB and it is installed them.
As faster and more precisely to calculate - search in Google.
There all is, only to search it is necessary to be able.
From itself: in the given task it will be easier to work through HLS-model, instead of RGB.
Formulas of conversions of models find in the Internet. At the same time study a question on color in general.
There not all so is simple...
Create.

12

Re: Color, brightness, visibility...

_333 wrote:

For a long time searched for formulas for operation with color;
Probably badly searched, but and did not come to simple and clear formulas,

Whether it was necessary to esteem Wikipedia that....

13

Re: Color, brightness, visibility...

d7i wrote:

Judging by arguings, 3rd formula the most exact.

it is doubtful very much.
All formulas - that other, as adaptation attempt under psychophysis of human sight. And there all should be linear, the Euclidean metrics there is no place to undertake.

14

Re: Color, brightness, visibility...

Boris wrote:

it is passed...
In resulted formulas the Euclidean metrics there is nothing. It is purely empirical approach. It is possible to spank and still formulas:

function RGBMultiLuminance (Color: TColor; Mode: Byte): integer;
begin
with LongRec (ColorToRGB (Color)) do
case Mode of
//Fast R: = Round (0.299 * Bytes [0] + 0.587 * Bytes [1] + 0.114 * Bytes [2]);
0: Result: = (306 * Bytes [0] + 601 * Bytes [1] + 117 * Bytes [2] + 511) shr 10;
//Fast R: = Round (0.2126 * Bytes [0] + 0.7152 * Bytes [1] + 0.0722 * Bytes [2]);
1: Result: = (3483 * Bytes [0] + 11718 * Bytes [1] + 1183 * Bytes [2] + 8191) shr 14;
//Slow function
2: Result: = Round (SqrtX (0.299*Bytes [0] *Bytes [0] + 0.587*Bytes [1] *Bytes [1] + 0.114*Bytes [2] *Bytes [2]));
//Slow
3: Result: = Round (SqrtX (0.241*Bytes [0] *Bytes [0] + 0.691*Bytes [1] *Bytes [1] + 0.068*Bytes [2] *Bytes [2]));
//Slow
4: Result: = Round (SqrtX (0.2126*Bytes [0] *Bytes [0] + 0.7152*Bytes [1] *Bytes [1] + 0.0722*Bytes [2] *Bytes [2]));
//the Slow specified
5: Result: = Round (SqrtX (0.312161399548533*Bytes [0] *Bytes [0] + 0.612838600451467*Bytes [1] *Bytes [1] + 0.075*Bytes [2] *Bytes [2]));
//the Slow specified
6: Result: = Round (SqrtX (0.322285553*Bytes [0] *Bytes [0] + 0.632714447*Bytes [1] *Bytes [1] + 0.045*Bytes [2] *Bytes [2]));
//the Slow specified
7: Result: = Round (SqrtX (0.31*Bytes [0] *Bytes [0] + 0.639*Bytes [1] *Bytes [1] + 0.051*Bytes [2] *Bytes [2]));
else
Result: = (306 * Bytes [0] + 601 * Bytes [1] + 117 * Bytes [2] + 511) shr 10;
end;
end;

I, for example, in practice for specification of coefficients used a method of minimum contrast with gray, the calculated which brightness is equal to the calculated brightness of initial color (the calibrated screen is necessary). (For some reason it is impossible to interpose a picture).
Not to puzzle, for brightness change in percentage function ColorAdjustLuma (external ' Shlwapi.dll ', for examples look on the Internet) quite approaches.

15

Re: Color, brightness, visibility...

Visibility cannot be applied to color, if that. Visibility is a relation of brightness, at least, two colors. About a shade and brightness already told - them differently conveniently to change in HLS

16

Re: Color, brightness, visibility...

N wrote:

In resulted formulas the Euclidean metrics there is nothing. It is purely empirical approach.

But you to it use when square, add and derive a root. It is applicable for measurement of distances but at all does not correspond to a principle of operation of the visual analyzer (it is arranged rather difficult, therefore simple linear formulas too badly work).

17

Re: Color, brightness, visibility...

Here now Uchenik_333, probably, already understood in what it walked smack...
Operation with color and its characteristics not so simple. There not only some models, but still
And the heap of color profiles needs to be used with reference to the target device and assignment.
It is enough to look at all this kitchen, for example, in a photoshop that it will be convinced that far not  the task;
Which is reduced to pair formulas...

18

Re: Color, brightness, visibility...

19

Re: Color, brightness, visibility...

schi wrote:

Visibility is a relation of brightness, at least, two colors

N wrote:

a method of minimum contrast with gray

What not so?:-Q

20

Re: Color, brightness, visibility...

Boris wrote:

it is passed...
But you to it use when square, add and derive a root. It is applicable for measurement of distances but at all does not correspond to a principle of operation of the visual analyzer (it is arranged rather difficult...).

In the plan of physics like norms, it not the distance, is energy. At each color the range of lengths of waves and accordingly energy. All question in normalizing coefficients and their adjustment in respect of physiology of a human eye

21

Re: Color, brightness, visibility...

kealon (Ruslan);
Energy - a scalar, and the formula explicitly for vectors.
, the correct formula nevertheless linear, but with variables  which depend on a point white (white point), and it too can float.

22

Re: Color, brightness, visibility...

Sokolinsky Boris;
It yes, but at each color the energy, and a spectrum on colors also is a vector

23

Re: Color, brightness, visibility...

Boris wrote:

kealon (Ruslan);
The correct formula nevertheless linear, but with variables  which depend on a point white (white point), and it too can float.

As a matter of fact, you speak about the relative gray color with the maximum brightness (the term not so approaches) for the given source (monitor). About dependence on a point white I agree, but, unfortunately, I did not manage to reduce with comprehensible accuracy known linear functions with a visual comparative estimation of appropriate gray color. My experience yielded opposite result. It was possible to reduce square functions (energetic or ) much faster. So I agree with kealon.

Posts [ 23 ]

Pages 1

You must login or register to post a reply