Hello,
I would like merge two color images with an image mask.
img1 and img2 are color image with 3 channels mask is grey image with 1 channel
for merge the two image with the mask I do a loop for each pixel.
float coef1,coef2;
for(int j = 0; j < img1.rows ; j++ ){
for(int i = 0; i < img1.cols ; i++ ){
coef1 = (greyGoodScale.at<uchar>(j, i))/255.0;
coef2 = 1-coef1;
img.at<Vec3b>(j, i)[0] = coef2*img1.at<Vec3b>(j, i)[0] + coef1*img2.at<Vec3b>(j, i)[0];
img.at<Vec3b>(j, i)[1] = coef2*img1.at<Vec3b>(j, i)[1] + coef1*img2.at<Vec3b>(j, i)[1];
img.at<Vec3b>(j, i)[2] = coef2*img1.at<Vec3b>(j, i)[2] + coef1*img2.at<Vec3b>(j, i)[2];
}
}
OK, it's work but my image is 720x500 and i have 70ms of processing time is TOO LONG, I need to be real time. I can't do process on GPU.
Is a way to reduce processing time ?
thank. christophe openCV 3.x