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-2017, 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 
14 using namespace std;
15 using namespace mrpt;
16 using namespace mrpt::obs;
17 using namespace mrpt::hwdrivers;
18 
19 CStereoGrabber_Bumblebee_libdc1394::CStereoGrabber_Bumblebee_libdc1394(
20  uint64_t cameraGUID, uint16_t cameraUnit, double frameRate)
21  : m_firewire_capture(nullptr), m_bInitialized(false)
22 {
24 
25  TCaptureOptions_dc1394 opt1394;
26  opt1394.mode7 = 3; // stereo cameras are captured with MODE7-3
27  opt1394.deinterlace_stereo = true; // It is stereo.
28 
29  std::map<double, grabber_dc1394_framerate_t> Rs;
30  Rs[1.875] = FRAMERATE_1_875;
31  Rs[3.75] = FRAMERATE_3_75;
32  Rs[7.5] = FRAMERATE_7_5;
33  Rs[15] = FRAMERATE_15;
34  Rs[30] = FRAMERATE_30;
35  Rs[60] = FRAMERATE_60;
36  Rs[120] = FRAMERATE_120;
37  Rs[240] = FRAMERATE_240;
38 
39  if (Rs.find(frameRate) != Rs.end())
40  opt1394.framerate = Rs[frameRate];
41  else
42  cerr << "[CStereoGrabber_Bumblebee_libdc1394] Ignoring unknown "
43  "framerate: "
44  << frameRate << "\n";
45 
47  new CImageGrabber_dc1394(cameraGUID, cameraUnit, opt1394);
48 
49  if (!m_firewire_capture->isOpen())
50  cerr << "[CStereoGrabber_Bumblebee] The camera couldn't be open"
51  << endl;
52 
54 }
55 
56 /*-------------------------------------------------------------
57  Destructor
58  -------------------------------------------------------------*/
60 {
62  {
63  delete m_firewire_capture;
64  m_firewire_capture = nullptr;
65  }
66 }
67 
68 /*-------------------------------------------------------------
69  get the image
70  -------------------------------------------------------------*/
72  mrpt::obs::CObservationStereoImages& out_observation)
73 {
74  if (!m_firewire_capture->isOpen())
75  {
76  cerr << "[CStereoGrabber_Bumblebee] The camera couldn't be open"
77  << endl;
78  return false;
79  }
80 
81  if (!m_firewire_capture->getObservation(out_observation)) return false;
82 
83  return true; // All ok
84 }
mrpt::hwdrivers::CImageGrabber_dc1394 * m_firewire_capture
The actual capture object used in Linux / Mac.
Options used when creating an dc1394 capture object All but the frame size, framerate, and color_coding can be changed dynamically by CImageGrabber_dc1394::changeCaptureOptions.
unsigned __int16 uint16_t
Definition: rptypes.h:44
bool isOpen() const
Check whether the camera has been open successfully.
Contains classes for various device interfaces.
STL namespace.
bool getObservation(mrpt::obs::CObservationImage &out_observation)
Grab an image from the opened camera (for monocular cameras).
#define MRPT_TRY_END
A class for grabing images from a IEEE1394 (Firewire) camera using the libdc1394-2 library...
bool getStereoObservation(mrpt::obs::CObservationStereoImages &out_observation)
Grab stereo images, and return the pair of rectified images.
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
This namespace contains representation of robot actions and observations.
unsigned __int64 uint64_t
Definition: rptypes.h:50
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define MRPT_TRY_START
int mode7
-1: Normal mode, i>=0: use MODE7_i, then frame_width/height and color_coding are ignored.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019