2

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.

korujzade
  • 400
  • 4
  • 23

1 Answers1

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

enter image description here

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