BoB robotics
The Brains on Board robotics library
BoBRobotics::Video::Display Class Referencefinal

Display a video source on screen. More...

#include <display.h>

Inheritance diagram for BoBRobotics::Video::Display:
BoBRobotics::Threadable

Public Member Functions

 Display (Input &videoInput, const bool fullScreen=false)
 Create a new display with unwrapping disabled. More...
 
 Display (Input &videoInput, const cv::Size &unwrapRes, const bool fullScreen=false)
 Create a new display with unwrapping enabled if the videoInput supports it. More...
 
virtual ~Display () override
 Close display window and destroy this object.
 
Video::InputgetVideoInput ()
 Gets the Video::Input object this Display is reading from.
 
bool isOpen ()
 Return true if the display window is open.
 
bool update ()
 Try to read a new frame from the video source and display it. More...
 
virtual void close ()
 Close the display and stop the background thread if needed.
 
- Public Member Functions inherited from BoBRobotics::Threadable
virtual void run ()
 Run on the current thread, blocking until process ends.
 
virtual bool isRunning ()
 Check if the run() function has been called.
 
virtual void runInBackground ()
 Run the process on a background thread.
 
virtual void stop ()
 Stop the background thread.
 

Protected Member Functions

virtual bool readFrame (cv::Mat &frame)
 
virtual void runInternal () override
 
virtual void runInternal ()=0
 

Detailed Description

Display a video source on screen.

This is a simple class for displaying a Video::Input (e.g. a webcam) on screen. An example of its use is given in examples/display.

You can optionally run the display on a separate thread by invoking the runInBackground() method.

Should be built with OpenCV and -pthread.

Constructor & Destructor Documentation

◆ Display() [1/2]

BoBRobotics::Video::Display::Display ( Input videoInput,
const bool  fullScreen = false 
)

Create a new display with unwrapping disabled.

Parameters
videoInputThe video source to display
fullScreenWhether or not to display fullscreen

◆ Display() [2/2]

BoBRobotics::Video::Display::Display ( Input videoInput,
const cv::Size &  unwrapRes,
const bool  fullScreen = false 
)

Create a new display with unwrapping enabled if the videoInput supports it.

Parameters
videoInputThe video source to display
unwrapResThe size of the target image after unwrapping
fullScreenWhether or not to display fullscreen

Member Function Documentation

◆ runInternal()

void BoBRobotics::Video::Display::runInternal ( )
overrideprotectedvirtual

◆ update()

bool BoBRobotics::Video::Display::update ( )

Try to read a new frame from the video source and display it.

Returns
Whether a new frame was successfully read

The documentation for this class was generated from the following files: