# It is possible to know how much of a given color is Required to If you come to another color with OpenCV?

My question was a bit confusing. I'll explain the situation.

I have 1 color, which is the result of mixing other 4 colors.

Since I am new to the forum, I can not Attach the image in that question, But it can be accessed from this link ->

The image that is in the link, shows that the color that a color was Formed by the mastrura of 4 other colors.

Knowing that colors are fluid, and that The amount of fluid used to obtain the new color are the following:

### 1st Situation

Tio2 - 2kg of fluid

GG - 0.2kg of fluid.

A407 - 0.3kg of fluid.

Yellow - 1kg of fluid.

Color generated by the 1st situation:

### Caution: above values are fixed.

I want to create your whole situation:

Suppose the person responsible for producing the color uses the values below

### 2nd Situation

Tio2 - 1.5 kg of fluid

GG - 0.2 kg of solid.

A407 - 0.3 kg fluid.

Yellow - 0.5 kg of fluid.

Color generated by the 2nd situation: ->

**Note: Note that the values used for Ti02 and yellow have changed.**

The values that should be used were the 1st situation.

Tio2 - 2 kg of fluid

GG - 0.2 kg of solid.

A407 - 0.3 kg fluid.

Yellow - 1 kg of fluid.

**The result we already know:**
The mixture of the 2nd situation will have a completely different color from the 1st situation,
As the images show.

*Comparison between the two images*

## Now we are ready for the question:

The two images will be placed side by side:

I would like to know if analyzing the images using OpenCV it is possible to identify, Which should be added:

0.5 kg of Thio 2 fluid

and

0.5 kg of yellow

The example is in image 4

I do not know if it was well explained.

If anyone can help me, then I need to develop an application that is able to make that comparison and give me that result.

Thanks

I think it's a linear algebra problem. have you try to solve it ?

That looks like 4 variables and three measurements (RGB). You're going to need more information at best.

What's more, you need to make sure that the way they mix is linear. IE: that adding 0.5 yellow always makes the same change in color even if the amount already there is 0.5 or 2.

@LBerger I had not thought of this possibility, of a solution with linear algebra. Do you think this is possible? I do not know if it is possible to solve it that way.

There are some problems that I did not list.

Considering that the same colors were used to make the blends.

I have a color pattern. Where all blends are compared to this pattern. The intention is that all mixtures come out of the same color, logically using the same amount of fluid. But because of chemical and physical reactions, the result does not go as expected. There is a slight variation in color.

I would like to develop a way to calculate the value of this color variation and indicate what color is required to make my mix equal to the default.

Is it possible to solve with linear algebra?

Thanks for your help.

@Tetragramm Thanks for your response, it was very helpful. That's just the idea.

Yes the way to mix is "linear".

But there are some problems that I will not list.

1 - I own a *standard of color *

2 - I always use the same amount of fluid to perform the mixing.

3 - I need to compare my mix to the color pattern.

4 - Consider that I always use the same amount for the mix. Yes, if it is always the same quantity, the colors should always be the same. But by chemical and physical factors, the mixtures may or may not undergo a slight variation in color.

5 - *I need to compare the two blends by means of photography.

6 - If the colors are the same, or are within an acceptable limit, I must say that the colors are the same.

@Tetragramm

7 - If the colors are different, I need to calculate this difference, and tell what color is needed to correct that difference.

Note: This process of color analysis is done by people, but I would like this analysis done by the computer.

Thanks for your help.