I need to draw a transparent image over the live camera feed. The below is the png file to be shown as overlay over the camera feed.
The below is the piece of code to fetch the frames from camera and show it on screen. I also tried to draw the circle as overlay, but the circle is not transparent. I think am wrong or missing out something in the below piece of code?
#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;
}