Visual Servoing Platform  version 3.1.0
vpPylonGrabberGigE Class Reference

#include "vpPylonGrabberGigE.h"

+ Inheritance diagram for vpPylonGrabberGigE:

Public Types

enum  UserSetName {
  USERSET_DEFAULT, USERSET_USERSET1, USERSET_USERSET2, USERSET_USERSET3,
  USERSET_UNKNOWN
}
 

Public Member Functions

 vpPylonGrabberGigE ()
 
 ~vpPylonGrabberGigE ()
 
void acquire (vpImage< unsigned char > &I)
 
void acquire (vpImage< vpRGBa > &I)
 
void close ()
 
void connect ()
 
void disconnect ()
 
float getBlackLevel ()
 
std::ostream & getCameraInfo (std::ostream &os)
 
Pylon::CInstantCamera * getCameraHandler ()
 
unsigned int getCameraIndex () const
 
std::string getCameraSerial (unsigned int index)
 
float getExposure ()
 
float getFrameRate ()
 
float getGain ()
 
unsigned int getNumCameras ()
 
float getGamma ()
 
bool loadUserSet (UserSetName user_set)
 
UserSetName getUserSetDefault ()
 
bool isConnected () const
 
bool isCaptureStarted () const
 
void open (vpImage< unsigned char > &I)
 
void open (vpImage< vpRGBa > &I)
 
vpPylonGrabberoperator>> (vpImage< unsigned char > &I)
 
vpPylonGrabberoperator>> (vpImage< vpRGBa > &I)
 
float setBlackLevel (float blacklevel_value=0)
 
void setCameraIndex (unsigned int index)
 
void setCameraSerial (const std::string &serial)
 
float setExposure (bool exposure_on, bool exposure_auto, float exposure_value=0)
 
float setGain (bool gain_auto, float gain_value=0)
 
float setFrameRate (float frame_rate)
 
float setGamma (bool gamma_on, float gamma_value=1)
 
bool saveUserSet (UserSetName user_set, bool set_default=false)
 
bool setUserSetDefault (UserSetName user_set)
 
void startCapture ()
 
void stopCapture ()
 
Inherited functionalities from vpFramegrabber
unsigned int getHeight () const
 
unsigned int getWidth () const
 

Public Attributes

bool init
 

Protected Member Functions

void open ()
 
bool selectUserSet (UserSetName user_set)
 

Protected Attributes

unsigned int height
 
unsigned int width
 

Detailed Description

Allows to grab images from a Basler GigE camera using Pylon SDK.

This class should not be instantiated directly. Use vpPylonFactory::createPylonGrabber() instead.

Definition at line 65 of file vpPylonGrabberGigE.h.

Member Enumeration Documentation

◆ UserSetName

Valid values for user set names.

Enumerator
USERSET_DEFAULT 

The default user set.

USERSET_USERSET1 

User set 1.

USERSET_USERSET2 

User set 2.

USERSET_USERSET3 

User set 3.

USERSET_UNKNOWN 

User set not supported.

Definition at line 106 of file vpPylonGrabber.h.

Constructor & Destructor Documentation

◆ vpPylonGrabberGigE()

vpPylonGrabberGigE::vpPylonGrabberGigE ( )

Default constructor that consider the first camera found on the bus as active.

Definition at line 55 of file vpPylonGrabberGigE.cpp.

References getNumCameras().

◆ ~vpPylonGrabberGigE()

vpPylonGrabberGigE::~vpPylonGrabberGigE ( )

Default destructor that closes the connection with the camera.

Definition at line 63 of file vpPylonGrabberGigE.cpp.

References close().

Member Function Documentation

◆ acquire() [1/2]

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

Acquire a gray level image from the active camera.

Parameters
I: Image data structure (8 bits image).

Implements vpPylonGrabber.

Definition at line 651 of file vpPylonGrabberGigE.cpp.

References vpImage< Type >::bitmap, vpException::fatalError, getCameraSerial(), vpFrameGrabber::height, open(), vpImage< Type >::resize(), and vpFrameGrabber::width.

Referenced by open(), and operator>>().

◆ acquire() [2/2]

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

Acquire a color image from the active camera.

Parameters
I: Image data structure (RGBa image).

Implements vpPylonGrabber.

Definition at line 680 of file vpPylonGrabberGigE.cpp.

References vpException::fatalError, getCameraSerial(), vpFrameGrabber::height, open(), vpImage< Type >::resize(), and vpFrameGrabber::width.

◆ close()

void vpPylonGrabberGigE::close ( )
virtual

Stop active camera capturing images and disconnect the active camera.

If you want to use again this camera, you may call setCameraIndex(const unsigned int &) and open(vpImage<unsigned char> &) or open(vpImage<vpRGBa> &) to connect again the camera.

Implements vpPylonGrabber.

Definition at line 640 of file vpPylonGrabberGigE.cpp.

References disconnect(), and stopCapture().

Referenced by ~vpPylonGrabberGigE().

◆ connect()

◆ disconnect()

void vpPylonGrabberGigE::disconnect ( )
virtual

Disconnect the active camera.

See also
connect()

Implements vpPylonGrabber.

Definition at line 620 of file vpPylonGrabberGigE.cpp.

References vpFrameGrabber::init.

Referenced by close().

◆ getBlackLevel()

float vpPylonGrabberGigE::getBlackLevel ( )
virtual

Return blacklevel value in % or raw value. If the camera doesn't support blacklevel property, return an exception.

According to SFNC (standard feature naming convention) of GenICam standard, Black level is used instead of brightness.

See "Terminology Changes" section of the page: https://www.ptgrey.com/kb/11020?countryid=237

See also
setBlackLevel()

Implements vpPylonGrabber.

Definition at line 167 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ getCameraHandler()

Pylon::CInstantCamera * vpPylonGrabberGigE::getCameraHandler ( )
virtual

Return the handler to the active camera or NULL if the camera is not connected. This function was designed to provide a direct access to the Pylon SDK to get access to advanced functionalities that are not implemented in this class.

Implements vpPylonGrabber.

Definition at line 113 of file vpPylonGrabberGigE.cpp.

References connect().

◆ getCameraIndex()

unsigned int vpPylonGrabberGigE::getCameraIndex ( ) const
inlinevirtual

◆ getCameraInfo()

std::ostream & vpPylonGrabberGigE::getCameraInfo ( std::ostream &  os)
virtual

Print to the output stream active camera information (serial number, camera model, camera vendor, sensor, resolution, firmware version, ...).

Implements vpPylonGrabber.

Definition at line 86 of file vpPylonGrabberGigE.cpp.

References connect().

◆ getCameraSerial()

std::string vpPylonGrabberGigE::getCameraSerial ( unsigned int  index)
virtual

Return the serial id of a camera with index.

Parameters
index: Camera index.
See also
setCameraSerial()

Implements vpPylonGrabber.

Definition at line 222 of file vpPylonGrabberGigE.cpp.

References vpException::badValue, and getNumCameras().

Referenced by acquire(), and setCameraSerial().

◆ getExposure()

float vpPylonGrabberGigE::getExposure ( )
virtual

Return exposure value in ms. If the camera doesn't support exposure property, return an exception.

According to SFNC (standard feature naming convention) of GenICam standard, Exposure is used and deprecates shutter.

See "Terminology Changes" section of the page: https://www.ptgrey.com/kb/11020?countryid=237

See also
setExposure()

Implements vpPylonGrabber.

Definition at line 190 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ getFrameRate()

float vpPylonGrabberGigE::getFrameRate ( )
virtual

Return camera capture framerate. If the camera doesn't support framerate property, return an exception.

See also
setFrameRate()

Implements vpPylonGrabber.

Definition at line 130 of file vpPylonGrabberGigE.cpp.

References connect().

◆ getGain()

float vpPylonGrabberGigE::getGain ( )
virtual

Return camera gain value in dB or raw value. If the camera doesn't support gain property, return an exception.

See also
setGain()

Implements vpPylonGrabber.

Definition at line 144 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ getGamma()

float vpPylonGrabberGigE::getGamma ( )
virtual

Return gamma correction value. If the camera doesn't support gamma property, return an exception.

See also
setGamma()

Implements vpPylonGrabber.

Definition at line 208 of file vpPylonGrabberGigE.cpp.

References connect().

◆ getHeight()

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.

◆ getNumCameras()

unsigned int vpPylonGrabberGigE::getNumCameras ( )
virtual
Returns
Return the number of cameras connected on the bus.

Implements vpPylonGrabber.

Definition at line 68 of file vpPylonGrabberGigE.cpp.

Referenced by connect(), getCameraSerial(), setCameraSerial(), and vpPylonGrabberGigE().

◆ getUserSetDefault()

vpPylonGrabber::UserSetName vpPylonGrabberGigE::getUserSetDefault ( )
virtual

◆ getWidth()

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.

◆ isCaptureStarted()

◆ isConnected()

bool vpPylonGrabberGigE::isConnected ( ) const
inlinevirtual

Return true if the camera is connected.

Implements vpPylonGrabber.

Definition at line 93 of file vpPylonGrabberGigE.h.

◆ loadUserSet()

bool vpPylonGrabberGigE::loadUserSet ( UserSetName  user_set)
virtual

Loads the selected configuration into the camera's volatile memory and makes it the active configuration set.

Parameters
user_setSee vpPylonGrabber::UserSetName for valid values.
Returns
true for finished, false otherwise.
See also
saveUserSet()

Implements vpPylonGrabber.

Definition at line 252 of file vpPylonGrabberGigE.cpp.

References connect(), selectUserSet(), and vpTime::wait().

◆ open() [1/3]

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

Connect to the active camera, start capture and retrieve an image.

Parameters
I: Captured image.

Implements vpPylonGrabber.

Definition at line 719 of file vpPylonGrabberGigE.cpp.

References acquire(), and open().

◆ open() [2/3]

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

Connect to the active camera, start capture and retrieve an image.

Parameters
I: Captured image.

Implements vpPylonGrabber.

Definition at line 729 of file vpPylonGrabberGigE.cpp.

References acquire(), and open().

◆ open() [3/3]

void vpPylonGrabberGigE::open ( )
protected

Connect to the active camera and start capture.

Similar then calling:

Definition at line 746 of file vpPylonGrabberGigE.cpp.

References connect(), and startCapture().

Referenced by acquire(), and open().

◆ operator>>() [1/2]

vpPylonGrabber & vpPylonGrabberGigE::operator>> ( vpImage< unsigned char > &  I)
virtual

Operator that allows to capture a grey level image.

Parameters
I: The captured image.

Implements vpPylonGrabber.

Definition at line 790 of file vpPylonGrabberGigE.cpp.

References acquire().

◆ operator>>() [2/2]

vpPylonGrabber & vpPylonGrabberGigE::operator>> ( vpImage< vpRGBa > &  I)
virtual

Operator that allows to capture a color image.

Parameters
I: The captured image.

Implements vpPylonGrabber.

Definition at line 800 of file vpPylonGrabberGigE.cpp.

References acquire().

◆ saveUserSet()

bool vpPylonGrabberGigE::saveUserSet ( UserSetName  user_set,
bool  set_default = false 
)
virtual

Saves the current active configuration set into the selected user set.

Parameters
user_setSee vpPylonGrabber::UserSetName for valid values.
set_defaultWhether to set the configuration set to be used as the default startup set.
Returns
true for finished, false otherwise.
See also
loadUserSet()

Implements vpPylonGrabber.

Definition at line 495 of file vpPylonGrabberGigE.cpp.

References connect(), selectUserSet(), setUserSetDefault(), and vpTime::wait().

◆ selectUserSet()

bool vpPylonGrabberGigE::selectUserSet ( UserSetName  user_set)
protected

Selects the configuration set to load, save, or configure.

Parameters
user_setSee vpPylonGrabber::UserSetName for valid values.
Returns
true for success, false for failure.

Default User Set is read-only and cannot be modified.

Definition at line 760 of file vpPylonGrabberGigE.cpp.

References connect(), vpPylonGrabber::USERSET_DEFAULT, vpPylonGrabber::USERSET_USERSET1, vpPylonGrabber::USERSET_USERSET2, and vpPylonGrabber::USERSET_USERSET3.

Referenced by loadUserSet(), and saveUserSet().

◆ setBlackLevel()

float vpPylonGrabberGigE::setBlackLevel ( float  blacklevel_value = 0)
virtual

Set camera blacklevel mode and parameter.

Parameters
blacklevel_value: This is the level of black in an image. A high blacklevel will result in a low amount of black in the image.
Returns
The measured blacklevel after applying the new setting.

According to SFNC (standard feature naming convention) of GenICam standard, Black level is used instead of brightness.

See "Terminology Changes" section of the page: https://www.ptgrey.com/kb/11020?countryid=237

See also
getBlackLevel()

Implements vpPylonGrabber.

Definition at line 403 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ setCameraIndex()

void vpPylonGrabberGigE::setCameraIndex ( unsigned int  index)
virtual

If multiples cameras are connected on the bus, select the camera to dial with.

Parameters
index: Current camera index, a value comprised between 0 (the first camera found on the bus) and the number of cameras found and returned by getNumCameras() minus 1.

If two cameras are connected on the bus, setting index to one allows to communicate with the second one. This identifier is not unique. That is why, it is also possible to select a camera by its serial number, which is unique using setCameraSerial().

Exceptions
vpException::badValue: If the index is greater or equal to the number of cameras connected to the bus.

Implements vpPylonGrabber.

Definition at line 313 of file vpPylonGrabberGigE.cpp.

References vpException::badValue.

◆ setCameraSerial()

void vpPylonGrabberGigE::setCameraSerial ( const std::string &  serial)
virtual

Set the current camera from its unique serial identifier.

Parameters
serial: Camera serial string.
See also
getCameraSerial()

Implements vpPylonGrabber.

Definition at line 329 of file vpPylonGrabberGigE.cpp.

References vpException::badValue, getCameraSerial(), and getNumCameras().

◆ setExposure()

float vpPylonGrabberGigE::setExposure ( bool  exposure_on,
bool  exposure_auto,
float  exposure_value = 0 
)
virtual

Set camera exposure mode and parameter.

Parameters
exposure_on: If true turn exposure on, otherwise turn off.
exposure_auto: If true set auto exposure, if false set manual exposure applying exposure_value parameter.
exposure_value: This is the exposure value in ms.
Returns
The measured exposure time in ms after applying the new setting.

According to SFNC (standard feature naming convention) of GenICam standard, Exposure is used and deprecates shutter.

See "Terminology Changes" section of the page: https://www.ptgrey.com/kb/11020?countryid=237

See also
getExposure()

Implements vpPylonGrabber.

Definition at line 434 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ setFrameRate()

float vpPylonGrabberGigE::setFrameRate ( float  frame_rate)
virtual

Set camera frame rate.

Parameters
frame_rate: Camera frame rate (fps) to set.
Returns
The camera current framerate.
See also
getFramerate()

Implements vpPylonGrabber.

Definition at line 348 of file vpPylonGrabberGigE.cpp.

References connect().

◆ setGain()

float vpPylonGrabberGigE::setGain ( bool  gain_auto,
float  gain_value = 0 
)
virtual

Set camera gain mode and value.

Parameters
gain_auto: If true set auto gain, if false set manual gain applying gain_value parameter.
gain_value: The amount of amplification that is applied to a pixel in manual mode. An increase in gain can result in an increase in noise.
Returns
The measured gain after applying the new setting.
See also
getGain()

Implements vpPylonGrabber.

Definition at line 370 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ setGamma()

float vpPylonGrabberGigE::setGamma ( bool  gamma_on,
float  gamma_value = 1 
)
virtual

Set camera gamma correction mode and parameter.

Parameters
gamma_on: If true turn gamma correction on, otherwise turn off.
gamma_value: Parameter used to perform gamma correction of pixel intensity.
Returns
The measured gamma correction value after applying the new setting.
See also
getGamma()

Implements vpPylonGrabber.

Definition at line 470 of file vpPylonGrabberGigE.cpp.

References connect(), and vpException::notImplementedError.

◆ setUserSetDefault()

bool vpPylonGrabberGigE::setUserSetDefault ( UserSetName  user_set)
virtual

Sets the configuration set to be used as the default startup set.

Parameters
user_setSee vpPylonGrabber::UserSetName for valid values.
Returns
true for finished, false otherwise.
See also
getUserSetDefault()

Implements vpPylonGrabber.

Definition at line 522 of file vpPylonGrabberGigE.cpp.

References connect(), vpPylonGrabber::USERSET_DEFAULT, vpPylonGrabber::USERSET_USERSET1, vpPylonGrabber::USERSET_USERSET2, and vpPylonGrabber::USERSET_USERSET3.

Referenced by saveUserSet().

◆ startCapture()

void vpPylonGrabberGigE::startCapture ( )
virtual

Start active camera capturing images.

See also
stopCapture()

Implements vpPylonGrabber.

Definition at line 553 of file vpPylonGrabberGigE.cpp.

References connect(), and vpFrameGrabber::init.

Referenced by open().

◆ stopCapture()

void vpPylonGrabberGigE::stopCapture ( )
virtual

Stop active camera capturing images.

See also
startCapture()

Implements vpPylonGrabber.

Definition at line 571 of file vpPylonGrabberGigE.cpp.

References vpFrameGrabber::init.

Referenced by close().

Member Data Documentation

◆ height

◆ init

◆ width