Ask Your Question
1

GUI with hconcat, vconcat

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

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.

Questions:

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.

Regards,

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

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

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);
img.copyTo(canvas(r));

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);

img(selection1).copyTo(canvas(showSelection1));
img(selection2).copyTo(canvas(showSelection2));
img(selection3).copyTo(canvas(showSelection3));

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

image description

edit flag offensive delete link more

Comments

1

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

cherault gravatar imagecherault ( 2018-12-12 08:56:30 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 1,621 times

Last updated: Dec 12 '18