![]() |
BoB robotics
The Brains on Board robotics library
|
Display a video source on screen. More...
#include <display.h>
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::Input & | getVideoInput () |
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. | |
![]() | |
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 |
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.
BoBRobotics::Video::Display::Display | ( | Input & | videoInput, |
const bool | fullScreen = false |
||
) |
Create a new display with unwrapping disabled.
videoInput | The video source to display |
fullScreen | Whether or not to display fullscreen |
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.
videoInput | The video source to display |
unwrapRes | The size of the target image after unwrapping |
fullScreen | Whether or not to display fullscreen |
|
overrideprotectedvirtual |
Implements BoBRobotics::Threadable.
bool BoBRobotics::Video::Display::update | ( | ) |
Try to read a new frame from the video source and display it.