# Remove overlapping red and green color

How to remove overlapping red and green color regions, leaving only red ones?

-
ImageApply might be useful –  ssch Oct 20 '13 at 21:52

This removes the "overlapping" areas, assuming the green area doesn't have holes exactly where the red is, leaving the red areas only outside the green area:

img = Import["http://i.stack.imgur.com/hSBJW.png"]
{r, g, b, alpha} = ColorSeparate[img];
n = Image[0*ImageData[r]];
rnew = ImageMultiply[ColorNegate@Closing[Binarize[g], 4], r]
ColorCombine[{rnew, n, n}]


This code simply removes the green:

rnew2 = ImageMultiply[ColorNegate@Binarize[g], r]
ColorCombine[{rnew2, n, n}]


-