Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use imshow to display multiple images in multiple windows?

Tags:

c++

opencv

I would like to do something like the following in order to display two images on the screen:

imshow("1", img1);
imshow('2', 'img2');

Is it possible to do that?

like image 815
prgbenz Avatar asked Aug 01 '13 07:08

prgbenz


People also ask

How do you Imshow multiple images in python?

MatPlotLib with Python Create random data using numpy. Add a subplot to the current figure, nrows=1, ncols=4 and at index=1. Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="Blues_r". Add a subplot to the current figure, nrows=1, ncols=4 and at index=2.


1 Answers

Yes, it is possible. The function void imshow(const string& winname, InputArray mat) displays an image in the specified window, where -

  • winname – Name of the window.
  • image – Image to be shown.

The window is identified by its name. So to display two images(img1, img2), in two different window; use imshow with different name like :-

imshow("1",img1);
imshow("2",img2);
like image 124
Saikat Avatar answered Nov 15 '22 15:11

Saikat