Multiple imshow windows without needing waitkey in same function [closed]

asked 2017-09-26 15:19:23 -0500

2ros0 gravatar image

updated 2017-09-27 15:18:18 -0500

Hi,

I'm looking to have a GUI that has multiple areas to show images. This is mainly for debugging so that I can show the image at various stages of the algorithm - maybe something like imshow(window_id, image_name). But I also don't want to have to waitkey all the time - the display window should just always be running and displaying images as and when some imshow is called.

What's the best way to implement this? Is it using a qt GUI?

Thank you

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-07 06:31:47.905784

Comments

insn't it just a logic problem ? waitKey() is something "global", you probably need only 1 call per time-frame (and probably not per image, or per window. e.g. most progs should run fine with a single waitKey() at the end of the main loop)

berak gravatar imageberak ( 2017-09-26 15:24:15 -0500 )edit

hmm, all right apart from the waitkey bit - what's the best way to have a GUI that has say 4 windows to display images?

2ros0 gravatar image2ros0 ( 2017-09-26 15:29:07 -0500 )edit
2

i'm the wrong person to ask ;)

(after some years with this, i'm like totally biased against any kind of additional gui. ornament is crime, simply. you're wasting time on buttons and fileboxes, that should go into improving your algo. noone but you also will likely see your effort. cv is all about retrieving numbers. optimize for that ;)

berak gravatar imageberak ( 2017-09-26 15:36:13 -0500 )edit
1

....wow :)

2ros0 gravatar image2ros0 ( 2017-09-26 15:52:18 -0500 )edit

sidenote: occasionally i'm actually selling something. but lately that usually has to run on some webserver

(so: don't bind to any gui, before you know, where this is going !)

berak gravatar imageberak ( 2017-09-26 16:19:00 -0500 )edit

I will also point out that imshow is not a particularly efficient display method. If you really need to display things and run fast, use a different method.

Tetragramm gravatar imageTetragramm ( 2017-09-26 18:25:21 -0500 )edit

like what?

2ros0 gravatar image2ros0 ( 2017-09-26 21:39:32 -0500 )edit

Whatever the appropriate GUI framework is. I don't actually ever use one, for pretty much the same reasons as berak. You can get the data pointer from the cv::Mat and pass it to the framework usually.

Tetragramm gravatar imageTetragramm ( 2017-09-26 21:45:04 -0500 )edit

@berak@Tetragramm what if you made it general enough - it might take a few days to create but then you can use it for years

2ros0 gravatar image2ros0 ( 2017-09-27 10:23:40 -0500 )edit
1

Make what general enough? OpenCV allows you to access the data, which means you can interface with just about every GUI. I mean, it's not really part of computer vision to figure out how to display things on the screen. I'm happy to leave that to JavaFX or QT or WinForms, whatever.

If you do write a more efficient, multi-platform display thing, feel free to commit it.

And just like berak said, after the last of your imshow calls, put waitKey(1) and be done with it.

Tetragramm gravatar imageTetragramm ( 2017-09-27 17:59:37 -0500 )edit