Drawing onto a transparent Mat
Hi,
I'm doing a colour tracking application that draws a line following that colour. You are probably quite familiar with the code, I followed an online tutorial :
//track yellow
IplImage* GetThresholdedImage1(IplImage* img)
{
// Convert the image into an HSV image
IplImage* imgHSV = cvCreateImage(cvGetSize(img), 8, 3);
cvCvtColor(img, imgHSV, CV_BGR2HSV);
// Create new image to hold thresholded image
IplImage* imgThreshed = cvCreateImage(cvGetSize(img), 8, 1);
cvInRangeS(imgHSV, cvScalar(20, 100, 100), cvScalar(30, 255, 255), imgThreshed); // apply threshold original
cvReleaseImage(&imgHSV);
return imgThreshed;
}
IplImage *frame=0;
frame =cvQueryFrame(capture);
IplImage* imgYellowThresh1 = GetThresholdedImage1(frame);
//scribble lines on to frame
imgScribble =cvCreateImage(cvGetSize(frame),8,3);
cvAdd(frame,imgScribble,frame);
cvShowImage("video",frame);
So this draws a yellow line on the video from my webcam. What I want is to replace the video with a transparent background. Does anyone know how to create a transparent Mat and then draw onto it instead of the frame. I tried to draw on to the canvas but this doesn't seem to be working :
IplImage* imgYellowThresh1 = GetThresholdedImage1(canvas);
cvAdd(canvas,imgScribble,canvas);
Any advice is greatly appreciated. Thanks!