answered Apr 2 '14
If you have opencv_gpu, you could try cv::gpu::alphaComp(), which is likely quite efficient!