This is the code for highlighting differences in an image.
This is the resulting image it generates. ![enter image description here][1]
How do I get the green parts highlighted to disappear or be transparent. I only want the yellow present.
I'd suggest something like
if (diff != 0) {
r1 = g1 = 0xff;
}
This will make any differences be shown as solid yellow. Right now there's nothing to ensure that the output color will have any red in it (leaving it as pure green).
Edit: To remove all the green, not change it to the yellow, something like this should work:
if (diff != 0 && Math.abs(r1-r2)>=Math.abs(b1)) {
r1 = Math.abs(r1 - r2);
g1 = Math.abs(b1);
b1 = 0;
}
This will only mark the changes if the difference in reds is the same as, or larger than the amount of blue, so that the output will have at least as much red as green