I am trying to compare black&white scans (for starters, only 3 of them) of identical size. I want to highlight the similarities and differences by displaying the first one in red, the second one in blue, the third one in green. When black pixels overlap, the color change should reflect if the pixel is common among 1-2, 1-3, 2-3 or 1-2-3.
My first try is this:
bw1 = Binarize@Graphics[{Disk[]}, PlotRange -> {{-3, 1}, {-2, 2}}];
bw2 = Binarize@Graphics[{Disk[]}, PlotRange -> {{-2, 2}, {-2, 2}}];
bw3 = Binarize@Graphics[{Disk[]}, PlotRange -> {{-2.5, 1.5}, {-3, 1}}];
ColorCombine[{bw1, bw2, bw3}, "RGB"]
It's the idea, but I don't like the colors: I would like the original circles to be red-blue-green and the overlaps to be yellow, magenta, cyan for partial overlaps or black for full overlap. So I tried this instead:
ColorCombine[1 - {bw1, bw2, bw3}, "RGB"]
Now I am happy with the colors, but I have a problem with the background (exterior of all circles) and the central overlap (intersection of the 3 circles): I would like the intersection to be black and the background to remain white.
I am stuck there.
My secondary question is to scale the problem up. Is there an elegant way to do the same thing with N black&white images instead of 3 ? one would specify that the black parts of image number j should be mapped to some color c[j], the background should stay white, all overlaps should be some interpolation between the corresponding colors and black would only denote a full overlap (black pixel among all N images).
All suggestions for that problem are welcome too.
PS. It is my first project with image processing... but you probably had guessed ;-)
ColorReplace[..., {White -> Black, Black -> White}]
. The result looks really weird to me, but it's what you asked for. // By the way yourColorCombine[1 - {bw1, bw2, bw3}, "RGB"]
gives me an error butColorNegate@ColorCombine[{bw1, bw2, bw3}, "RGB"]
works. $\endgroup$