I
I
Iwan2015-03-04 09:31:12
Image processing
Iwan, 2015-03-04 09:31:12

How to match two images through RGB color options?

Hello.
I have a question from a couch programmer, I got confused and I don’t understand in which direction I should look.
There is some image which is presented in RGB format, ie. I have three planar arrays with data [R], [G], [B]. The task is to overlay a pure white (red / purple / ...) background with a transparency of 30% on this image.
That is, if it is described with a graphical view
[one layer is the original image]
[second uniform white layer with 30% transparency]
The task is to do this with modifications to the RGB values, i. not in a graphical way, but by working with direct color data. The question is in the direction of which algorithm should I look?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrew, 2015-03-04
@OLS

The simplest formula in your case is:
R = front_R * 0.7 + back_R * 0.3
G = front_G * 0.7 + back_G * 0.3
B = front_B * 0.7 + back_B * 0.3
There are more complex algorithms

A
Adamos, 2015-03-04
@Adamos

School task. One side of the right-angled triangle is 100%, the other side is the delta (difference) between the value of the image color and the overlay color. We measure the desired percentage, draw a perpendicular to the percentage side until it intersects with the hypotenuse, determine its height, change the color value by this value.
Delta / 100% = Amount of change / Desired percentage.
Amount of Change = Delta * Desired Percentage / 100%.

I
Igor Ermolaev, 2015-03-05
@ErmIg

For each dot of each RGB channel:
Here it is assumed that we have 1 byte per channel. Transparency can be either the same for the entire image or vary from point to point.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question