Two raster images of the same size are given, the colors of which pixels are specified in the RGB color space with a color depth of 8 bits for each color coordinate: alt text The original image 2 was pasted on top of the original image 1 in a graphics editor that supports various blending modes. After that, four different layer blending modes were set for the layer with the original image 2. As a result, the following four images were obtained: alt text

It is known that the layer blending modes listed below were used. When each of these modes is used, the values ​​of the color coordinates R, G and B in the resulting image are calculated independently for each coordinate using the same formulas. In formulas, C1 stands for the value of the corresponding color coordinate in the source image 1, C2 is the value of this color coordinate in the source image 2, and Cr is the value of this color coordinate in the resulting image.

alt text

Determine which of the layer blending modes was used to obtain each of the above resulting images. In the answer specify four numbers in a row without spaces. First, the number in the list of the layer blending mode, which is applied to obtain the first resulting image, then the mode number used to obtain the second image, then the third and the fourth, respectively. Note: the values ​​of some colors on the images may differ from those obtained by the above formulas by several units.

Questions:

  1. How is the color coordinate value calculated in the image? (in the task it is C1, C2)
  2. How to argue in such tasks? (otherwise they constantly cause difficulty, I cannot navigate at all in these pixels, RGB ...)

Thanks in advance for the answer!

  • one
    I want to note that the question does not imply a solution to the problem for the author. Helping the author on these two questions is not a solution to the task for the vehicle. Anxiety is superfluous. - ReinRaus
  • Obviously the easiest method to test these blending equations is to view the places in the pictures where simple colors are mixed. For example, if you multiply Red (255,0,0) with Cyan (0,255,255), you get zero, that is black from this we conclude that Multiply is Var2_CR1.bmp. Not a very difficult task - igumnov
  • to my mind, 0 is black - Eugene536
  • Yes confused black with white fixed. The 10th task on this list is awesome. So I imagine a pack of unfortunate schoolchildren unfamiliar with regular expressions and mercilessly trying to solve it with another crutch. - igumnov
  • one
    @igumnov Tell me, please, how to solve the 10th problem with regular expressions. Although I am a supporter of parsing text with regular expressions, but in option 1, I only think of a byte address scan with an error counter. Thank you in advance. - ReinRaus

1 answer 1

The color coordinate in this case is the color of the pixel (dots in the image), represented in the RGB format. This format represents all colors as a mixture of red (R), green (G) and blue (B) colors in different proportions. The share of each color is given by a number from 0 to 255. Example: RGB (255, 0, 0) - red, RGB (255, 255, 0) - yellow, RGB (0, 255, 255) - light green, RGB (255, 255 , 255) - white, RGB (0, 0, 0) - black. Try to pick colors in Paint in the expanded palette and see which RGB values ​​correspond to which color. The rest is a matter of technique. In picture 2, the colors are clearly defined: (0, 255, 255) and (255, 0, 255). In the first picture you take a point where the color is determined quite accurately (for example, a point of pure red color), and then you substitute each component separately into formulas and get the color of the resulting pixel. Looking for a match on the resulting images. You may have to take several points in the first picture to uniquely determine the correspondence.

  • Well, look, I personally did not understand how this thing will work (255 - C1), i.e. take RGB (0, 255, 255) - light green, from the second picture, and take RGB (255, 0, 0) - red, from the first picture, substitute them into formula 4 and get the color RGB (255,255,255) - white, m. e. 4 - Var2_cr4, but the answer indicates another correspondence - Eugene536
  • Count more carefully. For each component, the condition is re-evaluated. Red: C1 = 255, C2 = 0. C1> 128 => Cr = 255 - (255 - 255) * (255 - 0) / 127 = 255. Green: C1 = 0, C2 = 255. C1 <128 => Cr = 0 * 255/128 = 0. Blue: C1 = 0, C2 = 255. C1 <128 => Cr = 0 * 255/128 = 0. It turns out (255, 0, 0), this is the second or third picture. - fori1ton
  • the first picture is multiply, the second color dodge, the third overlay, the fourth screen. cool task. - Yura Ivanov
  • and understood everything! thanks - Eugene536
  • See, but we take 2 and 3 the resulting image and 3 and 4 formula. we substitute red for the formulas (rightmost for 1 image), take lime (top color for 2 images), substitute into formulas and get red in both cases (255, 0, 0), recheck more than once, but for 2 the image turns yellow! help so? what could be wrong? - Eugene536