Thanks for your answer, I found the second solution:
cv::Mat transparent( height, width, CV_8UC4); cv::Mat srcImg[] = {JPEG_img, alpha_Mask}; int from_to[] = { 0,0, 1,1, 2,2, 3,3 }; cv::mixChannels( srcImg, 2, &transparent, 1, from_to, 4 );
This works fine, not sure which solution is better.
Maecky
source share