A wrapper for Point Gray Research (PGR) FlyCapture2 API for capturing images from Firewire, USB3 or GigaE cameras and stereo cameras.
This class is only available when compiling MRPT with "MRPT_HAS_PGR_FLYCAPTURE2".
Definition at line 131 of file CImageGrabber_FlyCapture2.h.
#include <mrpt/hwdrivers/CImageGrabber_FlyCapture2.h>
Public Member Functions | |
CImageGrabber_FlyCapture2 () | |
Constructor that does not open a camera. More... | |
CImageGrabber_FlyCapture2 (const TCaptureOptions_FlyCapture2 &options) | |
Constructor: tries to open the camera with the given options. More... | |
virtual | ~CImageGrabber_FlyCapture2 () |
Destructor. More... | |
const TCaptureOptions_FlyCapture2 & | getCameraOptions () const |
Returns the current settings of the camera. More... | |
void | open (const TCaptureOptions_FlyCapture2 &options, const bool startCapture=true) |
Tries to open the camera with the given options, and starts capture. More... | |
void | startCapture () |
Start the actual image capture of the camera. More... | |
void | stopCapture () |
Stop capture. More... | |
void | close () |
Stop capture and closes the opened camera, if any. More... | |
bool | getObservation (mrpt::obs::CObservationImage &out_observation) |
Grab mono image from the camera. More... | |
bool | getObservation (mrpt::obs::CObservationStereoImages &out_observation) |
Grab stereo image from the camera. More... | |
bool | isStereo () |
Returns if current configuration is stereo or not. More... | |
Static Public Member Functions | |
static void | startSyncCapture (int numCameras, const CImageGrabber_FlyCapture2 **cameras_array) |
Starts a synchronous capture of several cameras, which must have been already opened. More... | |
static std::string | getFC2version () |
Returns the PGR FlyCapture2 library version. More... | |
Protected Attributes | |
void * | m_camera |
Opaque pointer to the FlyCapture2::Camera object. NULL if no camera is grabbing. More... | |
void * | m_camera_info |
Opaque pointer to the FlyCapture2::CameraInfo object. NULL if no camera is grabbing. More... | |
void * | m_img_buffer |
Opaque pointer to the FlyCapture2::Image, used as a temporary buffer and to avoid mem alloc/reallocs. More... | |
void * | m_triclops |
Opaque pointer to the TriclopsContext objetc. NULL if no context is active. More... | |
float | m_baseline |
Camera baseline (only for stereo cameras) More... | |
float | m_focalLength |
Camera focal length. More... | |
float | m_centerCol |
float | m_centerRow |
Camera center coordinates. More... | |
TCaptureOptions_FlyCapture2 | m_options |
Camera options. More... | |
CImageGrabber_FlyCapture2::CImageGrabber_FlyCapture2 | ( | ) |
Constructor that does not open a camera.
Default constructor.
Definition at line 227 of file CImageGrabber_FlyCapture2.cpp.
References m_img_buffer.
CImageGrabber_FlyCapture2::CImageGrabber_FlyCapture2 | ( | const TCaptureOptions_FlyCapture2 & | options | ) |
Constructor: tries to open the camera with the given options.
Constructor + open.
Raises an exception on error.
Definition at line 239 of file CImageGrabber_FlyCapture2.cpp.
References m_img_buffer, and open().
|
virtual |
Destructor.
Definition at line 252 of file CImageGrabber_FlyCapture2.cpp.
References close(), FC2_BUF_IMG, and m_img_buffer.
void CImageGrabber_FlyCapture2::close | ( | ) |
Stop capture and closes the opened camera, if any.
Closes the opened camera, if any.
Called automatically on object destruction.
Definition at line 588 of file CImageGrabber_FlyCapture2.cpp.
References FC2_CAM, FC2_CAM_INFO, m_camera, m_camera_info, m_triclops, stopCapture(), THROW_EXCEPTION, and TRI_CONTEXT.
Referenced by open(), and ~CImageGrabber_FlyCapture2().
|
inline |
Returns the current settings of the camera.
Definition at line 157 of file CImageGrabber_FlyCapture2.h.
|
static |
Returns the PGR FlyCapture2 library version.
Definition at line 619 of file CImageGrabber_FlyCapture2.cpp.
References mrpt::mrpt::format(), and THROW_EXCEPTION.
Referenced by open().
bool CImageGrabber_FlyCapture2::getObservation | ( | mrpt::obs::CObservationImage & | out_observation | ) |
Grab mono image from the camera.
This method blocks until the next frame is captured.
Definition at line 635 of file CImageGrabber_FlyCapture2.cpp.
References CHECK_FC2_ERROR, mrpt::obs::gnss::error, FC2_BUF_IMG, FC2_CAM, mrpt::obs::CObservationImage::image, mrpt::utils::CImage::loadFromMemoryBuffer(), m_camera, mrpt::system::now(), THROW_EXCEPTION, mrpt::system::time_tToTimestamp(), and mrpt::obs::CObservation::timestamp.
bool CImageGrabber_FlyCapture2::getObservation | ( | mrpt::obs::CObservationStereoImages & | out_observation | ) |
Grab stereo image from the camera.
This method blocks until the next frame is captured.
Definition at line 686 of file CImageGrabber_FlyCapture2.cpp.
References mrpt::obs::CObservationStereoImages::cameraPose, CHECK_FC2_ERROR, CHECK_TRICLOPS_ERROR, FC2_CAM, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::get_rectified, mrpt::obs::CObservationStereoImages::imageLeft, mrpt::obs::CObservationStereoImages::imageRight, mrpt::obs::CObservationStereoImages::leftCamera, m_baseline, m_camera, m_centerCol, m_centerRow, m_focalLength, m_options, mrpt::system::os::memcpy(), mrpt::system::now(), mrpt::poses::CPose3DQuat::quat(), mrpt::math::CQuaternion< T >::r(), mrpt::obs::CObservationStereoImages::rightCamera, mrpt::obs::CObservationStereoImages::rightCameraPose, mrpt::utils::CImage::setFromIplImage(), mrpt::utils::TCamera::setIntrinsicParamsFromValues(), THROW_EXCEPTION, mrpt::system::time_tToTimestamp(), mrpt::obs::CObservation::timestamp, TRI_CONTEXT, mrpt::math::CQuaternion< T >::x(), mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::x(), mrpt::math::CQuaternion< T >::y(), mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::y(), and mrpt::math::CQuaternion< T >::z().
|
inline |
Returns if current configuration is stereo or not.
Definition at line 194 of file CImageGrabber_FlyCapture2.h.
References mrpt::hwdrivers::TCaptureOptions_FlyCapture2::stereo_mode.
void CImageGrabber_FlyCapture2::open | ( | const TCaptureOptions_FlyCapture2 & | options, |
const bool | startCapture = true |
||
) |
Tries to open the camera with the given options, and starts capture.
Tries to open the camera with the given options.
Raises an exception on error.
[in] | startCapture | If set to false, the camera is only opened and configured, but a posterior call to startCapture() is required to start grabbing images. |
Raises an exception on error.
Definition at line 262 of file CImageGrabber_FlyCapture2.cpp.
References mrpt::hwdrivers::TCaptureOptions_FlyCapture2::autoexposure_abs, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::autoexposure_auto, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::autoexposure_EV, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::autoexposure_onOff, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::camera_guid, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::camera_index, CHECK_FC2_ERROR, CHECK_TRICLOPS_ERROR, close(), mrpt::obs::gnss::error, FC2_CAM, FC2_CAM_INFO, mrpt::mrpt::format(), mrpt::hwdrivers::TCaptureOptions_FlyCapture2::framerate, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::gain_abs, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::gain_auto, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::gain_dB, getFC2version(), mrpt::hwdrivers::TCaptureOptions_FlyCapture2::grabmode, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::grabTimeout, m_baseline, m_camera, m_camera_info, m_centerCol, m_centerRow, m_focalLength, m_options, m_triclops, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::numBuffers, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::open_by_guid, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::rect_height, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::rect_width, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::shutter_abs, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::shutter_auto, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::shutter_time_ms, startCapture(), mrpt::hwdrivers::TCaptureOptions_FlyCapture2::stereo_mode, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::strobe_delay, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::strobe_duration, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::strobe_enabled, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::strobe_polarity, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::strobe_source, THROW_EXCEPTION, TRI_CONTEXT, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::trigger_enabled, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::trigger_mode, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::trigger_polarity, mrpt::hwdrivers::TCaptureOptions_FlyCapture2::trigger_source, and mrpt::hwdrivers::TCaptureOptions_FlyCapture2::videomode.
Referenced by CImageGrabber_FlyCapture2().
void CImageGrabber_FlyCapture2::startCapture | ( | ) |
Start the actual image capture of the camera.
Must be called after open(), only when "startCapture" was set to false.
Must be called after open(), only when "startCapture" was set to false.
Definition at line 530 of file CImageGrabber_FlyCapture2.cpp.
References CHECK_FC2_ERROR, mrpt::obs::gnss::error, FC2_CAM, m_camera, and THROW_EXCEPTION.
Referenced by open().
|
static |
Starts a synchronous capture of several cameras, which must have been already opened.
NOTE: This method only works with Firewire cameras, not with USB3 or GigaE ones (as confirmed by PGR support service).
Definition at line 544 of file CImageGrabber_FlyCapture2.cpp.
References CHECK_FC2_ERROR, mrpt::obs::gnss::error, THROW_EXCEPTION, and THROW_EXCEPTION_FMT.
Referenced by mrpt::hwdrivers::CCameraSensor::initialize().
void CImageGrabber_FlyCapture2::stopCapture | ( | ) |
Stop capture.
Definition at line 570 of file CImageGrabber_FlyCapture2.cpp.
References CHECK_FC2_ERROR, mrpt::obs::gnss::error, FC2_CAM, m_camera, and THROW_EXCEPTION.
Referenced by close().
|
protected |
Camera baseline (only for stereo cameras)
Definition at line 140 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Opaque pointer to the FlyCapture2::Camera object. NULL if no camera is grabbing.
Definition at line 134 of file CImageGrabber_FlyCapture2.h.
Referenced by close(), getObservation(), open(), startCapture(), and stopCapture().
|
protected |
Opaque pointer to the FlyCapture2::CameraInfo object. NULL if no camera is grabbing.
Definition at line 135 of file CImageGrabber_FlyCapture2.h.
|
protected |
Definition at line 142 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Camera center coordinates.
Definition at line 142 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Camera focal length.
Definition at line 141 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Opaque pointer to the FlyCapture2::Image, used as a temporary buffer and to avoid mem alloc/reallocs.
Definition at line 136 of file CImageGrabber_FlyCapture2.h.
Referenced by CImageGrabber_FlyCapture2(), and ~CImageGrabber_FlyCapture2().
|
protected |
Camera options.
Definition at line 144 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Opaque pointer to the TriclopsContext objetc. NULL if no context is active.
Definition at line 137 of file CImageGrabber_FlyCapture2.h.
Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020 |