Ask Your Question
0

create an overlayer in an image

asked 2016-08-24 13:00:06 -0600

I would like create an overlayer in an video like this image:

https://karanbalkar.com/wp-content/up...

how can I create that?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-08-24 21:37:10 -0600

take a look at the code below

#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"

using namespace cv;

int main( int argc, char** argv )
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;

    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera

        Mat roi = frame(Rect(frame.cols/4,frame.rows/4,frame.cols/2,frame.rows/2));
        frame = frame / 2;
        roi = roi * 2;
        imshow("VideoCapture", frame);
        if(waitKey(30) >= 0) break;
    }
    // the camera will be deinitialized automatically in VideoCapture destructor
    return 0;
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-08-24 13:00:06 -0600

Seen: 179 times

Last updated: Aug 24 '16