Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
vpDirectShowGrabber Class Reference

#include <visp3/sensor/vpDirectShowGrabber.h>

+ Inheritance diagram for vpDirectShowGrabber:

Public Member Functions

unsigned int getHeight ()
 
unsigned int getWidth ()
 
 vpDirectShowGrabber ()
 
virtual ~vpDirectShowGrabber ()
 
void open ()
 
void open (vpImage< unsigned char > &I)
 
void open (vpImage< vpRGBa > &I)
 
void acquire (vpImage< unsigned char > &I)
 
void acquire (vpImage< vpRGBa > &I)
 
void close ()
 
unsigned int getDeviceNumber ()
 
bool setDevice (unsigned int id)
 
void displayDevices ()
 
bool setImageSize (unsigned int width, unsigned int height)
 
bool setFramerate (double framerate)
 
bool setFormat (unsigned int width, unsigned int height, double framerate)
 
void getFormat (unsigned int &width, unsigned int &height, double &framerate)
 
bool getStreamCapabilities ()
 
bool setMediaType (int mediaTypeID)
 
int getMediaType ()
 
Inherited functionalities from vpFramegrabber
unsigned int getHeight () const
 
unsigned int getWidth () const
 

Public Attributes

bool init
 

Protected Attributes

unsigned int height
 
unsigned int width
 

Detailed Description

class for windows direct show devices

This class' goal is to totally hide the implementation of the framegrabber from the rest of the application. This is necessary to avoid conflicts between dshow's Qedit.h and Direct3D's includes.

Examples:
grabDirectShow.cpp, grabDirectShowMulti.cpp, manGrabDirectShow.cpp, and servoBiclopsPoint2DArtVelocity.cpp.

Definition at line 63 of file vpDirectShowGrabber.h.

Constructor & Destructor Documentation

◆ vpDirectShowGrabber()

vpDirectShowGrabber::vpDirectShowGrabber ( )

Constructor. Initializes COM.

Definition at line 60 of file vpDirectShowGrabber.cpp.

◆ ~vpDirectShowGrabber()

vpDirectShowGrabber::~vpDirectShowGrabber ( )
virtual

Destructor

Definition at line 65 of file vpDirectShowGrabber.cpp.

Member Function Documentation

◆ acquire() [1/2]

void vpDirectShowGrabber::acquire ( vpImage< unsigned char > &  I)
virtual

Grabs a grayscale image from the video stream. Uses a semaphore to synchronize with the framegrabber callback.

Parameters
IThe image to fill with the grabbed frame
Exceptions
otherErrorCan't grab the frame

Implements vpFrameGrabber.

Examples:
grabDirectShow.cpp, grabDirectShowMulti.cpp, manGrabDirectShow.cpp, and servoBiclopsPoint2DArtVelocity.cpp.

Definition at line 92 of file vpDirectShowGrabber.cpp.

◆ acquire() [2/2]

void vpDirectShowGrabber::acquire ( vpImage< vpRGBa > &  I)
virtual

Grabs a rgba image from the video stream. Uses a semaphore to synchronize with the framegrabber callback.

Parameters
IThe image to fill with the grabbed frame
Exceptions
otherErrorCan't grab the frame

Implements vpFrameGrabber.

Definition at line 102 of file vpDirectShowGrabber.cpp.

◆ close()

void vpDirectShowGrabber::close ( )
virtual

Stops the framegrabber

Implements vpFrameGrabber.

Examples:
grabDirectShow.cpp, grabDirectShowMulti.cpp, and manGrabDirectShow.cpp.

Definition at line 107 of file vpDirectShowGrabber.cpp.

◆ displayDevices()

void vpDirectShowGrabber::displayDevices ( )

Displays the list of devices on the standard output

Examples:
grabDirectShowMulti.cpp.

Definition at line 126 of file vpDirectShowGrabber.cpp.

◆ getDeviceNumber()

unsigned int vpDirectShowGrabber::getDeviceNumber ( )

Gets the number of capture devices

Returns
the number of capture devices
Examples:
grabDirectShow.cpp, grabDirectShowMulti.cpp, and manGrabDirectShow.cpp.

Definition at line 113 of file vpDirectShowGrabber.cpp.

◆ getFormat()

void vpDirectShowGrabber::getFormat ( unsigned int &  width,
unsigned int &  height,
double &  framerate 
)
Examples:
grabDirectShowMulti.cpp.

Definition at line 164 of file vpDirectShowGrabber.cpp.

◆ getHeight() [1/2]

unsigned int vpDirectShowGrabber::getHeight ( )

Returns the number of rows in the grabbed image

Definition at line 49 of file vpDirectShowGrabber.cpp.

◆ getHeight() [2/2]

unsigned int vpFrameGrabber::getHeight ( ) const
inlineinherited

Return the number of rows in the image.

Examples:
AROgre.cpp, AROgreBasic.cpp, and testPylonGrabber.cpp.

Definition at line 114 of file vpFrameGrabber.h.

◆ getMediaType()

int vpDirectShowGrabber::getMediaType ( )
Examples:
grabDirectShowMulti.cpp.

Definition at line 190 of file vpDirectShowGrabber.cpp.

◆ getStreamCapabilities()

bool vpDirectShowGrabber::getStreamCapabilities ( )

Get the available capture formats

Returns
true if successful
Examples:
grabDirectShowMulti.cpp.

Definition at line 174 of file vpDirectShowGrabber.cpp.

◆ getWidth() [1/2]

unsigned int vpDirectShowGrabber::getWidth ( )

Returns the number of colunms in the grabbed image

Definition at line 54 of file vpDirectShowGrabber.cpp.

◆ getWidth() [2/2]

unsigned int vpFrameGrabber::getWidth ( ) const
inlineinherited

Return the number of columns in the image.

Examples:
AROgre.cpp, AROgreBasic.cpp, and testPylonGrabber.cpp.

Definition at line 116 of file vpFrameGrabber.h.

◆ open() [1/3]

void vpDirectShowGrabber::open ( )

Creates the filter graph and select the first available device.

Exceptions
initializationError
Examples:
grabDirectShow.cpp, grabDirectShowMulti.cpp, manGrabDirectShow.cpp, and servoBiclopsPoint2DArtVelocity.cpp.

Definition at line 70 of file vpDirectShowGrabber.cpp.

◆ open() [2/3]

void vpDirectShowGrabber::open ( vpImage< unsigned char > &  I)
virtual

Creates the filter graph and select the first available device.

Exceptions
initializationError

Implements vpFrameGrabber.

Definition at line 76 of file vpDirectShowGrabber.cpp.

◆ open() [3/3]

void vpDirectShowGrabber::open ( vpImage< vpRGBa > &  I)
virtual

Creates the filter graph and select the first available device.

Exceptions
initializationError

Implements vpFrameGrabber.

Definition at line 82 of file vpDirectShowGrabber.cpp.

◆ setDevice()

bool vpDirectShowGrabber::setDevice ( unsigned int  id)

Set the device (or camera) from which images will be grabbed.

Parameters
id: Identifier of the device to use.
Returns
true if the device is set successfully, false otherwise.
Examples:
grabDirectShowMulti.cpp.

Definition at line 121 of file vpDirectShowGrabber.cpp.

◆ setFormat()

bool vpDirectShowGrabber::setFormat ( unsigned int  width,
unsigned int  height,
double  framerate 
)

Set capture format

Parameters
width: Image width in pixel
height: Image height in pixel
framerate: Framerate in fps
Returns
true if successful

Definition at line 153 of file vpDirectShowGrabber.cpp.

◆ setFramerate()

bool vpDirectShowGrabber::setFramerate ( double  framerate)

Set capture framerate

Parameters
framerate: Framerate in fps
Returns
true if successful
Examples:
manGrabDirectShow.cpp.

Definition at line 144 of file vpDirectShowGrabber.cpp.

◆ setImageSize()

bool vpDirectShowGrabber::setImageSize ( unsigned int  width,
unsigned int  height 
)

Set image Size

Parameters
width: Image width
height: Image height
Returns
true if successful
Examples:
manGrabDirectShow.cpp.

Definition at line 134 of file vpDirectShowGrabber.cpp.

◆ setMediaType()

bool vpDirectShowGrabber::setMediaType ( int  mediaTypeID)

Set capture MediaType

Parameters
mediaTypeID: mediaTypeID (available in calling getStreamCapabilities)
 \return true if successful
Examples:
grabDirectShowMulti.cpp.

Definition at line 183 of file vpDirectShowGrabber.cpp.

Member Data Documentation

◆ height

◆ init

◆ width