Probably your problem is that each channel is not normalized (has a different dynamic range).
Regarding your question: Yes. If you know your desired image than all you need to find is 3 constants for multiplications (one for each channel). If your image is of size 100x100 than you have 10,000 linear mathematical equations with 3 unknowns. This is easily solvable. In fact you only need 3 pixels to generate 3 equations, solve them an retrieve your constants. The standard solution is min square error achieved by SVD (singular value decomposition).
If you don't know your desired image than a quick and dirty way would be just re-normalize each of the 3 channels before you concatenate them to RGB.
For example: img1. Find the minimal and maximal values (denoted by min,max) and change every value of the pixel to (v-min)/(max-min)*255
. Do that for each of the 3 channels and than concatenate. This will solve the problem that you are experiencing where the dynamic range of each channel is different. However this is not the perfect solution. It works OK for natural images but may produce wrong results when the white balance in the image is offset (images of sun-set, sun-rise, swimming pools, vegetation, etc).
image1
,image2
andimage3
you're using look like, so we're free to define them as we wish. How did you obtain these images? Are they all identical? And no, there is not, in general, a way to recover color information from a grayscale image. – beakerimage1
,image2
, andimage3
are. It is impossible to reconstruct your problem and diagnose on how to solve it when you have provided little to no information other than the fact that you have those three images defined. Also, going from grayscale to the original colour image is impossible. You are going from a 1 dimensional problem to a 3 dimensional problem, which is completely unconstrained. There are many colours that satisfy one grayscale intensity, as going from colour to grayscale is a weighted sum of three components. – rayryeng