View on GitHub

CV-Sandbox

Just a random assortment of computer vision projects.

Current screenshot

Project 9: OpenCV Video Template

This project opens a video, plays it, and exposes an OpenCV Mat instance and simple API to control the video feed and render the current Mat in real time on a GUI. It uses the GUI setup from Project 6 on the tools from Project 5.

Table of Contents

Usage

Four windows allow the user to control many aspects of the application:

Video Viewer

This window shows the rendered image on the screen and some useful information about the image and its underlying OpenGL texture. These are its controls:

  1. Video Position allows users to view the index if the current frame and to scrub the video feed.
  2. Loop starts the video at the beginning if the next frame couldn’t be displayed.
  3. Play advances to the next frame every time the screen refreshes.
  4. Next frame advances to the next frame.
  5. Display Scale allows users to zoom in to and out of the image.

Hovering over the image creates a widget that allows the user to see a 4x magnified slice of the image.

Window Settings

This window controls the graphics settings:

  1. Display Scale sets the magnification of the GUI, which may increase the viewing experience of users with high-DPI displays. This defaults to the operating system’s internal scale, but it can be set to any number.
  2. Swap Interval sets the number of monitor-refreshes to wait until the GUI redraws.

Style Editor

This allows the user to customize the aesthetics of the GUI. It can be exported to C++ code.

It is a window provided by and included in the ImGui source code.

Demo Window

This is a demo window provided by and included in the ImGui source code.

Framework

Four main file pairs control the user interface

Therefore, populateUI()is not at all responsible for rendering the UI, yet it controls everything about the struture, layout, and appearance of the UI. Likewise, render() controls the window and all tools used to display the GUI, but doesn’t need to worry about how the GUI is set up or what it does.

Resources

Code samples