restoring the image to its original colors

Started by alonsh, October 13, 2012, 08:38:53 AM

Previous topic - Next topic

alonsh

this is the image I photographed:
http://i.stack.imgur.com/AOYSI.jpg

before I photographed, I've added 3 circles to the image to be places in the image: the first circle is red with RGB of [255 0 0], the second is green circle with RGB of [0 255 0] and the third is blue [0 0 255]. Thus I can see the change about the pixels RGB average of each of them and fix the whole image by this change.

in order to restore the image, I do the next thing:

I have the RGB of the 3 circles, so I put this in a matrix:

mat1 = [255 0   0
        0   255 0
        0   0   255]
I have the average of the 3 circles after the photo.

assume that the average of the red circle changed to: [119 13 27].
the average of the green circle changed to [21 141 41]
and the average of the blue circle changed to [31 37 111].

I put that in a matrix:

mat2 = [119  13  27
        21   141 41
        31   37  111]

now I found the transformation matrix from mat2 into mat1, is called: tr_mat.
I have to pass each RGB pixel in the image and repair it by something like:

repaired_RGB_pixel = tr_mat^(-1) * RGB_pixel;
RGB_pixel = repaired_RGB_pixel;

Unfortunately, there are RGB pixels that become to RGB with a negative element, for example:
[122 -10 241].

how can I repair the minus in order to get the best result?

ninn

I guess you are looking for the "curves" functions in most picture editing softwares.
As far as I recall, those "over the edge"-Colors are capped, boundaries can be set and values can be amplified.
You can have a look at how it works at the open source program Gimp.

But judging your pictures, you are mainly missing light. The average of your circles is about half what it could have been, colorwise.

I'd play with the light first, and THEN change the curves.

ninn