Visual Servoing Platform  version 3.2.0
vpFlyCaptureGrabber Class Reference

#include <vpFlyCaptureGrabber.h>

+ Inheritance diagram for vpFlyCaptureGrabber:

Public Member Functions

 vpFlyCaptureGrabber ()
 
virtual ~vpFlyCaptureGrabber ()
 
void acquire (vpImage< unsigned char > &I)
 
void acquire (vpImage< unsigned char > &I, FlyCapture2::TimeStamp &timestamp)
 
void acquire (vpImage< vpRGBa > &I)
 
void acquire (vpImage< vpRGBa > &I, FlyCapture2::TimeStamp &timestamp)
 
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)
 
vpFlyCaptureGrabberoperator>> (vpImage< unsigned char > &I)
 
vpFlyCaptureGrabberoperator>> (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
 

Detailed Description

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.

Note
To install FlyCapture SDK on linux follow https://www.ptgrey.com/tan/10548.
For specific details about using FlyCapture and Linux with a USB 3.0 camera, see http://www.ptgrey.com/KB/10685.

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:

  • Flea3 USB 3.0 cameras (FL3-U3-32S2M-CS, FL3-U3-13E4C-C)
  • Flea2 firewire camera (FL2-03S2C)
  • Dragonfly2 firewire camera (DR2-COL)

The following example shows how to use this class to capture images from the first camera that is found.

#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
try {
int nframes = 100;
char filename[255];
std::cout << "Number of cameras detected: " << g.getNumCameras() << std::endl;
g.setCameraIndex(0); // Default camera is the first on the bus
g.getCameraInfo(std::cout);
g.open(I);
for(int i=0; i< nframes; i++) {
g.acquire(I);
sprintf(filename, "image%04d.pgm", i);
vpImageIo::write(I, filename);
}
#endif
}

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.

#include <visp3/core/vpImage.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
int nframes = 100;
char filename[255];
unsigned int numCameras = vpFlyCaptureGrabber::getNumCameras();
std::cout << "Number of cameras detected: " << numCameras << std::endl;
std::vector< vpImage<unsigned char> > I(numCameras);
for(unsigned int cam=0; cam < numCameras; cam++) {
g[cam].setCameraIndex(cam); // Default camera is the first on the bus
g[cam].getCameraInfo(std::cout);
g[cam].open(I[cam]);
}
for(int i=0; i< nframes; i++) {
for(unsigned int cam=0; cam < numCameras; cam++) {
g[cam].acquire(I[cam]);
sprintf(filename, "image-camera%d-%04d.pgm", cam, i);
vpImageIo::write(I[cam], filename);
}
}
delete [] g;
#endif
}
Examples
grabFlyCapture.cpp, tutorial-apriltag-detector-live.cpp, tutorial-grabber-flycapture.cpp, tutorial-mb-generic-tracker-live.cpp, and tutorial-pose-from-points-live.cpp.

Definition at line 146 of file vpFlyCaptureGrabber.h.

Member Enumeration Documentation

◆ PropertyValue

Enumerator
ABS_VALUE 

Consider FlyCapture2::Property::absValue.

VALUE_A 

Consider FlyCapture2::Property::valueA.

Definition at line 207 of file vpFlyCaptureGrabber.h.

Constructor & Destructor Documentation

◆ vpFlyCaptureGrabber()

vpFlyCaptureGrabber::vpFlyCaptureGrabber ( )

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

Definition at line 55 of file vpFlyCaptureGrabber.cpp.

◆ ~vpFlyCaptureGrabber()

vpFlyCaptureGrabber::~vpFlyCaptureGrabber ( )
virtual

Default destructor that closes the connection with the camera.

Definition at line 64 of file vpFlyCaptureGrabber.cpp.

Member Function Documentation

◆ acquire() [1/4]

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

Acquire a gray level image from the active camera.

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

Implements vpFrameGrabber.

Examples
grabFlyCapture.cpp, and tutorial-grabber-flycapture.cpp.

Definition at line 1099 of file vpFlyCaptureGrabber.cpp.

◆ acquire() [2/4]

void vpFlyCaptureGrabber::acquire ( vpImage< unsigned char > &  I,
FlyCapture2::TimeStamp &  timestamp 
)

Acquire a gray level image from the active camera.

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

Definition at line 1112 of file vpFlyCaptureGrabber.cpp.

◆ acquire() [3/4]

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

Acquire a color image from the active camera.

Parameters
I: Image data structure (RGBa image).

Implements vpFrameGrabber.

Definition at line 1151 of file vpFlyCaptureGrabber.cpp.

◆ acquire() [4/4]

void vpFlyCaptureGrabber::acquire ( vpImage< vpRGBa > &  I,
FlyCapture2::TimeStamp &  timestamp 
)

Acquire a color image from the active camera.

Parameters
I: Image data structure (RGBa image).
timestamp: The acquisition timestamp.

Definition at line 1164 of file vpFlyCaptureGrabber.cpp.

◆ centerRoi()

std::pair< unsigned int, unsigned int > vpFlyCaptureGrabber::centerRoi ( unsigned int  size,
unsigned int  max_size,
unsigned int  step 
)
protected

Return size and offset corresponding to a centered roi.

Parameters
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.

◆ close()

void vpFlyCaptureGrabber::close ( )
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.

◆ connect()

void vpFlyCaptureGrabber::connect ( )

Connect the active camera.

See also
disconnect()

Definition at line 1021 of file vpFlyCaptureGrabber.cpp.

◆ disconnect()

void vpFlyCaptureGrabber::disconnect ( )

Disconnect the active camera.

See also
connect()

Definition at line 1056 of file vpFlyCaptureGrabber.cpp.

◆ getBrightness()

float vpFlyCaptureGrabber::getBrightness ( )

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

std::cout << "Brightness value: " << g.getBrightness() << " %" << std::endl;
See also
setBrightness()

Definition at line 266 of file vpFlyCaptureGrabber.cpp.

◆ getCameraHandler()

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.

#include <visp3/core/vpImage.h>
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
int nframes = 100;
g.connect();
FlyCapture2::Camera *handler = g.getCameraHandler();
bool supported = false;
handler->GetVideoModeAndFrameRateInfo(FlyCapture2::VIDEOMODE_1280x960Y8, FlyCapture2::FRAMERATE_60, &supported);
if (supported)
g.setVideoModeAndFrameRate(FlyCapture2::VIDEOMODE_1280x960Y8, FlyCapture2::FRAMERATE_60); g.startCapture();
for(int i=0; i< nframes; i++) {
g.acquire(I);
}
#endif
}

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:

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
g.connect();
FlyCapture2::Camera *handler = g.getCameraHandler();
// Query for available Format 7 modes
const FlyCapture2::Mode k_fmt7Mode = FlyCapture2::MODE_0;
const FlyCapture2::PixelFormat k_fmt7PixFmt = FlyCapture2::PIXEL_FORMAT_MONO8;
FlyCapture2::Format7Info fmt7Info;
bool supported;
fmt7Info.mode = k_fmt7Mode;
FlyCapture2::Error error = handler->GetFormat7Info( &fmt7Info, &supported );
if (error != FlyCapture2::PGRERROR_OK) {
error.PrintErrorTrace();
return -1;
}
if (supported) {
std::cout << "Max image pixels: (" << fmt7Info.maxWidth << ", " << fmt7Info.maxHeight << ")" << std::endl;
std::cout << "Image Unit size: (" << fmt7Info.imageHStepSize << ", " << fmt7Info.imageVStepSize << ")"
<< std::endl;
std::cout << "Offset Unit size: (" << fmt7Info.offsetHStepSize << ", " << fmt7Info.offsetVStepSize << ")"
<< std::endl;
std::cout << "Pixel format bitfield: 0x" << fmt7Info.pixelFormatBitField << std::endl;
if ( (k_fmt7PixFmt & fmt7Info.pixelFormatBitField) == 0 ) {
// Pixel format not supported!
std::cout << "Pixel format is not supported" << std::endl;
return -1;
}
}
#endif
}

Definition at line 183 of file vpFlyCaptureGrabber.cpp.

◆ getCameraIndex()

unsigned int vpFlyCaptureGrabber::getCameraIndex ( ) const
inline

Return the index of the active camera.

Examples
grabFlyCapture.cpp.

Definition at line 167 of file vpFlyCaptureGrabber.h.

◆ getCameraInfo()

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.

◆ getCameraPower()

bool vpFlyCaptureGrabber::getCameraPower ( )

Return true if the camera is powered on, false otherwise

See also
setCameraPower()

Definition at line 1272 of file vpFlyCaptureGrabber.cpp.

◆ getCameraSerial()

unsigned int vpFlyCaptureGrabber::getCameraSerial ( unsigned int  index)
static

Return the serial id of a camera with index.

Parameters
index: Camera index.

The following code shows how to retrieve the serial id of all the cameras that are connected on the bus.

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
unsigned int num_cameras = vpFlyCaptureGrabber::getNumCameras();
for (unsigned int i=0; i<num_cameras; i++) {
unsigned int serial_id = vpFlyCaptureGrabber::getCameraSerial(i);
std::cout << "Camera with index " << i << " has serial id: " << serial_id << std::endl;
}
#endif
}

When two cameras are connected (PGR Flea3 in our case), we get the following:

Camera with index 0 has serial id: 15372913
Camera with index 1 has serial id: 15290004
See also
setCameraSerial()
Examples
grabFlyCapture.cpp.

Definition at line 345 of file vpFlyCaptureGrabber.cpp.

◆ getExposure()

float vpFlyCaptureGrabber::getExposure ( )

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

std::cout << "Exposure value: " << g.getExposure() << std::endl;
See also
setExposure()

Definition at line 306 of file vpFlyCaptureGrabber.cpp.

◆ getFrameRate()

float vpFlyCaptureGrabber::getFrameRate ( )

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

std::cout << "Frame rate: " << g.getFrameRate() << " fps" << std::endl;
See also
setFrameRate()

Definition at line 206 of file vpFlyCaptureGrabber.cpp.

◆ getGain()

float vpFlyCaptureGrabber::getGain ( )

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

std::cout << "Gain value: " << g.getGain() << " ms" << std::endl;
See also
setGain()

Definition at line 246 of file vpFlyCaptureGrabber.cpp.

◆ 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 113 of file vpFrameGrabber.h.

◆ getNumCameras()

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

Definition at line 68 of file vpFlyCaptureGrabber.cpp.

◆ getProperty()

FlyCapture2::Property vpFlyCaptureGrabber::getProperty ( FlyCapture2::PropertyType  prop_type)
protected

Return property values.

Parameters
prop_type: Property type.

Definition at line 753 of file vpFlyCaptureGrabber.cpp.

◆ getPropertyInfo()

FlyCapture2::PropertyInfo vpFlyCaptureGrabber::getPropertyInfo ( FlyCapture2::PropertyType  prop_type)
protected

Return information concerning a given property type.

Parameters
prop_type: Property type.
Exceptions
vpException::fatalError: If property type doesn't exist.

Definition at line 773 of file vpFlyCaptureGrabber.cpp.

◆ getSharpness()

unsigned int vpFlyCaptureGrabber::getSharpness ( )

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

std::cout << "Sharpness value: " << g.getSharpness() << std::endl;
See also
setSharpness()

Definition at line 286 of file vpFlyCaptureGrabber.cpp.

◆ getShutter()

float vpFlyCaptureGrabber::getShutter ( )

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

std::cout << "Shutter value: " << g.getShutter() << " ms" << std::endl;
See also
setShutter()

Definition at line 226 of file vpFlyCaptureGrabber.cpp.

◆ 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 115 of file vpFrameGrabber.h.

◆ isCameraPowerAvailable()

bool vpFlyCaptureGrabber::isCameraPowerAvailable ( )

Return true if camera power is available, false otherwise.

See also
getCameraPower(), setCameraPowerOn(), setCameraPowerOff()

Definition at line 1251 of file vpFlyCaptureGrabber.cpp.

◆ isCaptureStarted()

bool vpFlyCaptureGrabber::isCaptureStarted ( ) const
inline

Return true if the camera capture is started.

Definition at line 181 of file vpFlyCaptureGrabber.h.

◆ isConnected()

bool vpFlyCaptureGrabber::isConnected ( ) const
inline

Return true if the camera is connected.

Definition at line 179 of file vpFlyCaptureGrabber.h.

◆ isFormat7Supported()

bool vpFlyCaptureGrabber::isFormat7Supported ( FlyCapture2::Mode  format7_mode)

Return true if format7 mode is supported.

Definition at line 950 of file vpFlyCaptureGrabber.cpp.

◆ isVideoModeAndFrameRateSupported()

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.

◆ open() [1/3]

void vpFlyCaptureGrabber::open ( )
protected

Connect to the active camera and start capture.

Similar then calling:

Definition at line 1240 of file vpFlyCaptureGrabber.cpp.

◆ open() [2/3]

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

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

Parameters
I: Captured image.

Implements vpFrameGrabber.

Examples
grabFlyCapture.cpp, tutorial-apriltag-detector-live.cpp, tutorial-grabber-flycapture.cpp, tutorial-mb-generic-tracker-live.cpp, and tutorial-pose-from-points-live.cpp.

Definition at line 1213 of file vpFlyCaptureGrabber.cpp.

◆ open() [3/3]

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

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

Parameters
I: Captured image.

Implements vpFrameGrabber.

Definition at line 1223 of file vpFlyCaptureGrabber.cpp.

◆ operator>>() [1/2]

vpFlyCaptureGrabber & vpFlyCaptureGrabber::operator>> ( vpImage< unsigned char > &  I)

Operator that allows to capture a grey level image.

Parameters
I: The captured image.
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
g >> I;
}

Definition at line 1379 of file vpFlyCaptureGrabber.cpp.

◆ operator>>() [2/2]

vpFlyCaptureGrabber & vpFlyCaptureGrabber::operator>> ( vpImage< vpRGBa > &  I)

Operator that allows to capture a grey level image.

Parameters
I: The captured image.
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
g >> I;
}

Definition at line 1401 of file vpFlyCaptureGrabber.cpp.

◆ setBrightness()

float vpFlyCaptureGrabber::setBrightness ( bool  brightness_auto,
float  brightness_value = 0 
)

Set camera brightness mode and parameter.

Parameters
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.
Returns
The measured brightness after applying the new setting.

The following example shows how to use this function:

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
float brightness = g.getBrightness();
std::cout << "Brightness : " << brightness << " %" << std::endl;
brightness = g.setBrightness(false, 2); // Turn manual brightness on to 2%
std::cout << "Brightness manual: " << brightness << " %" << std::endl;
brightness = g.setBrightness(true); // Turn auto brightness on
std::cout << "Brightness auto : " << brightness << " %" << std::endl;
g.open(I);
...
#endif
}
See also
getBrightness()

Definition at line 640 of file vpFlyCaptureGrabber.cpp.

◆ setCameraIndex()

void vpFlyCaptureGrabber::setCameraIndex ( unsigned int  index)

If multiples cameras are connected on the bus, select the camero 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 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().
Exceptions
vpException::badValue: If the index is greater or equal to the number of cameras connected to the bus.
Examples
grabFlyCapture.cpp.

Definition at line 378 of file vpFlyCaptureGrabber.cpp.

◆ setCameraPower()

void vpFlyCaptureGrabber::setCameraPower ( bool  on)

Power on/off the camera.

Parameters
on: true to power on the camera, false to power off the camera.

The following example shows how to turn off a camera.

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
g.connect();
bool power = g.getCameraPower();
std::cout << "Camera is powered: " << ((power == true) ? "on" : "off") << std::endl;
if (power)
g.setCameraPower(false); // Power off the camera
#endif
}
See also
getCameraPower()

Definition at line 1316 of file vpFlyCaptureGrabber.cpp.

◆ setCameraSerial()

void vpFlyCaptureGrabber::setCameraSerial ( unsigned int  serial_id)

Set the current camera from its unique serial identifier.

Parameters
serial_id: Camera serial id.

The following example shows how to capture images from a camera that has seial id 15290004.

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
int nframes = 100;
g.setCameraSerial(15290004); // Set camera with serial id
g.open(I);
g.getCameraInfo(std::cout);
for(int i=0; i< nframes; i++) {
g.acquire(I);
}
#endif
}
See also
getCameraSerial()

Definition at line 417 of file vpFlyCaptureGrabber.cpp.

◆ setExposure()

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

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 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).
Returns
The measured brightness after applying the new setting.

The following example shows how to use this function:

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
float exposure = g.getExposure();
std::cout << "Exposure : " << exposure << std::endl;
exposure = g.setExposure(true, false, 1); // Turn manual exposure on to 1
std::cout << "Exposure manual: " << exposure << std::endl;
exposure = g.setExposure(true, true); // Turn auto exposure on
std::cout << "Exposure auto : " << exposure << std::endl;
g.open(I);
...
#endif
}
See also
getExposure()

Definition at line 693 of file vpFlyCaptureGrabber.cpp.

◆ setFormat7VideoMode()

void vpFlyCaptureGrabber::setFormat7VideoMode ( FlyCapture2::Mode  format7_mode,
FlyCapture2::PixelFormat  pixel_format,
unsigned int  width,
unsigned int  height 
)

Set format7 video mode.

Parameters
format7_mode: Format 7 mode.
pixel_format: Pixel format.
width,height: Size 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:

#include <iomanip>
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
g.setFormat7VideoMode(FlyCapture2::MODE_0, FlyCapture2::PIXEL_FORMAT_MONO8, 640, 480);
g.open(I);
...
#endif
}

Definition at line 899 of file vpFlyCaptureGrabber.cpp.

◆ setFrameRate()

float vpFlyCaptureGrabber::setFrameRate ( float  frame_rate)

Set camera frame rate.

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

The following example shows how to use this function.

#include <iomanip>
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
float framerate = g.getFrameRate();
std::cout << "Cur frame rate: " << std::fixed << std::setprecision(3) << framerate << " fps" << std::endl;
framerate = g.setFrameRate(30); // Set framerate to 30 fps
std::cout << "New frame rate: " << std::fixed << std::setprecision(3) << framerate << " fps" << std::endl;
g.open(I);
while (1)
g.acquire(I);
#endif
}
See also
getFramerate()

Definition at line 509 of file vpFlyCaptureGrabber.cpp.

◆ setGain()

float vpFlyCaptureGrabber::setGain ( bool  gain_auto,
float  gain_value = 0 
)

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.

The following example shows how to use this function:

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
float gain_db = g.getGain();
std::cout << "Gain: " << gain_db << " db" << std::endl;
gain_db = g.setGain(false, 5); // Turn manual gain on to 5db
std::cout << "Gain manual: " << gain_db << " db" << std::endl;
gain_db = g.setGain(true); // Turn auto shutter on
std::cout << "Gain auto : " << gain_db << " db" << std::endl;
g.open(I);
...
#endif
}
See also
getGain()
Examples
tutorial-grabber-flycapture.cpp.

Definition at line 596 of file vpFlyCaptureGrabber.cpp.

◆ setProperty()

void vpFlyCaptureGrabber::setProperty ( const FlyCapture2::PropertyType &  prop_type,
bool  on,
bool  auto_on,
float  value,
PropertyValue  prop_value = ABS_VALUE 
)
protected

Set camera property.

Parameters
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.

◆ setSharpness()

unsigned int vpFlyCaptureGrabber::setSharpness ( bool  sharpness_on,
bool  sharpness_auto,
unsigned int  sharpness_value = 0 
)

Set camera sharpness mode and parameter.

Parameters
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.
Returns
The measured sharpness after applying the new setting.

The following example shows how to use this function:

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
float sharpness = g.getSharpness();
std::cout << "Sharpness : " << sharpness << std::endl;
sharpness = g.setSharpness(true, false, 1000); // Turn manual sharpness on to 1000
std::cout << "Sharpness manual: " << sharpness << std::endl;
sharpness = g.setSharpness(true, true); // Turn auto sharpness on
std::cout << "Sharpness auto : " << sharpness << std::endl;
g.open(I);
...
#endif
}
See also
getSharpness()

Definition at line 740 of file vpFlyCaptureGrabber.cpp.

◆ setShutter()

float vpFlyCaptureGrabber::setShutter ( bool  auto_shutter,
float  shutter_ms = 10 
)

Set camera shutter mode and parameter.

Parameters
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.
Returns
The measured shutter after applying the new setting.

The following example shows how to use this function:

#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
float shutter_ms = g.getShutter();
std::cout << "Shutter : " << shutter_ms << " ms" << std::endl;
shutter_ms = g.setShutter(false, 10); // Turn manual shutter on to 10ms
std::cout << "Shutter manual: " << shutter_ms << " ms" << std::endl;
shutter_ms = g.setShutter(true); // Turn auto shutter on
std::cout << "Shutter auto : " << shutter_ms << " ms" << std::endl;
g.open(I);
...
#endif
}
See also
getShutter()
Examples
tutorial-grabber-flycapture.cpp.

Definition at line 552 of file vpFlyCaptureGrabber.cpp.

◆ setVideoModeAndFrameRate()

void vpFlyCaptureGrabber::setVideoModeAndFrameRate ( FlyCapture2::VideoMode  video_mode,
FlyCapture2::FrameRate  frame_rate 
)

Set video mode and framerate of the active camera.

Parameters
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.

#include <visp3/core/vpImage.h>
#include <visp3/sensor/vpFlyCaptureGrabber.h>
int main()
{
#if defined(VISP_HAVE_FLYCAPTURE)
int nframes = 100;
g.setCameraIndex(0); // Default camera is the first on the bus
g.setVideoModeAndFrameRate(FlyCapture2::VIDEOMODE_1280x960Y8, FlyCapture2::FRAMERATE_60);
g.open(I);
g.getCameraInfo(std::cout);
for(int i=0; i< nframes; i++) {
g.acquire(I);
}
#endif
}
Examples
tutorial-grabber-flycapture.cpp.

Definition at line 819 of file vpFlyCaptureGrabber.cpp.

◆ startCapture()

void vpFlyCaptureGrabber::startCapture ( )

Start active camera capturing images.

See also
stopCapture()

Definition at line 972 of file vpFlyCaptureGrabber.cpp.

◆ stopCapture()

void vpFlyCaptureGrabber::stopCapture ( )

Stop active camera capturing images.

See also
startCapture()

Definition at line 998 of file vpFlyCaptureGrabber.cpp.

Member Data Documentation

◆ height

unsigned int vpFrameGrabber::height
protectedinherited

Number of rows in the image.

Definition at line 106 of file vpFrameGrabber.h.

Referenced by vpDirectShowGrabber::getFormat().

◆ init

bool vpFrameGrabber::init
inherited

Set to true if the frame grabber has been initialized.

Definition at line 103 of file vpFrameGrabber.h.

◆ m_camera

FlyCapture2::Camera vpFlyCaptureGrabber::m_camera
protected

Pointer to each camera.

Definition at line 219 of file vpFlyCaptureGrabber.h.

◆ m_capture

bool vpFlyCaptureGrabber::m_capture
protected

true is capture started

Definition at line 225 of file vpFlyCaptureGrabber.h.

◆ m_connected

bool vpFlyCaptureGrabber::m_connected
protected

true if camera connected

Definition at line 224 of file vpFlyCaptureGrabber.h.

◆ m_guid

FlyCapture2::PGRGuid vpFlyCaptureGrabber::m_guid
protected

Active camera guid.

Definition at line 220 of file vpFlyCaptureGrabber.h.

◆ m_index

unsigned int vpFlyCaptureGrabber::m_index
protected

Active camera index.

Definition at line 221 of file vpFlyCaptureGrabber.h.

◆ m_numCameras

unsigned int vpFlyCaptureGrabber::m_numCameras
protected

Number of connected cameras.

Definition at line 222 of file vpFlyCaptureGrabber.h.

◆ m_rawImage

FlyCapture2::Image vpFlyCaptureGrabber::m_rawImage
protected

Image buffer.

Definition at line 223 of file vpFlyCaptureGrabber.h.

◆ width

unsigned int vpFrameGrabber::width
protectedinherited

Number of columns in the image.

Definition at line 107 of file vpFrameGrabber.h.

Referenced by vpDirectShowGrabber::getFormat().

vpFlyCaptureGrabber::stopCapture
void stopCapture()
Definition: vpFlyCaptureGrabber.cpp:998
vpFlyCaptureGrabber::getCameraPower
bool getCameraPower()
Definition: vpFlyCaptureGrabber.cpp:1272
vpFlyCaptureGrabber::disconnect
void disconnect()
Definition: vpFlyCaptureGrabber.cpp:1056
vpFlyCaptureGrabber::setGain
float setGain(bool gain_auto, float gain_value=0)
Definition: vpFlyCaptureGrabber.cpp:596
vpFlyCaptureGrabber::setSharpness
unsigned int setSharpness(bool sharpness_on, bool sharpness_auto, unsigned int sharpness_value=0)
Definition: vpFlyCaptureGrabber.cpp:740
vpFlyCaptureGrabber::connect
void connect()
Definition: vpFlyCaptureGrabber.cpp:1021
vpFlyCaptureGrabber::getFrameRate
float getFrameRate()
Definition: vpFlyCaptureGrabber.cpp:206
vpFlyCaptureGrabber::acquire
void acquire(vpImage< unsigned char > &I)
Definition: vpFlyCaptureGrabber.cpp:1099
vpFlyCaptureGrabber::getSharpness
unsigned int getSharpness()
Definition: vpFlyCaptureGrabber.cpp:286
vpFlyCaptureGrabber::setFormat7VideoMode
void setFormat7VideoMode(FlyCapture2::Mode format7_mode, FlyCapture2::PixelFormat pixel_format, unsigned int width, unsigned int height)
Definition: vpFlyCaptureGrabber.cpp:899
vpFlyCaptureGrabber::setCameraSerial
void setCameraSerial(unsigned int serial)
Definition: vpFlyCaptureGrabber.cpp:417
vpFlyCaptureGrabber::setExposure
float setExposure(bool exposure_on, bool exposure_auto, float exposure_value=0)
Definition: vpFlyCaptureGrabber.cpp:693
vpFlyCaptureGrabber::getGain
float getGain()
Definition: vpFlyCaptureGrabber.cpp:246
vpFlyCaptureGrabber::getCameraInfo
std::ostream & getCameraInfo(std::ostream &os)
Definition: vpFlyCaptureGrabber.cpp:83
vpFlyCaptureGrabber::getCameraSerial
static unsigned int getCameraSerial(unsigned int index)
Definition: vpFlyCaptureGrabber.cpp:345
vpFlyCaptureGrabber::setVideoModeAndFrameRate
void setVideoModeAndFrameRate(FlyCapture2::VideoMode video_mode, FlyCapture2::FrameRate frame_rate)
Definition: vpFlyCaptureGrabber.cpp:819
vpFlyCaptureGrabber::getNumCameras
static unsigned int getNumCameras()
Definition: vpFlyCaptureGrabber.cpp:68
vpFlyCaptureGrabber::startCapture
void startCapture()
Definition: vpFlyCaptureGrabber.cpp:972
vpFlyCaptureGrabber::setCameraPower
void setCameraPower(bool on)
Definition: vpFlyCaptureGrabber.cpp:1316
vpFlyCaptureGrabber::getShutter
float getShutter()
Definition: vpFlyCaptureGrabber.cpp:226
vpImageIo::write
static void write(const vpImage< unsigned char > &I, const std::string &filename)
Definition: vpImageIo.cpp:374
vpFlyCaptureGrabber::setBrightness
float setBrightness(bool brightness_auto, float brightness_value=0)
Definition: vpFlyCaptureGrabber.cpp:640
vpFlyCaptureGrabber::setShutter
float setShutter(bool auto_shutter, float shutter_ms=10)
Definition: vpFlyCaptureGrabber.cpp:552
vpFlyCaptureGrabber::setFrameRate
float setFrameRate(float frame_rate)
Definition: vpFlyCaptureGrabber.cpp:509
vpFlyCaptureGrabber::getCameraHandler
FlyCapture2::Camera * getCameraHandler()
Definition: vpFlyCaptureGrabber.cpp:183
vpFlyCaptureGrabber::getExposure
float getExposure()
Definition: vpFlyCaptureGrabber.cpp:306
vpFlyCaptureGrabber
Definition: vpFlyCaptureGrabber.h:146
vpFlyCaptureGrabber::getBrightness
float getBrightness()
Definition: vpFlyCaptureGrabber.cpp:266
vpImage< unsigned char >
vpFlyCaptureGrabber::open
void open(vpImage< unsigned char > &I)
Definition: vpFlyCaptureGrabber.cpp:1213
vpFlyCaptureGrabber::setCameraIndex
void setCameraIndex(unsigned int index)
Definition: vpFlyCaptureGrabber.cpp:378