- use inRange to make a binary mask from your image. (wherever your image is red, the mask should be white, else black)
- Mat.setTo() , using this mask, to update the color, wherever the mask is white.
(and yes, please forget about iterating over pixels in general, especially from java)