Ask Your Question
1

Get Image On Same Dialog box in opencv 3.0

asked 2014-10-01 00:27:40 -0600

Shelly30 gravatar image

updated 2014-10-09 00:25:36 -0600

How to get image on dialog box in dialog based Application, As i use imshow image is displayed on another window

edit retag flag offensive close merge delete

Comments

You should create the Mat that contains both images (maybe using push_back)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-10-01 02:42:47 -0600 )edit

^^ i think, poster means: 1 image on the same window as the rest of the gui (not in an external window)

berak gravatar imageberak ( 2014-10-01 03:11:20 -0600 )edit
1

@Shelly30 See the answer here

Haris gravatar imageHaris ( 2014-10-09 02:56:24 -0600 )edit

I am doing work on mfc vc++ with dialog based application.I want to show image on dialog box not on window

Shelly30 gravatar imageShelly30 ( 2014-10-09 03:43:40 -0600 )edit
3

probably not so many ppl around here using mfc any more ..

berak gravatar imageberak ( 2014-10-09 03:45:49 -0600 )edit

What you can do is to create a Mat that contains both images you want to display and then give this Mat to the function that transforms it to MFC format

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-01-19 09:07:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-10-01 06:17:24 -0600

thdrksdfthmn gravatar image

updated 2014-10-01 10:36:45 -0600

You should use the same name of the window in imshow function. Something like:

for (std::size_t i = 0, i < imgsPaths.size(); i++) // if you have a vector of images' paths
{
  cv::Mat img = cv::imread(imgsPaths[i]);
  cv::imshow("same window", img);
  cv::waitKey(); // for seeing the displayed image until key pressed
}

I am not sure what you want, so I am adding also another thing: If you want to display two images in the same window, you can do something like:

cv::Mat img1 = cv::imread("../img1.png");
cv::Mat img2 = cv::imread("../img2.png");
cv::Mat img3;
img3.push_back(img1);
img3.push_back(img2);
cv::imshow("img3", img3);
cv::waitKey();

Or if you want to display them one next to each other, then you'll need to play a little more (like create a zero Mat of Size(width1 + width2, max(height1, height2)) and just copy the images in the specific places)

edit flag offensive delete link more

Comments

1

Nice the pushing of multiple mats in a vector was something I didn't know yet. Mostly I copy them to the desired region.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-02 08:00:44 -0600 )edit

I think it is more correct if you display them in the region where you want, but this works for images with the same number of columns

thdrksdfthmn gravatar imagethdrksdfthmn ( 2016-01-19 09:04:17 -0600 )edit

Question Tools

Stats

Asked: 2014-10-01 00:27:40 -0600

Seen: 1,584 times

Last updated: Oct 09 '14