Ask Your Question

GUI with hconcat, vconcat

asked 2018-12-12 05:44:26 -0500

cherault gravatar image

Dear all,

This is my goal:

I have a main window (640x480px). Within this main window, I will select by mouse various zones, with various sizes. I would like to show the main window, and just above the selected zone resized (for example 100x100), in a single window.


Is it possible to use vconcat to show the main window and above the selected zones ? Is it possible too to use hconcat to plot the selected zones ? If yes, how do I proceed ?

Thanks for your help.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-12-12 08:54:06 -0500

you can create a canvas ( Mat ) and use rois to show the image and selections

see the code below ( just to show the idea)

cv::Mat img = cv::imread("messi5.jpg");
cv::Mat canvas(img.rows+130, img.cols+20, CV_8UC3, cv::Scalar(127, 127, 127));

cv::Rect r(10, 10, img.cols, img.rows);

cv::Rect selection1(10, 10, 100, 100);
cv::Rect selection2(200, 200, 100, 100);
cv::Rect selection3(300, 240, 100, 100);

cv::Rect showSelection1(10, img.rows + 20, 100, 100);
cv::Rect showSelection2(120, img.rows + 20, 100, 100);
cv::Rect showSelection3(230, img.rows + 20, 100, 100);


cv::imshow("Canvas", canvas);

image description

edit flag offensive delete link more



Thank you very much Sturkmen, that's really amazing. Regards and thanks again.

cherault gravatar imagecherault ( 2018-12-12 08:56:30 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-12-12 05:44:26 -0500

Seen: 26 times

Last updated: Dec 12 '18