img = img1*mask + img2*(1-mask) How do that ?
原文地址: http://answers.opencv.org/question/160599/img-img1mask-img21-mask-how-do-that/ 如何提高一个简单操作的速度?最后的 multiply方法很有启示。 Hello, I would like merge two color images with an image mask. img1 and img2 are color image with 3 channelsmask is grey image with 1 channel for merge the two image with the mask I do a loop for each pixel. float c1,c2;for(int j = 0; j < img1.rows ; j++ ){ for(int i = 0; i < img1.cols ; i++ ){ c1 = (greyGoodScale.at<uchar>(j, i))/255.0; c2 = 1-c1; img.at<Vec3b>...
