I need to draw a transparent image on a live camera channel. Below is the png file, which will be displayed as an overlay on the camera channel.

Below is a snippet of code to extract frames from the camera and display it on the screen. I also tried to draw a circle as an overlay, but the circle is not transparent. I think I'm wrong or missing something in the following code snippet?
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
int main () {
Mat src;
Mat overlay = imread ( "circle.png", -1 );
VideoCapture cap ( 0 );
while ( 1 ) {
cap >> src;
cvtColor( src, src, CV_BGR2BGRA );
overlay.copyTo( src.colRange(0,400).rowRange(0,400));
imshow ( "src",src );
waitKey( 10 );
}
return 0;
}
source
share