I'm working on a image manipulation. I have a problem I'm dealing with it, I didn't get any results. I need an algorithm to detect inverted colors.
As in the example photo below, I need to find and fix the inverted colors:
Currently I'm trying to find solution with using Java and C# .
I get the best closest result with this method. I convert the image to invert and two image compare with pixel-by-pixel. 70% success.
public static Color getTrueColor(this Color t, Color m)
{
int[] a = { t.R, t.G, t.B };
int[] b = { m.R, m.G, m.B };
int x = (int)a.Average();
int y = (int)b.Average();
return x < y ? m : t;
}
Thanks in advance for every help and suggestion.