Hello, I was just wondering if anyone knew how to make a polygon transparent in OpenCV c++? The code below is what I have already.
vector<Point> myPoly={Point(100,200), Point(100,100), Point(200,100), Point(200,200)}; vector<vector<Point>> contours = {myPoly}; //stores poly as a vector of poly's drawContours(Frame, contours, 0, Scalar(0,255,0),-1);
Thank you in advance.
Just compute the average with the original image:
Mat FrameOrig,result; Frame.copyTo(FrameOrig); drawContours(Frame, contours, 0, Scalar(0,255,0),-1); double transparency=0.5; //...or the desired value addWeighted(Frame,transparency,FrameOrig,(1-transparency),0,result);
It works thank you very much