Skip to content
Search

OpenCV:Highgui

lastmod 2024-07-25created 2015-08-055 edits

While OpenCV was designed for use in full-scale applications and can be used within functionally rich UI frameworks (such as Qt, WinForms, or Cocoa*) or without any UI at all, sometimes there it is required to try functionality quickly and visualize the results. This is what the HighGUI module has been designed for.

It provides easy interface to:

  • Create and manipulate windows that can display images and "remember" their content
    (no need to handle repaint events from OS).
  • Add trackbars to the windows, handle simple mouse events as well as keyboard commands.
  • Read and write images to/from disk or memory.
  • Read video from camera or file and write video to a file.

User Interface

  • createTrackbar
  • getTrackbarPos
  • imshow
  • namedWindow
  • destroyWindow
  • destroyAllWindows
  • MoveWindow
  • ResizeWindow
  • SetMouseCallback
  • setTrackbarPos
  • waitKey
  • setOpenGlDrawCallback
  • setOpenGlContext
  • updateWindow

Reading and Writing Images and Video

  • imdecode
  • imencode
  • imread
  • imwrite
  • VideoCapture
  • VideoCapture::VideoCapture
  • VideoCapture::open
  • VideoCapture::isOpened
  • VideoCapture::release
  • VideoCapture::grab
  • VideoCapture::retrieve
  • VideoCapture::read
  • VideoCapture::get
  • VideoCapture::set
  • VideoWriter
  • VideoWriter::VideoWriter
  • ReleaseVideoWriter
  • VideoWriter::open
  • VideoWriter::isOpened
  • VideoWriter::write

How to save a Boolean-type mask image

Simply multiply by 255.

cv2.imwrite('mask.png', maskimg * 255)

Qt New Functions

  • setWindowProperty
  • getWindowProperty
  • fontQt
  • addText
  • displayOverlay
  • displayStatusBar
  • setOpenGlDrawCallback
  • saveWindowParameters
  • loadWindowParameters
  • createButton

Troubleshooting

HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP

See OpenCV:Troubleshooting#HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP for details.

Freezing when calling cv2.namedWindow

See OpenCV:Troubleshooting#Freezing when calling cv2.namedWindow() for details.

Favorite site

author Zer0 sitemap