Given your sample image, here two versions, depending of what you want exactly
Version 1:
Mat image = imread("woman.jpg", 0); //read grayscale version of image (1-channel)
cvtColor(image, image, CV_GRAY2BGR); //rgb version, r=g=b
Scalar color = Scalar(0, 0, 255); //define desired color
Mat mask = Mat(image.rows, image.cols, CV_8UC3, color); //create a mask of such color
Mat result;
addWeighted(image, 0.5, mask, 0.5, 0, result, CV_8UC3); //weights can be adjusted to needs
Version 2:
Mat image = imread("woman.jpg", 1); //read color version of image (3-channel)
Scalar color = Scalar(0, 0, 255); //define desired color
Mat mask = Mat(image.rows, image.cols, CV_8UC3, color); //create a mask of such color
Mat result;
addWeighted(image, 0.5, mask, 0.5, 0, result, CV_8UC3); //weights can be adjusted to needs
Results (original/version1/version2):
A sample image would be helpful...
a sample image is : http://www.eugeniocorrao.it/wp-conten...