Main MRPT website > C++ reference for MRPT 1.9.9
CStereoGrabber_Bumblebee_libdc1394.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "hwdrivers-precomp.h" // Only for precomp. headers, include all libmrpt-core headers.
11 
13 #include <map>
14 
15 using namespace std;
16 using namespace mrpt;
17 using namespace mrpt::obs;
18 using namespace mrpt::hwdrivers;
19 
20 CStereoGrabber_Bumblebee_libdc1394::CStereoGrabber_Bumblebee_libdc1394(
21  uint64_t cameraGUID, uint16_t cameraUnit, double frameRate)
22  : m_firewire_capture(nullptr), m_bInitialized(false)
23 {
25 
26  TCaptureOptions_dc1394 opt1394;
27  opt1394.mode7 = 3; // stereo cameras are captured with MODE7-3
28  opt1394.deinterlace_stereo = true; // It is stereo.
29 
30  std::map<double, grabber_dc1394_framerate_t> Rs;
31  Rs[1.875] = FRAMERATE_1_875;
32  Rs[3.75] = FRAMERATE_3_75;
33  Rs[7.5] = FRAMERATE_7_5;
34  Rs[15] = FRAMERATE_15;
35  Rs[30] = FRAMERATE_30;
36  Rs[60] = FRAMERATE_60;
37  Rs[120] = FRAMERATE_120;
38  Rs[240] = FRAMERATE_240;
39 
40  if (Rs.find(frameRate) != Rs.end())
41  opt1394.framerate = Rs[frameRate];
42  else
43  cerr << "[CStereoGrabber_Bumblebee_libdc1394] Ignoring unknown "
44  "framerate: "
45  << frameRate << "\n";
46 
48  new CImageGrabber_dc1394(cameraGUID, cameraUnit, opt1394);
49 
50  if (!m_firewire_capture->isOpen())
51  cerr << "[CStereoGrabber_Bumblebee] The camera couldn't be open"
52  << endl;
53 
55 }
56 
57 /*-------------------------------------------------------------
58  Destructor
59  -------------------------------------------------------------*/
61 {
63  {
64  delete m_firewire_capture;
65  m_firewire_capture = nullptr;
66  }
67 }
68 
69 /*-------------------------------------------------------------
70  get the image
71  -------------------------------------------------------------*/
73  mrpt::obs::CObservationStereoImages& out_observation)
74 {
75  if (!m_firewire_capture->isOpen())
76  {
77  cerr << "[CStereoGrabber_Bumblebee] The camera couldn't be open"
78  << endl;
79  return false;
80  }
81 
82  if (!m_firewire_capture->getObservation(out_observation)) return false;
83 
84  return true; // All ok
85 }
mrpt::hwdrivers::CStereoGrabber_Bumblebee_libdc1394::getStereoObservation
bool getStereoObservation(mrpt::obs::CObservationStereoImages &out_observation)
Grab stereo images, and return the pair of rectified images.
Definition: CStereoGrabber_Bumblebee_libdc1394.cpp:72
mrpt::hwdrivers::CImageGrabber_dc1394::isOpen
bool isOpen() const
Check whether the camera has been open successfully.
Definition: CImageGrabber_dc1394.h:189
uint16_t
unsigned __int16 uint16_t
Definition: rptypes.h:44
mrpt::hwdrivers::FRAMERATE_240
@ FRAMERATE_240
Definition: CImageGrabber_dc1394.h:30
mrpt::hwdrivers::FRAMERATE_60
@ FRAMERATE_60
Definition: CImageGrabber_dc1394.h:28
mrpt::hwdrivers::FRAMERATE_15
@ FRAMERATE_15
Definition: CImageGrabber_dc1394.h:26
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:22
mrpt::hwdrivers::CStereoGrabber_Bumblebee_libdc1394::~CStereoGrabber_Bumblebee_libdc1394
virtual ~CStereoGrabber_Bumblebee_libdc1394(void)
Destructor.
Definition: CStereoGrabber_Bumblebee_libdc1394.cpp:60
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::hwdrivers::CImageGrabber_dc1394
A class for grabing images from a IEEE1394 (Firewire) camera using the libdc1394-2 library.
Definition: CImageGrabber_dc1394.h:153
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::hwdrivers::FRAMERATE_1_875
@ FRAMERATE_1_875
Definition: CImageGrabber_dc1394.h:23
CStereoGrabber_Bumblebee_libdc1394.h
MRPT_TRY_END
#define MRPT_TRY_END
The end of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ex...
Definition: exceptions.h:231
mrpt::hwdrivers::FRAMERATE_3_75
@ FRAMERATE_3_75
Definition: CImageGrabber_dc1394.h:24
uint64_t
unsigned __int64 uint64_t
Definition: rptypes.h:50
MRPT_TRY_START
#define MRPT_TRY_START
The start of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ...
Definition: exceptions.h:224
mrpt::hwdrivers::TCaptureOptions_dc1394
Options used when creating an dc1394 capture object All but the frame size, framerate,...
Definition: CImageGrabber_dc1394.h:48
mrpt::hwdrivers::FRAMERATE_7_5
@ FRAMERATE_7_5
Definition: CImageGrabber_dc1394.h:25
mrpt::hwdrivers::FRAMERATE_120
@ FRAMERATE_120
Definition: CImageGrabber_dc1394.h:29
mrpt::hwdrivers::TCaptureOptions_dc1394::mode7
int mode7
-1: Normal mode, i>=0: use MODE7_i, then frame_width/height and color_coding are ignored.
Definition: CImageGrabber_dc1394.h:86
mrpt::hwdrivers::CImageGrabber_dc1394::getObservation
bool getObservation(mrpt::obs::CObservationImage &out_observation)
Grab an image from the opened camera (for monocular cameras).
Definition: CImageGrabber_dc1394.cpp:493
mrpt::hwdrivers::FRAMERATE_30
@ FRAMERATE_30
Definition: CImageGrabber_dc1394.h:27
mrpt::obs::CObservationStereoImages
Observation class for either a pair of left+right or left+disparity images from a stereo camera.
Definition: CObservationStereoImages.h:41
hwdrivers-precomp.h
mrpt::hwdrivers::CStereoGrabber_Bumblebee_libdc1394::m_firewire_capture
mrpt::hwdrivers::CImageGrabber_dc1394 * m_firewire_capture
The actual capture object used in Linux / Mac.
Definition: CStereoGrabber_Bumblebee_libdc1394.h:68



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST