I am working on object detection application using OpenCV 3.0 with C++. For a presentation, I need simple GUI to choose relevant files, send them to functions, and print out results. In other words, same thing I do in a terminal. I can't find proper way to create this kind of GUI in neither c++ nor OpenCV documentation.
Asked
Active
Viewed 1,161 times
2
-
7If you want to do something more than display some image and adjust values using sliders, [you should consider using some GUI library](http://stackoverflow.com/a/34695286/5008845) such as Qt. – Miki Feb 07 '16 at 19:58
-
What OS are you using? – Mark Setchell Feb 07 '16 at 20:55
-
@MarkSetchell Ubuntu 15.10 – korujzade Feb 08 '16 at 00:29
1 Answers
3
If you want something really simple, you could use Zenity, or one of its alternatives. Try it from the command line like this:
zenity --title="Select an image" --file-selection --multiple
If it fits the bill for your needs, you can integrate it into your C++ program using popen()
to execute it and then read the filename(s) it outputs.
Note that you can also use it to get arbitrary text or allow section from a list box.
In case anyone else wants to do similar things, but on Apple OSX, you could look at Cocoa Dialog.

Mark Setchell
- 191,897
- 31
- 273
- 432
-
This probably does not answer the question. I believe `zenity` does not fill the bill, and if it did, you probably need to use `popen`, not `system` – Basile Starynkevitch Feb 08 '16 at 10:03
-
Thank you for your comment about `popen()` versus `system()` - I will update the suggestion accordingly. I think it answers the question very well - it is an extremely simple, easy-to-use function that allows the user to select some files without going to the complexity of creating a full-blown `Qt` type of application and the associated steep learning curve. I think a down-vote is a little harsh! – Mark Setchell Feb 08 '16 at 10:05