MRPT
2.0.1
|
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 181 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 CImageGrabber_FlyCapture2 &)=delete | |
CImageGrabber_FlyCapture2 & | operator= (const CImageGrabber_FlyCapture2 &)=delete |
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 {nullptr} |
Opaque pointer to the FlyCapture2::Camera object. More... | |
void * | m_camera_info {nullptr} |
Opaque pointer to the FlyCapture2::CameraInfo object. More... | |
void * | m_img_buffer {nullptr} |
Opaque pointer to the FlyCapture2::Image, used as a temporary buffer and to avoid mem alloc/reallocs. More... | |
void * | m_triclops {nullptr} |
Opaque pointer to the TriclopsContext objetc. More... | |
float | m_baseline |
Camera baseline (only for stereo cameras) More... | |
float | m_focalLength |
Camera focal length. More... | |
float | m_centerCol |
Camera center coordinates. More... | |
float | m_centerRow |
TCaptureOptions_FlyCapture2 | m_options |
Camera options. More... | |
CImageGrabber_FlyCapture2::CImageGrabber_FlyCapture2 | ( | ) |
Constructor that does not open a camera.
Default constructor.
Definition at line 234 of file CImageGrabber_FlyCapture2.cpp.
References m_img_buffer.
|
delete |
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 242 of file CImageGrabber_FlyCapture2.cpp.
References m_img_buffer, and open().
|
virtual |
Destructor.
Definition at line 256 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 618 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 224 of file CImageGrabber_FlyCapture2.h.
References m_options.
|
static |
Returns the PGR FlyCapture2 library version.
Definition at line 672 of file CImageGrabber_FlyCapture2.cpp.
References 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 691 of file CImageGrabber_FlyCapture2.cpp.
References CHECK_FC2_ERROR, mrpt::obs::gnss::error, FC2_BUF_IMG, FC2_CAM, mrpt::obs::CObservationImage::image, mrpt::img::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 755 of file CImageGrabber_FlyCapture2.cpp.
References mrpt::obs::CObservationStereoImages::cameraPose, CHECK_FC2_ERROR, mrpt::img::DEEP_COPY, FC2_CAM, mrpt::obs::CObservationStereoImages::hasImageRight, mrpt::obs::CObservationStereoImages::imageLeft, mrpt::obs::CObservationStereoImages::imageRight, mrpt::obs::CObservationStereoImages::leftCamera, m_baseline, m_camera, m_centerCol, m_centerRow, m_focalLength, mrpt::system::now(), mrpt::poses::CPose3DQuat::quat(), mrpt::math::CQuaternion< T >::r(), mrpt::obs::CObservationStereoImages::rightCamera, mrpt::obs::CObservationStereoImages::rightCameraPose, mrpt::img::TCamera::setIntrinsicParamsFromValues(), THROW_EXCEPTION, mrpt::system::time_tToTimestamp(), mrpt::obs::CObservation::timestamp, mrpt::math::CQuaternion< T >::x(), mrpt::poses::CPoseOrPoint< DERIVEDCLASS, DIM >::x(), mrpt::math::CQuaternion< T >::y(), mrpt::poses::CPoseOrPoint< DERIVEDCLASS, DIM >::y(), and mrpt::math::CQuaternion< T >::z().
|
inline |
Returns if current configuration is stereo or not.
Definition at line 276 of file CImageGrabber_FlyCapture2.h.
References m_options, and 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 267 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::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().
|
delete |
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 549 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 567 of file CImageGrabber_FlyCapture2.cpp.
References CHECK_FC2_ERROR, mrpt::obs::gnss::error, m_camera, THROW_EXCEPTION, and THROW_EXCEPTION_FMT.
Referenced by mrpt::hwdrivers::CCameraSensor::initialize().
void CImageGrabber_FlyCapture2::stopCapture | ( | ) |
Stop capture.
Definition at line 600 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 199 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Opaque pointer to the FlyCapture2::Camera object.
nullptr if no camera is grabbing.
Definition at line 186 of file CImageGrabber_FlyCapture2.h.
Referenced by close(), getObservation(), open(), startCapture(), startSyncCapture(), and stopCapture().
|
protected |
Opaque pointer to the FlyCapture2::CameraInfo object.
nullptr if no camera is grabbing.
Definition at line 189 of file CImageGrabber_FlyCapture2.h.
|
protected |
Camera center coordinates.
Definition at line 203 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Definition at line 203 of file CImageGrabber_FlyCapture2.h.
Referenced by getObservation(), and open().
|
protected |
Camera focal length.
Definition at line 201 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 192 of file CImageGrabber_FlyCapture2.h.
Referenced by CImageGrabber_FlyCapture2(), and ~CImageGrabber_FlyCapture2().
|
protected |
Camera options.
Definition at line 206 of file CImageGrabber_FlyCapture2.h.
Referenced by getCameraOptions(), isStereo(), and open().
|
protected |
Opaque pointer to the TriclopsContext objetc.
nullptr if no context is active.
Definition at line 195 of file CImageGrabber_FlyCapture2.h.
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |