JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
jevois::VideoDisplayGL Class Reference

#include <jevois/Core/VideoDisplayGL.H>

Video output to local screen.

This class provides accelerated OpenGL-ES display on JeVois-Pro platform. It only works on JeVois-Pro and creates fatal errors on other host or platform configs. Images are simply displayed on the local screen using OpenGL-ES.

Here is the basic theory of operation:

  • When running on host, we open an X11 window; on platform, we instead use fbdev.
  • When the first video frame arrives, we then initialize OpenGL and create 2 triangles that will be rendered in the whole window. The reason for this is to avoid threading issues (so OpenGL is initialized in the same thread as rendering calls will be made). We also initialize a texture of the same size as the incoming image. We finally create a surface of same size as the window or fbdev. We then load a compile shaders to render our texture into our surface.
  • On every frame, we just update the texture's pixel location and render the scene.

Definition at line 50 of file VideoDisplayGL.H.

Inheritance diagram for jevois::VideoDisplayGL:
Collaboration diagram for jevois::VideoDisplayGL:

Public Member Functions

 VideoDisplayGL (size_t nbufs=2)
 Constructor. More...
 
virtual ~VideoDisplayGL ()
 Virtual destructor for safe inheritance. More...
 
virtual void setFormat (VideoMapping const &m) override
 Set the video format and frame rate, allocate the buffers. More...
 
virtual void get (RawImage &img) override
 Get a pre-allocated image so that we can fill the pixel data and later send out using send() More...
 
virtual void send (RawImage const &img) override
 Send an image out to display. More...
 
virtual void streamOn () override
 Start streaming. More...
 
virtual void abortStream () override
 Abort streaming. More...
 
virtual void streamOff () override
 Stop streaming. More...
 
- Public Member Functions inherited from jevois::VideoOutput
virtual ~VideoOutput ()
 Virtual destructor for safe inheritance. More...
 

Protected Attributes

std::vector< std::shared_ptr< VideoBuf > > itsBuffers
 
BoundedBuffer< RawImage, BlockingBehavior::Block, BlockingBehavior::BlockitsImageQueue
 
GPUimage itsImage
 
VideoDisplayBackendMALI itsBackend
 
std::atomic< bool > itsStreaming
 

Constructor & Destructor Documentation

◆ VideoDisplayGL()

jevois::VideoDisplayGL::VideoDisplayGL ( size_t  nbufs = 2)

Constructor.

Definition at line 27 of file VideoDisplayGL.C.

◆ ~VideoDisplayGL()

jevois::VideoDisplayGL::~VideoDisplayGL ( )
virtual

Virtual destructor for safe inheritance.

Definition at line 63 of file VideoDisplayGL.C.

References LERROR.

Member Function Documentation

◆ abortStream()

void jevois::VideoDisplayGL::abortStream ( )
overridevirtual

Abort streaming.

This only cancels future get() and done() calls, one should still call streamOff() to turn off streaming.

Implements jevois::VideoOutput.

Definition at line 137 of file VideoDisplayGL.C.

◆ get()

void jevois::VideoDisplayGL::get ( jevois::RawImage img)
overridevirtual

Get a pre-allocated image so that we can fill the pixel data and later send out using send()

Implements jevois::VideoOutput.

Definition at line 76 of file VideoDisplayGL.C.

References jevois::RawImage::bufindex, LDEBUG, and LFATAL.

◆ send()

void jevois::VideoDisplayGL::send ( jevois::RawImage const &  img)
overridevirtual

Send an image out to display.

Implements jevois::VideoOutput.

Definition at line 86 of file VideoDisplayGL.C.

References jevois::RawImage::bufindex, h, LDEBUG, and LFATAL.

◆ setFormat()

void jevois::VideoDisplayGL::setFormat ( VideoMapping const &  m)
overridevirtual

Set the video format and frame rate, allocate the buffers.

Implements jevois::VideoOutput.

Definition at line 32 of file VideoDisplayGL.C.

References jevois::RawImage::buf, jevois::RawImage::bufindex, jevois::RawImage::fmt, jevois::RawImage::fps, jevois::RawImage::height, LDEBUG, and jevois::RawImage::width.

◆ streamOff()

void jevois::VideoDisplayGL::streamOff ( )
overridevirtual

Stop streaming.

Implements jevois::VideoOutput.

Definition at line 141 of file VideoDisplayGL.C.

◆ streamOn()

void jevois::VideoDisplayGL::streamOn ( )
overridevirtual

Start streaming.

Implements jevois::VideoOutput.

Definition at line 133 of file VideoDisplayGL.C.

Member Data Documentation

◆ itsBackend

VideoDisplayBackendMALI jevois::VideoDisplayGL::itsBackend
protected

Definition at line 84 of file VideoDisplayGL.H.

◆ itsBuffers

std::vector<std::shared_ptr<VideoBuf> > jevois::VideoDisplayGL::itsBuffers
protected

Definition at line 79 of file VideoDisplayGL.H.

◆ itsImage

GPUimage jevois::VideoDisplayGL::itsImage
protected

Definition at line 81 of file VideoDisplayGL.H.

◆ itsImageQueue

BoundedBuffer<RawImage, BlockingBehavior::Block, BlockingBehavior::Block> jevois::VideoDisplayGL::itsImageQueue
protected

Definition at line 80 of file VideoDisplayGL.H.

◆ itsStreaming

std::atomic<bool> jevois::VideoDisplayGL::itsStreaming
protected

Definition at line 88 of file VideoDisplayGL.H.


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