![]() |
Visual Servoing Platform
version 3.3.0
|
#include <vpFlyCaptureGrabber.h>
Public Member Functions | |
vpFlyCaptureGrabber () | |
virtual | ~vpFlyCaptureGrabber () |
void | acquire (vpImage< unsigned char > &I) |
void | acquire (vpImage< unsigned char > &I, FlyCapture2::TimeStamp ×tamp) |
void | acquire (vpImage< vpRGBa > &I) |
void | acquire (vpImage< vpRGBa > &I, FlyCapture2::TimeStamp ×tamp) |
void | close () |
void | connect () |
void | disconnect () |
float | getBrightness () |
std::ostream & | getCameraInfo (std::ostream &os) |
FlyCapture2::Camera * | getCameraHandler () |
unsigned int | getCameraIndex () const |
bool | getCameraPower () |
float | getExposure () |
float | getFrameRate () |
float | getGain () |
unsigned int | getSharpness () |
float | getShutter () |
bool | isCameraPowerAvailable () |
bool | isConnected () const |
bool | isCaptureStarted () const |
bool | isFormat7Supported (FlyCapture2::Mode format7_mode) |
bool | isVideoModeAndFrameRateSupported (FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate) |
void | open (vpImage< unsigned char > &I) |
void | open (vpImage< vpRGBa > &I) |
vpFlyCaptureGrabber & | operator>> (vpImage< unsigned char > &I) |
vpFlyCaptureGrabber & | operator>> (vpImage< vpRGBa > &I) |
float | setBrightness (bool brightness_auto, float brightness_value=0) |
void | setCameraIndex (unsigned int index) |
void | setCameraPower (bool on) |
void | setCameraSerial (unsigned int serial) |
float | setExposure (bool exposure_on, bool exposure_auto, float exposure_value=0) |
float | setGain (bool gain_auto, float gain_value=0) |
void | setFormat7VideoMode (FlyCapture2::Mode format7_mode, FlyCapture2::PixelFormat pixel_format, unsigned int width, unsigned int height) |
float | setFrameRate (float frame_rate) |
unsigned int | setSharpness (bool sharpness_on, bool sharpness_auto, unsigned int sharpness_value=0) |
float | setShutter (bool auto_shutter, float shutter_ms=10) |
void | setVideoModeAndFrameRate (FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate) |
void | startCapture () |
void | stopCapture () |
Inherited functionalities from vpFramegrabber | |
unsigned int | getHeight () const |
unsigned int | getWidth () const |
Static Public Member Functions | |
static unsigned int | getCameraSerial (unsigned int index) |
static unsigned int | getNumCameras () |
Public Attributes | |
bool | init |
Protected Types | |
enum | PropertyValue { ABS_VALUE, VALUE_A } |
Protected Member Functions | |
std::pair< unsigned int, unsigned int > | centerRoi (unsigned int size, unsigned int max_size, unsigned int step) |
FlyCapture2::Property | getProperty (FlyCapture2::PropertyType prop_type) |
FlyCapture2::PropertyInfo | getPropertyInfo (FlyCapture2::PropertyType prop_type) |
void | open () |
void | setProperty (const FlyCapture2::PropertyType &prop_type, bool on, bool auto_on, float value, PropertyValue prop_value=ABS_VALUE) |
Protected Attributes | |
FlyCapture2::Camera | m_camera |
FlyCapture2::PGRGuid | m_guid |
unsigned int | m_index |
unsigned int | m_numCameras |
FlyCapture2::Image | m_rawImage |
bool | m_connected |
bool | m_capture |
unsigned int | height |
unsigned int | width |
Allows to grab images from a PointGrey camera using FlyCapture SDK.
To use this class install first FlyCapture SDK https://www.ptgrey.com/flycapture-sdk. Installation instructions are provide here https://visp.inria.fr/3rd_flycapture.
Once installed configure ViSP using cmake to detect FlyCapture SDK and build ViSP to include FlyCapture SDK support.
This class was tested under Ubuntu and Windows with the following cameras:
The following example shows how to use this class to capture images from the first camera that is found.
If more than one camera is detected, you can use setCamera(const unsigned int &) to select the camera of interest.
It is also possible to capture images from multiple cameras. The following example shows how to capture simultaneously images from multiple cameras.
Definition at line 154 of file vpFlyCaptureGrabber.h.
|
protected |
Enumerator | |
---|---|
ABS_VALUE | Consider FlyCapture2::Property::absValue. |
VALUE_A | Consider FlyCapture2::Property::valueA. |
Definition at line 215 of file vpFlyCaptureGrabber.h.
vpFlyCaptureGrabber::vpFlyCaptureGrabber | ( | ) |
Default constructor that consider the first camera found on the bus as active.
Definition at line 55 of file vpFlyCaptureGrabber.cpp.
|
virtual |
Default destructor that closes the connection with the camera.
Definition at line 64 of file vpFlyCaptureGrabber.cpp.
|
virtual |
Acquire a gray level image from the active camera.
I | : Image data structure (8 bits image). |
Implements vpFrameGrabber.
Definition at line 1099 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::acquire | ( | vpImage< unsigned char > & | I, |
FlyCapture2::TimeStamp & | timestamp | ||
) |
Acquire a gray level image from the active camera.
I | : Image data structure (8 bits image). |
timestamp | : The acquisition timestamp. |
Definition at line 1112 of file vpFlyCaptureGrabber.cpp.
Acquire a color image from the active camera.
I | : Image data structure (RGBa image). |
Implements vpFrameGrabber.
Definition at line 1150 of file vpFlyCaptureGrabber.cpp.
Acquire a color image from the active camera.
I | : Image data structure (RGBa image). |
timestamp | : The acquisition timestamp. |
Definition at line 1163 of file vpFlyCaptureGrabber.cpp.
|
protected |
Return size and offset corresponding to a centered roi.
size | : Horizontal or vertical roi size. If set to 0, use the max allowed size. |
max_size | : Allowed max size. |
step | : Step. |
Definition at line 854 of file vpFlyCaptureGrabber.cpp.
|
virtual |
Stop active camera capturing images and disconnect the active camera. If you want to use again this camera, you may call setCamera(const unsigned int &) and open(vpImage<unsigned char> &) or open(vpImage<vpRGBa> &) to connect again the camera.
Similar then calling stopCapture() and disconnect():
Implements vpFrameGrabber.
Definition at line 1088 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::connect | ( | ) |
Connect the active camera.
Definition at line 1021 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::disconnect | ( | ) |
Disconnect the active camera.
Definition at line 1056 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::getBrightness | ( | ) |
Return brightness value in %. If the camera doesn't support brightness property, return an exception.
Definition at line 266 of file vpFlyCaptureGrabber.cpp.
FlyCapture2::Camera * vpFlyCaptureGrabber::getCameraHandler | ( | ) |
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 FlyCapture SDK to get access to advanced functionalities that are not implemented in this class.
We provide here after and example that shows how to use this function to access to the camera and check if a given video mode and framerate are supported by the camera.
The following code shows how to use this function to check if a given format7 (here MODE_0, PIXEL_FORMAT_MONO8) is supported by the camera:
Definition at line 183 of file vpFlyCaptureGrabber.cpp.
|
inline |
Return the index of the active camera.
Definition at line 175 of file vpFlyCaptureGrabber.h.
std::ostream & vpFlyCaptureGrabber::getCameraInfo | ( | std::ostream & | os | ) |
Print to the output stream active camera information (serial number, camera model, camera vendor, sensor, resolution, firmaware version, ...).
Definition at line 83 of file vpFlyCaptureGrabber.cpp.
bool vpFlyCaptureGrabber::getCameraPower | ( | ) |
Return true if the camera is powered on, false otherwise
Definition at line 1270 of file vpFlyCaptureGrabber.cpp.
|
static |
Return the serial id of a camera with index.
index | : Camera index. |
The following code shows how to retrieve the serial id of all the cameras that are connected on the bus.
When two cameras are connected (PGR Flea3 in our case), we get the following:
Definition at line 345 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::getExposure | ( | ) |
Return exposure value. If the camera doesn't support exposure property, return an exception.
Definition at line 306 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::getFrameRate | ( | ) |
Return camera capture framerate. If the camera doesn't support framerate property, return an exception.
Definition at line 206 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::getGain | ( | ) |
Return camera gain value in db. If the camera doesn't support gain property, return an exception.
Definition at line 246 of file vpFlyCaptureGrabber.cpp.
|
inlineinherited |
Return the number of rows in the image.
Definition at line 113 of file vpFrameGrabber.h.
|
static |
Definition at line 68 of file vpFlyCaptureGrabber.cpp.
|
protected |
Return property values.
prop_type | : Property type. |
Definition at line 753 of file vpFlyCaptureGrabber.cpp.
|
protected |
Return information concerning a given property type.
prop_type | : Property type. |
vpException::fatalError | : If property type doesn't exist. |
Definition at line 773 of file vpFlyCaptureGrabber.cpp.
unsigned int vpFlyCaptureGrabber::getSharpness | ( | ) |
Return sharpness value. If the camera doesn't support sharpness property, return an exception.
Definition at line 286 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::getShutter | ( | ) |
Return camera shutter value in ms. If the camera doesn't support shutter property, return an exception.
Definition at line 226 of file vpFlyCaptureGrabber.cpp.
|
inlineinherited |
Return the number of columns in the image.
Definition at line 115 of file vpFrameGrabber.h.
bool vpFlyCaptureGrabber::isCameraPowerAvailable | ( | ) |
Return true if camera power is available, false otherwise.
Definition at line 1249 of file vpFlyCaptureGrabber.cpp.
|
inline |
Return true if the camera capture is started.
Definition at line 189 of file vpFlyCaptureGrabber.h.
|
inline |
Return true if the camera is connected.
Definition at line 187 of file vpFlyCaptureGrabber.h.
bool vpFlyCaptureGrabber::isFormat7Supported | ( | FlyCapture2::Mode | format7_mode | ) |
Return true if format7 mode is supported.
Definition at line 950 of file vpFlyCaptureGrabber.cpp.
bool vpFlyCaptureGrabber::isVideoModeAndFrameRateSupported | ( | FlyCapture2::VideoMode | video_mode, |
FlyCapture2::FrameRate | frame_rate | ||
) |
Return true if video mode and framerate is supported.
Definition at line 834 of file vpFlyCaptureGrabber.cpp.
|
protected |
Connect to the active camera and start capture.
Similar then calling:
Definition at line 1238 of file vpFlyCaptureGrabber.cpp.
|
virtual |
Connect to the active camera, start capture and retrieve an image.
I | : Captured image. |
Implements vpFrameGrabber.
Definition at line 1211 of file vpFlyCaptureGrabber.cpp.
Connect to the active camera, start capture and retrieve an image.
I | : Captured image. |
Implements vpFrameGrabber.
Definition at line 1221 of file vpFlyCaptureGrabber.cpp.
vpFlyCaptureGrabber & vpFlyCaptureGrabber::operator>> | ( | vpImage< unsigned char > & | I | ) |
Operator that allows to capture a grey level image.
I | : The captured image. |
Definition at line 1377 of file vpFlyCaptureGrabber.cpp.
vpFlyCaptureGrabber & vpFlyCaptureGrabber::operator>> | ( | vpImage< vpRGBa > & | I | ) |
Operator that allows to capture a grey level image.
I | : The captured image. |
Definition at line 1399 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::setBrightness | ( | bool | brightness_auto, |
float | brightness_value = 0 |
||
) |
Set camera brightness mode and parameter.
brightness_auto | : If true set auto brightness, if false set manual brightness applying brightness_value parameter. |
brightness_value | : This is the level of black in an image. A high brightness will result in a low amount of black in the image. |
The following example shows how to use this function:
Definition at line 640 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::setCameraIndex | ( | unsigned int | index | ) |
If multiples cameras are connected on the bus, select the camero to dial with.
index | : Current camera index, a value comprised between 0 (the first camera found on the bus) and the number of cameras found on the bus 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(). |
vpException::badValue | : If the index is greater or equal to the number of cameras connected to the bus. |
Definition at line 378 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::setCameraPower | ( | bool | on | ) |
Power on/off the camera.
on | : true to power on the camera, false to power off the camera. |
The following example shows how to turn off a camera.
Definition at line 1314 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::setCameraSerial | ( | unsigned int | serial_id | ) |
Set the current camera from its unique serial identifier.
serial_id | : Camera serial id. |
The following example shows how to capture images from a camera that has seial id 15290004.
Definition at line 417 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::setExposure | ( | bool | exposure_on, |
bool | exposure_auto, | ||
float | exposure_value = 0 |
||
) |
Set camera exposure mode and parameter.
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 average intensity of the image. It will use other available (non-manually adjustable) controls to adjust the image. Specifically, when shutter and gain are both in auto mode, manually adjusting the exposure is actually adjusting the auto-exposure, which tries to make the average intensity of the image 1/4 of the auto-exposure value e.g. exposure is 400, the camera will try to adjust shutter and gain so that the average image intensity is 100. When the auto-exposure mode is enabled for exposure, the camera tries to manipulate shutter and gain such that 5% of the image is saturated (pixel value of 255). |
The following example shows how to use this function:
Definition at line 693 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::setFormat7VideoMode | ( | FlyCapture2::Mode | format7_mode, |
FlyCapture2::PixelFormat | pixel_format, | ||
unsigned int | w, | ||
unsigned int | h | ||
) |
Set format7 video mode.
format7_mode | : Format 7 mode. |
pixel_format | : Pixel format. |
w,h | : Width and height of the centered roi. If set to 0, use the max allowed size. |
If the format7 video mode and pixel format are not supported, return an exception.
The following example shows how to use this fonction to capture a 640x480 roi:
Definition at line 899 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::setFrameRate | ( | float | frame_rate | ) |
Set camera frame rate.
frame_rate | : Camera frame rate (fps) to set. |
The following example shows how to use this function.
Definition at line 509 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::setGain | ( | bool | gain_auto, |
float | gain_value = 0 |
||
) |
Set camera gain mode and value.
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. |
The following example shows how to use this function:
Definition at line 596 of file vpFlyCaptureGrabber.cpp.
|
protected |
Set camera property.
prop_type | : Property type. |
on | : true to turn property on. |
auto_on | : true to turn auto mode on, false to turn manual mode. |
value | : value to set. |
prop_value | : Switch to affect value to the corresponding variable. |
Definition at line 440 of file vpFlyCaptureGrabber.cpp.
unsigned int vpFlyCaptureGrabber::setSharpness | ( | bool | sharpness_on, |
bool | sharpness_auto, | ||
unsigned int | sharpness_value = 0 |
||
) |
Set camera sharpness mode and parameter.
sharpness_on | : If true turn sharpness on, otherwise turn off. |
sharpness_auto | : If true set auto sharpness, if false set manual sharpness applying sharpness_value parameter. |
sharpness_value | : Parameter used to tune the filter applyed on the image to reduce blurred edges in an image. |
The following example shows how to use this function:
Definition at line 740 of file vpFlyCaptureGrabber.cpp.
float vpFlyCaptureGrabber::setShutter | ( | bool | auto_shutter, |
float | shutter_ms = 10 |
||
) |
Set camera shutter mode and parameter.
auto_shutter | : If true set auto shutter, if false set manual shutter applying shutter_ms parameter. |
shutter_ms | : This is the speed at which the camera shutter opens and closes in manual mode. |
The following example shows how to use this function:
Definition at line 552 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::setVideoModeAndFrameRate | ( | FlyCapture2::VideoMode | video_mode, |
FlyCapture2::FrameRate | frame_rate | ||
) |
Set video mode and framerate of the active camera.
video_mode | : Camera video mode. |
frame_rate | : Camera frame rate. |
The following example shows how to use this function to set the camera image resolution to 1280 x 960, pixel format to Y8 and capture framerate to 60 fps.
Definition at line 819 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::startCapture | ( | ) |
Start active camera capturing images.
Definition at line 972 of file vpFlyCaptureGrabber.cpp.
void vpFlyCaptureGrabber::stopCapture | ( | ) |
Stop active camera capturing images.
Definition at line 998 of file vpFlyCaptureGrabber.cpp.
|
protectedinherited |
Number of rows in the image.
Definition at line 106 of file vpFrameGrabber.h.
Referenced by vpDirectShowGrabber::getFormat().
|
inherited |
Set to true if the frame grabber has been initialized.
Definition at line 103 of file vpFrameGrabber.h.
|
protected |
Pointer to each camera.
Definition at line 227 of file vpFlyCaptureGrabber.h.
|
protected |
true is capture started
Definition at line 233 of file vpFlyCaptureGrabber.h.
|
protected |
true if camera connected
Definition at line 232 of file vpFlyCaptureGrabber.h.
|
protected |
Active camera guid.
Definition at line 228 of file vpFlyCaptureGrabber.h.
|
protected |
Active camera index.
Definition at line 229 of file vpFlyCaptureGrabber.h.
|
protected |
Number of connected cameras.
Definition at line 230 of file vpFlyCaptureGrabber.h.
|
protected |
Image buffer.
Definition at line 231 of file vpFlyCaptureGrabber.h.
|
protectedinherited |
Number of columns in the image.
Definition at line 107 of file vpFrameGrabber.h.
Referenced by vpDirectShowGrabber::getFormat().