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::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
#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
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_START
The start of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ...
Definition: exceptions.h:224
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.
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020