maybe this is too late but I had the same problem and it was because my "src" had 3 Channels and my "dst" had 4 Channels.
I just wrote this:
Imgproc.cvtColor(src, auxiliar, Imgproc.COLOR_RGB2RGBA);
auxiliar.copyTo(dst, mask);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.