1 | initial version |
you can replace
circle(srcImg, Point(j,i), 3, Scalar(0, 0, 128,128));
with
srcImg.at<Vec3b>(i, j) = srcImg.at<Vec3b>(i, j) - Vec3b(100, 100, 0);
but i prefer the way below
#include<opencv2/core.hpp>
#include<opencv2/imgproc.hpp>
#include<opencv2/highgui.hpp>
using namespace cv;
int main(int argc, char** argv)
{
Mat srcImg = imread("image.png");
Mat mask = imread("mask.png", IMREAD_GRAYSCALE) > 200;
Mat red;
cvtColor(mask, red, COLOR_GRAY2BGR);
red = (red - Scalar(0, 0, 255)) / 2;
srcImg = srcImg - red;
imshow("image", srcImg);
waitKey();
return 0;
}