Can I use OpenCV
to create GUIs that contain buttons, list boxes, ...etc for example?
Thanks.
Along with the highgui
functions that Simon has pointed out, others have used OpenCV in conjunction with Qt. It is possible to translate the camera frames into images on a QLabel widget, and update the image on the label periodically.
OpenCV has highgui built-in for making GUIs.
You can find online tutorials to get you started.
Note that this is not an extensive GUI library. You can only do basic stuff like opening windows, drawing points, anti-aliased lines, rectangles and text. There is a slider widget that can be used as a on-off button. If you need more than that, you can either
Good luck if you go for the first one!
On windows, you may use cvGetWindowHandle to obtain window handle (HWND). With that handle you may call CreateWindow from WinAPI and put WinAPI controls on that window.
But you will also need to override or hook the WindowProc that was set by OpenCV for that window. Hooking and overriding explained here Multiple WndProc functions in Win32
In the Learning OpenCV
, the following title is mentioned in page 101
: No Buttons.
And, this is some what is mentioned under this title:
Unfortunately, HighGUI does not provide any explicit support for buttons. It is thus common practice, among the particularly lazy, to instead use sliders with only two positions. Another option that occurs oft en in the OpenCV samples in …/opencv/ samples/c/ is to use keyboard shortcuts instead of buttons (see, e.g., the fl oodfi ll demo in the OpenCV source-code bundle).*