Main MRPT website > C++ reference for MRPT 1.5.7
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(uint64_t cameraGUID, uint16_t cameraUnit, double frameRate) :
20  m_firewire_capture(NULL),
21  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 cerr << "[CStereoGrabber_Bumblebee_libdc1394] Ignoring unknown framerate: " << frameRate << "\n";
42 
43  m_firewire_capture = new CImageGrabber_dc1394(cameraGUID,cameraUnit,opt1394);
44 
45  if (!m_firewire_capture->isOpen())
46  cerr << "[CStereoGrabber_Bumblebee] The camera couldn't be open" << endl;
47 
49 }
50 
51 /*-------------------------------------------------------------
52  Destructor
53  -------------------------------------------------------------*/
55 {
57  {
58  delete m_firewire_capture;
59  m_firewire_capture = NULL;
60  }
61 }
62 
63 /*-------------------------------------------------------------
64  get the image
65  -------------------------------------------------------------*/
67 {
68  if (!m_firewire_capture->isOpen())
69  {
70  cerr << "[CStereoGrabber_Bumblebee] The camera couldn't be open" << endl;
71  return false;
72  }
73 
74  if (!m_firewire_capture->getObservation(out_observation))
75  return false;
76 
77  return true; // All ok
78 }
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:46
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:52
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.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019