OpenCV and creating GUIs

前端 未结 4 1702
夕颜
夕颜 2021-01-11 12:37

Can I use OpenCV to create GUIs that contain buttons, list boxes, ...etc for example?

Thanks.

相关标签:
4条回答
  • 2021-01-11 12:38

    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.

    0 讨论(0)
  • 2021-01-11 12:42

    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

    • build stuff yourself (for instance drawing a rectangle with text to make your own button), or
    • use another library like Qt which provide plenty of widgets (buttons, menus, lists, dialogs…)

    Good luck if you go for the first one!

    0 讨论(0)
  • 2021-01-11 12:56

    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

    0 讨论(0)
  • 2021-01-11 12:59

    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).*

    0 讨论(0)
提交回复
热议问题