reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofVideoGrabber Class Reference

#include <ofVideoGrabber.h>

Inheritance diagram for ofVideoGrabber:
ofBaseVideoGrabber ofBaseVideoDraws ofBaseVideo ofBaseVideo ofBaseDraws ofBaseHasTexturePlanes ofBaseHasPixels_< unsigned char > ofBaseUpdates ofBaseHasPixels_< unsigned char > ofBaseUpdates ofBaseHasTexture ofAbstractHasPixels ofAbstractHasPixels

Public Member Functions

 ofVideoGrabber ()
 
virtual ~ofVideoGrabber ()
 
std::vector< ofVideoDevicelistDevices () const
 Get a list of available video grabber devices.
 
bool isFrameNew () const
 
void update ()
 Update the object's state.
 
void close ()
 Close the video source.
 
bool setup (int w, int h)
 Set up the grabber with the requested width and height.
 
bool setup (int w, int h, bool bTexture)
 
 OF_DEPRECATED_MSG ("Use setup instead", bool initGrabber(int w, int h){return setup(w, h);}) OF_DEPRECATED_MSG("Use setup instead"
 
bool initGrabber (int w, int h, bool bTexture))
 
bool setPixelFormat (ofPixelFormat pixelFormat)
 Set the requested ofPixelFormat.
 
ofPixelFormat getPixelFormat () const
 
void videoSettings ()
 Request a native GUI for video grabber settings.
 
ofPixelsgetPixels ()
 Get a reference to the underlying ofPixels.
 
const ofPixelsgetPixels () const
 Get a const reference to the underlying ofPixels.
 
 OF_DEPRECATED_MSG ("Use getPixels() instead", ofPixels &getPixelsRef())
 
 OF_DEPRECATED_MSG ("Use getPixels() instead", const ofPixels &getPixelsRef() const)
 
ofTexturegetTexture ()
 
const ofTexturegetTexture () const
 
 OF_DEPRECATED_MSG ("Use getTexture", ofTexture &getTextureReference())
 
 OF_DEPRECATED_MSG ("Use getTexture", const ofTexture &getTextureReference() const)
 
std::vector< ofTexture > & getTexturePlanes ()
 
const std::vector< ofTexture > & getTexturePlanes () const
 
void setVerbose (bool bTalkToMe)
 Set the video grabber's hardware verbosity level.
 
void setDeviceID (int _deviceID)
 Set the video grabber's device ID.
 
void setDesiredFrameRate (int framerate)
 Set the video grabber's desired frame rate.
 
void setUseTexture (bool bUse)
 Enable or disable internal ofTexture use.
 
bool isUsingTexture () const
 
void draw (float x, float y, float w, float h) const
 Draw at a position with the specified size.
 
void draw (float x, float y) const
 Draw at a position at the native size.
 
void bind () const
 
void unbind () const
 
void setAnchorPercent (float xPct, float yPct)
 Set the anchor point the item is drawn around as a percentage.
 
void setAnchorPoint (float x, float y)
 Set the anchor point the item is drawn around in pixels.
 
void resetAnchor ()
 Reset the anchor point to (0, 0).
 
float getHeight () const
 Get the video grabber's height.
 
float getWidth () const
 Get the video grabber's width.
 
bool isInitialized () const
 Determine if the video source is initialized.
 
void setGrabber (std::shared_ptr< ofBaseVideoGrabber > newGrabber)
 
std::shared_ptr< ofBaseVideoGrabbergetGrabber ()
 
const std::shared_ptr< ofBaseVideoGrabbergetGrabber () const
 
template<typename GrabberType >
std::shared_ptr< GrabberType > getGrabber ()
 
template<typename GrabberType >
const std::shared_ptr< GrabberType > getGrabber () const
 
virtual void draw (float x, float y) const
 Draw at a position at the native size.
 
virtual void draw (float x, float y, float w, float h) const=0
 Draw at a position with the specified size.
 
virtual void draw (const glm::vec2 &point) const
 Draw at a position at the native size.
 
virtual void draw (const ofRectangle &rect) const
 Draw at a position and size specified by a rectangle.
 
virtual void draw (const glm::vec2 &point, float w, float h) const
 Draw at a position.
 
- Public Member Functions inherited from ofBaseVideoGrabber
virtual ~ofBaseVideoGrabber ()
 Destroy the ofBaseVideoGrabber.
 
virtual ofTexturegetTexturePtr ()
 Get the video grabber's internal ofTexture pointer if available.
 
- Public Member Functions inherited from ofBaseVideo
virtual ~ofBaseVideo ()
 Destroy the ofBaseVideo.
 
- Public Member Functions inherited from ofBaseHasPixels_< unsigned char >
virtual ~ofBaseHasPixels_ ()
 Destroy the ofAbstractHasPixels.
 
- Public Member Functions inherited from ofAbstractHasPixels
virtual ~ofAbstractHasPixels ()
 Destroy the ofAbstractHasPixels.
 
- Public Member Functions inherited from ofBaseUpdates
virtual ~ofBaseUpdates ()
 Destroy the ofBaseUpdates.
 
- Public Member Functions inherited from ofBaseVideoDraws
virtual ~ofBaseVideoDraws ()
 Destroy the ofBaseVideoDraws.
 
- Public Member Functions inherited from ofBaseDraws
virtual ~ofBaseDraws ()
 Destroy the abstract object.
 
- Public Member Functions inherited from ofBaseHasTexturePlanes
virtual ~ofBaseHasTexturePlanes ()
 Destroy the ofBaseHasTexturePlanes.
 
- Public Member Functions inherited from ofBaseHasTexture
virtual ~ofBaseHasTexture ()
 Destroy the ofBaseHasTexture.
 

Constructor & Destructor Documentation

◆ ofVideoGrabber()

ofVideoGrabber::ofVideoGrabber ( )

◆ ~ofVideoGrabber()

ofVideoGrabber::~ofVideoGrabber ( )
virtual

Member Function Documentation

◆ bind()

void ofVideoGrabber::bind ( ) const

◆ close()

void ofVideoGrabber::close ( )
virtual

Close the video source.

Implements ofBaseVideo.

◆ draw() [1/7]

void ofBaseDraws::draw ( const glm::vec2 &  point) const
virtual

Draw at a position at the native size.

Native size is determined by getWidth() and getHeight().

Parameters
pointDraw position.

Reimplemented from ofBaseDraws.

◆ draw() [2/7]

void ofBaseDraws::draw ( const glm::vec2 &  point,
float  w,
float  h 
) const
virtual

Draw at a position.

Parameters
pointDraw position.
wDraw width.
hDraw height.

Reimplemented from ofBaseDraws.

◆ draw() [3/7]

void ofBaseDraws::draw ( const ofRectangle rect) const
virtual

Draw at a position and size specified by a rectangle.

Parameters
rectDraw position and size.

Reimplemented from ofBaseDraws.

◆ draw() [4/7]

void ofVideoGrabber::draw ( float  x,
float  y 
) const
virtual

Draw at a position at the native size.

Native size is determined by getWidth() and getHeight().

Parameters
xDraw position on the x axis.
yDraw position on the y axis.

Reimplemented from ofBaseDraws.

◆ draw() [5/7]

virtual void ofBaseDraws::draw ( float  x,
float  y 
) const
inlinevirtual

Draw at a position at the native size.

Native size is determined by getWidth() and getHeight().

Parameters
xDraw position on the x axis.
yDraw position on the y axis.

Reimplemented from ofBaseDraws.

◆ draw() [6/7]

void ofVideoGrabber::draw ( float  x,
float  y,
float  w,
float  h 
) const
virtual

Draw at a position with the specified size.

Parameters
xDraw position on the x axis.
yDraw position on the y axis.
wDraw width.
hDraw height.

Implements ofBaseDraws.

◆ draw() [7/7]

virtual void ofBaseDraws::draw ( float  x,
float  y,
float  w,
float  h 
) const
virtual

Draw at a position with the specified size.

Parameters
xDraw position on the x axis.
yDraw position on the y axis.
wDraw width.
hDraw height.

Implements ofBaseDraws.

◆ getGrabber() [1/4]

shared_ptr< ofBaseVideoGrabber > ofVideoGrabber::getGrabber ( )

◆ getGrabber() [2/4]

template<typename GrabberType >
std::shared_ptr< GrabberType > ofVideoGrabber::getGrabber ( )
inline

◆ getGrabber() [3/4]

const shared_ptr< ofBaseVideoGrabber > ofVideoGrabber::getGrabber ( ) const

◆ getGrabber() [4/4]

template<typename GrabberType >
const std::shared_ptr< GrabberType > ofVideoGrabber::getGrabber ( ) const
inline

◆ getHeight()

float ofVideoGrabber::getHeight ( ) const
virtual

Get the video grabber's height.

Returns
the video grabber's height.

Implements ofBaseVideoGrabber.

◆ getPixelFormat()

ofPixelFormat ofVideoGrabber::getPixelFormat ( ) const
virtual
Returns
the current ofPixelFormat.

Implements ofBaseVideo.

◆ getPixels() [1/2]

ofPixels & ofVideoGrabber::getPixels ( )
virtual

Get a reference to the underlying ofPixels.

Returns
a reference the underlying ofPixels.

Implements ofBaseHasPixels_< unsigned char >.

◆ getPixels() [2/2]

const ofPixels & ofVideoGrabber::getPixels ( ) const
virtual

Get a const reference to the underlying ofPixels.

Returns
a const reference the underlying ofPixels.

Implements ofBaseHasPixels_< unsigned char >.

◆ getTexture() [1/2]

ofTexture & ofVideoGrabber::getTexture ( )
virtual
Returns
a reference to the ofTexture.

Implements ofBaseHasTexture.

◆ getTexture() [2/2]

const ofTexture & ofVideoGrabber::getTexture ( ) const
virtual
Returns
a const reference to the ofTexture.

Implements ofBaseHasTexture.

◆ getTexturePlanes() [1/2]

vector< ofTexture > & ofVideoGrabber::getTexturePlanes ( )
virtual
Returns
a reference to a std::vector containing the ofTexture planes.

Implements ofBaseHasTexturePlanes.

◆ getTexturePlanes() [2/2]

const vector< ofTexture > & ofVideoGrabber::getTexturePlanes ( ) const
virtual
Returns
a const reference to a std::vector containing the ofTexture planes.

Implements ofBaseHasTexturePlanes.

◆ getWidth()

float ofVideoGrabber::getWidth ( ) const
virtual

Get the video grabber's width.

Returns
the video grabber's width.

Implements ofBaseVideoGrabber.

◆ initGrabber()

bool ofVideoGrabber::initGrabber ( int  w,
int  h,
bool  bTexture 
)

◆ isFrameNew()

bool ofVideoGrabber::isFrameNew ( ) const
virtual
Returns
true if the pixel data was updated since the last call to update().

Implements ofBaseVideo.

◆ isInitialized()

bool ofVideoGrabber::isInitialized ( ) const
virtual

Determine if the video source is initialized.

Video sources such as cameras are often initialized with a setup() method. Video sources such as movie players are often initialized with a load() method.

Returns
true if the video source is initialized.

Implements ofBaseVideo.

◆ isUsingTexture()

bool ofVideoGrabber::isUsingTexture ( ) const
virtual
Returns
true if an internal ofTexture is being used.

Implements ofBaseHasTexture.

◆ listDevices()

vector< ofVideoDevice > ofVideoGrabber::listDevices ( ) const
virtual

Get a list of available video grabber devices.

Returns
a std::vector of ofVideoDevice objects.

Implements ofBaseVideoGrabber.

◆ OF_DEPRECATED_MSG() [1/5]

ofVideoGrabber::OF_DEPRECATED_MSG ( "Use getPixels() instead"  ,
const ofPixels &getPixelsRef() const   
)

◆ OF_DEPRECATED_MSG() [2/5]

ofVideoGrabber::OF_DEPRECATED_MSG ( "Use getPixels() instead"  ,
ofPixels getPixelsRef() 
)

◆ OF_DEPRECATED_MSG() [3/5]

ofVideoGrabber::OF_DEPRECATED_MSG ( "Use getTexture"  ,
const ofTexture &getTextureReference() const   
)

◆ OF_DEPRECATED_MSG() [4/5]

ofVideoGrabber::OF_DEPRECATED_MSG ( "Use getTexture"  ,
ofTexture getTextureReference() 
)

◆ OF_DEPRECATED_MSG() [5/5]

ofVideoGrabber::OF_DEPRECATED_MSG ( "Use setup instead"  ,
bool initGrabber(int w, int h){return setup(w, h);}   
)

◆ resetAnchor()

void ofVideoGrabber::resetAnchor ( )
virtual

Reset the anchor point to (0, 0).

Reimplemented from ofBaseDraws.

◆ setAnchorPercent()

void ofVideoGrabber::setAnchorPercent ( float  xPct,
float  yPct 
)
virtual

Set the anchor point the item is drawn around as a percentage.

This can be useful if you want to rotate an image around a particular point.

Parameters
xPctHorizontal position as a percentage (0 - 1).
yPctVertical position as a percentage (0 - 1).

Reimplemented from ofBaseDraws.

◆ setAnchorPoint()

void ofVideoGrabber::setAnchorPoint ( float  x,
float  y 
)
virtual

Set the anchor point the item is drawn around in pixels.

This can be useful if you want to rotate an image around a particular point.

Parameters
xHorizontal texture position in pixels.
yVertical texture position in pixels.

Reimplemented from ofBaseDraws.

◆ setDesiredFrameRate()

void ofVideoGrabber::setDesiredFrameRate ( int  framerate)
virtual

Set the video grabber's desired frame rate.

Many video grabbers support user-specified frame rates. This frame rate should be considered a hint for the video grabber and is not guaranteed.

Parameters
frameratethe desired frame rate.

Reimplemented from ofBaseVideoGrabber.

◆ setDeviceID()

void ofVideoGrabber::setDeviceID ( int  deviceID)
virtual

Set the video grabber's device ID.

In most cases, a user can choose a specific grabber source by ID. This device ID information should be available to the user via the listDevices() method.

Parameters
deviceIDThe device ID provided by listDevices().

Reimplemented from ofBaseVideoGrabber.

◆ setGrabber()

void ofVideoGrabber::setGrabber ( std::shared_ptr< ofBaseVideoGrabber newGrabber)

◆ setPixelFormat()

bool ofVideoGrabber::setPixelFormat ( ofPixelFormat  pixelFormat)
virtual

Set the requested ofPixelFormat.

Parameters
pixelFormatthe requested ofPixelFormat.
Returns
true if the format was successfully changed.

Implements ofBaseVideo.

◆ setup() [1/2]

bool ofVideoGrabber::setup ( int  w,
int  h 
)
inlinevirtual

Set up the grabber with the requested width and height.

Some video grabbers may take the requested width and height as a hint and choose the closest dimensions to those requested. Users can check the actual width and height by calling getWidth() and getHeight() respectively after a successful setup.

Parameters
wthe requested width.
hthe requested height.
Returns
true if the video grabber was set up successfully.

Implements ofBaseVideoGrabber.

◆ setup() [2/2]

bool ofVideoGrabber::setup ( int  w,
int  h,
bool  bTexture 
)

◆ setUseTexture()

void ofVideoGrabber::setUseTexture ( bool  bUseTex)
virtual

Enable or disable internal ofTexture use.

Parameters
bUseTextrue if an ofTexture should be used.

Implements ofBaseHasTexture.

◆ setVerbose()

void ofVideoGrabber::setVerbose ( bool  bTalkToMe)
virtual

Set the video grabber's hardware verbosity level.

Parameters
bTalkToMetrue if verbose grabber logging feedback is required.

Reimplemented from ofBaseVideoGrabber.

◆ unbind()

void ofVideoGrabber::unbind ( ) const

◆ update()

void ofVideoGrabber::update ( )
virtual

Update the object's state.

Implements ofBaseUpdates.

◆ videoSettings()

void ofVideoGrabber::videoSettings ( void  )
virtual

Request a native GUI for video grabber settings.

Note
This feature may not be implemented by all video grabbers.

Reimplemented from ofBaseVideoGrabber.


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