Ask Your Question
0

Overlay multiple detections/effects in a single window/image

asked 2013-07-07 23:43:06 -0600

Libbux gravatar image

updated 2013-07-07 23:43:48 -0600

I'm starting out with OpenCV, and I'm writing a program to do a bunch of detection and recognition on real time (although only about 1fps) camera feeds and images (face detection & recognition, human detection, keypoint detection, keypoint matching, object detection & matching, etc.). At the moment, I've got each new "detection" popping up in it's own window, so face detection has it's own window, keypoint detection has it's own window, etc. I'd like to merge a few of these into a single window, if possible, using either highgui or Qt.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-07-08 01:53:53 -0600

berak gravatar image

you could just join the images next to each other:

Mat frame;
Mat a = imread("cannyout.png");
Mat b = imread("hay.png");
resize(b,b,a.size());    // both need to be same size & type (you'd never guessed that ..)
Mat iv[2] = {a,b};
hconcat( iv,2,frame );   // there's vconcat, too!
namedWindow("video", 1);
imshow("video", frame);
waitKey();

or do 'picture in picture' (using the ROI operator):

Mat a = imread("cannyout.png");
Mat b = imread("hay.png");
resize(b,b,Size(100,100));       // b will be the 'overlay'
Mat roi = a(Rect(20,20,b.cols,b.rows)); // destination rect
b.copyTo(roi);                   // again, same type/numchannels needed here
namedWindow("video", 1);
imshow("video", a);
waitKey();
edit flag offensive delete link more

Comments

How can I use an overlay image with transparency, in the 'picture in picture' example?

mateuscgc gravatar imagemateuscgc ( 2015-12-08 11:22:38 -0600 )edit

@mateuscgc , - are you sure , you're using the right tool for your job ? opencv is a "computer-vision" library, your problem sounds more like a dtp/web-publishing job. again, transparency has no use in computer-vision, thus there are no real tools for this builtin.

berak gravatar imageberak ( 2015-12-08 11:26:54 -0600 )edit

Question Tools

Stats

Asked: 2013-07-07 23:43:06 -0600

Seen: 1,495 times

Last updated: Jul 08 '13