Visual Servoing Platform
version 3.6.1 under development (2024-12-13)
|
#include <visp3/sensor/vpUeyeGrabber.h>
Public Member Functions | |
vpUeyeGrabber () | |
virtual | ~vpUeyeGrabber () |
void | acquire (vpImage< unsigned char > &I, double *timestamp_camera=nullptr, std::string *timestamp_system=nullptr) |
void | acquire (vpImage< vpRGBa > &I, double *timestamp_camera=nullptr, std::string *timestamp_system=nullptr) |
std::string | getActiveCameraModel () const |
std::string | getActiveCameraSerialNumber () const |
std::vector< unsigned int > | getCameraIDList () const |
std::vector< std::string > | getCameraModelList () const |
std::vector< std::string > | getCameraSerialNumberList () const |
double | getFramerate () const |
unsigned int | getFrameHeight () const |
unsigned int | getFrameWidth () const |
bool | isConnected () const |
void | loadParameters (const std::string &filename) |
void | open (vpImage< unsigned char > &I) |
void | open (vpImage< vpRGBa > &I) |
bool | setActiveCamera (unsigned int cam_index) |
bool | setColorMode (const std::string &color_mode) |
bool | setExposure (bool auto_exposure, double exposure_ms=-1) |
bool | setFrameRate (bool auto_frame_rate, double manual_frame_rate_hz=-1) |
bool | setGain (bool auto_gain, int master_gain=-1, bool gain_boost=false) |
void | setSubsampling (int factor) |
void | setVerbose (bool verbose) |
void | setWhiteBalance (bool auto_wb) |
Allows to grab images from an IDS camera using uEye SDK.
This class was tested with IDS UI328xCP-C and UI328xCP-C camera models.
By default, the first connected camera is the active one. The following code shows how to get information about all the connected cameras (index, id, model, serial number):
If multiple cameras are connected, to select a specific one use the following code:
Create an image container, either for gray level or color images:
Then call open() to connect the active camera:
From here you can modify camera default settings,
ueyedemo
binary: Depending on the settings, you may update image container size, especially if you want to create a window to display the image:
Now you can create an infinite loop to grab images:
Definition at line 84 of file vpUeyeGrabber.h.
vpUeyeGrabber::vpUeyeGrabber | ( | ) |
Default constructor. By default, the active camera is the first one that is found. To select a specific camera use setActiveCamera().
Definition at line 1143 of file vpUeyeGrabber.cpp.
|
virtual |
Destructor.
Definition at line 1148 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::acquire | ( | vpImage< unsigned char > & | I, |
double * | timestamp_camera = nullptr , |
||
std::string * | timestamp_system = nullptr |
||
) |
Capture a new grayscale image.
[out] | I | : Captured image. |
[out] | timestamp_camera | : Time of image capture in milli-seconds with a resolution of 0.1 us, or nullptr if not wanted. The time of image capture is defined as:
|
[out] | timestamp_system | : Time with a resolution of 1 ms synchronized with the PC's system time, and resynchronized every 60 seconds. This may cause minor time shifts (average time about 3 ms). The format of the string is the following: YYYY:MM:DD:HH:MM:SS:mmm for year, month, day, hour, minute, second, millisecond. |
To determine the exact interval between two image captures, it is therefore recommended to read out the camera timestamp provided in timestamp_camera
.
Definition at line 1171 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::acquire | ( | vpImage< vpRGBa > & | I, |
double * | timestamp_camera = nullptr , |
||
std::string * | timestamp_system = nullptr |
||
) |
Capture a new color image.
[out] | I | : Captured image. |
[out] | timestamp_camera | : Time of image capture in milli-seconds with a resolution of 0.1 us, or nullptr if not wanted. The time of image capture is defined as:
|
[out] | timestamp_system | : Time with a resolution of 1 ms synchronized with the PC's system time, and resynchronized every 60 seconds. This may cause minor time shifts (average time about 3 ms). The format of the string is the following: YYYY:MM:DD:HH:MM:SS:mmm for year, month, day, hour, minute, second, millisecond. |
To determine the exact interval between two image captures, it is therefore recommended to read out the camera timestamp provided in timestamp_camera
.
Definition at line 1196 of file vpUeyeGrabber.cpp.
std::string vpUeyeGrabber::getActiveCameraModel | ( | ) | const |
Get active camera model.
Definition at line 1206 of file vpUeyeGrabber.cpp.
std::string vpUeyeGrabber::getActiveCameraSerialNumber | ( | ) | const |
Get active camera serial number.
Definition at line 1213 of file vpUeyeGrabber.cpp.
std::vector< unsigned int > vpUeyeGrabber::getCameraIDList | ( | ) | const |
Get camera ID list.
Definition at line 1222 of file vpUeyeGrabber.cpp.
std::vector< std::string > vpUeyeGrabber::getCameraModelList | ( | ) | const |
Get camera model list.
Definition at line 1231 of file vpUeyeGrabber.cpp.
std::vector< std::string > vpUeyeGrabber::getCameraSerialNumberList | ( | ) | const |
Get camera serial number list.
Definition at line 1240 of file vpUeyeGrabber.cpp.
unsigned int vpUeyeGrabber::getFrameHeight | ( | ) | const |
Return image width captured by the active camera.
Definition at line 1260 of file vpUeyeGrabber.cpp.
double vpUeyeGrabber::getFramerate | ( | ) | const |
Returns the current number of frames actually captured per second. This function needs to be called after acquire().
Definition at line 1251 of file vpUeyeGrabber.cpp.
unsigned int vpUeyeGrabber::getFrameWidth | ( | ) | const |
Return image height captured by the active camera.
Definition at line 1269 of file vpUeyeGrabber.cpp.
bool vpUeyeGrabber::isConnected | ( | ) | const |
Return true if a camera is connected, false otherwise.
Definition at line 1274 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::loadParameters | ( | const std::string & | filename | ) |
Load camera parameters from an .ini
file.
[in] | filename | : Camera parameters file that contains camera settings. Such a file could be produced using ueyedemo binary provided with IDS uEye Software Suite |
Definition at line 1281 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::open | ( | vpImage< unsigned char > & | I | ) |
Starts the driver and establishes the connection to the camera.
[out] | I | : Grayscale image that is resized to match the capture settings. |
Definition at line 1287 of file vpUeyeGrabber.cpp.
Starts the driver and establishes the connection to the camera.
[out] | I | : Color image that is resized to match the capture settings. |
Definition at line 1293 of file vpUeyeGrabber.cpp.
bool vpUeyeGrabber::setActiveCamera | ( | unsigned int | cam_index | ) |
Select a camera from the camera list.
cam_index | : Camera index. |
Definition at line 1300 of file vpUeyeGrabber.cpp.
bool vpUeyeGrabber::setColorMode | ( | const std::string & | color_mode | ) |
Updates active camera color mode.
[in] | color_mode | : Desired color mode. Admissible values are "MONO8", "RGB8", "RGB32" or "BAYER8". |
Definition at line 1320 of file vpUeyeGrabber.cpp.
bool vpUeyeGrabber::setExposure | ( | bool | auto_exposure, |
double | exposure_ms = -1 |
||
) |
Updates active camera exposure / shutter either to auto mode, or to specified manual parameters.
[in] | auto_exposure | : When true enable camera's hardware auto exposure / shutter. This function returns false if the camera does not support auto exposure mode. When set to false, set manual exposure time. |
[in] | exposure_ms | : Manual exposure setting time in ms. Valid value range depends on active camera pixel clock rate. |
Definition at line 1338 of file vpUeyeGrabber.cpp.
bool vpUeyeGrabber::setFrameRate | ( | bool | auto_frame_rate, |
double | manual_frame_rate_hz = -1 |
||
) |
Updates active camera frame rate either to auto mode, or to a specified manual value.
Enabling auto frame rate mode requires to enable auto shutter mode. Enabling auto frame rate mode will disable auto gain mode.
[in] | auto_frame_rate | : Updates camera's hardware auto frame rate mode. When true enable auto frame rate mode. When set to false, enables manual frame rate mode. |
[in] | manual_frame_rate_hz | : Desired manual frame rate in Hz. Valid value range depends on current camera pixel clock rate. This parameter is only used when auto frame rate is disabled. |
A typical usage is the following:
Definition at line 1373 of file vpUeyeGrabber.cpp.
bool vpUeyeGrabber::setGain | ( | bool | auto_gain, |
int | master_gain = -1 , |
||
bool | gain_boost = false |
||
) |
Updates active camera gain either to auto mode, or to specified manual parameters.
Auto gain mode is disabled if auto frame rate mode is enabled.
[in] | auto_gain | : Updates camera's hardware auto gain mode.
|
[in] | master_gain | : Manual master gain percentage in range 0 - 100. |
[in] | gain_boost | : Only in manual mode, enable/disable gain boost. |
Definition at line 1394 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::setSubsampling | ( | int | factor | ) |
Updates active camera image subsampling factor to reduce image size.
[in] | factor | : Desired subsampling factor. The number of rows and columns of the resulting image corresponds to the full resolution image size divided by this factor. |
Definition at line 1409 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::setVerbose | ( | bool | verbose | ) |
Enable/disable verbose mode.
[in] | verbose | : true to enable, false to disable verbose mode. |
Definition at line 1428 of file vpUeyeGrabber.cpp.
void vpUeyeGrabber::setWhiteBalance | ( | bool | auto_wb | ) |
Enables or disables the active camera auto white balance mode.
auto_wb | : If true enable auto white balance mode. If false, disable auto white balance mode. |
Definition at line 1421 of file vpUeyeGrabber.cpp.