MRPT  1.9.9
CCameraSensor.h
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 #ifndef CCameraSensor_H
11 #define CCameraSensor_H
12 
13 #include <mrpt/poses/CPose3D.h>
14 #include <mrpt/obs/CObservation.h>
18 
25 #include <mrpt/hwdrivers/CKinect.h>
28 
31 
33 #include <memory> // unique_ptr
34 #include <functional>
35 
36 namespace mrpt::hwdrivers
37 {
38 /** The central class for camera grabbers in MRPT, implementing the "generic
39  * sensor" interface.
40  * This class provides the user with a uniform interface to a variety of
41  * other classes which manage only one specific camera "driver" (opencv, ffmpeg,
42  * PGR FlyCapture,...)
43  *
44  * Following the "generic sensor" interface, all the parameters must be
45  * passed int the form of a configuration file,
46  * which may be also formed on the fly (without being a real config file) as
47  * in this example:
48  *
49  * \code
50  * CCameraSensor myCam;
51  * const string str =
52  * "[CONFIG]\n"
53  * "grabber_type=opencv\n";
54  *
55  * CConfigFileMemory cfg(str);
56  * myCam.loadConfig(cfg,"CONFIG");
57  * myCam.initialize();
58  * CObservation::Ptr obs = myCam.getNextFrame();
59  * \endcode
60  *
61  * Images can be retrieved through the normal "doProcess()" interface, or the
62  * specific method "getNextFrame()".
63  *
64  * Some notes:
65  * - "grabber_type" determines the class to use internally for image capturing
66  * (see below).
67  * - For the meaning of cv_camera_type and other parameters, refer to
68  * mrpt::hwdrivers::CImageGrabber_OpenCV
69  * - For the parameters of dc1394 parameters, refer to generic IEEE1394
70  * documentation, and to mrpt::hwdrivers::TCaptureOptions_dc1394.
71  * - If the high number of existing parameters annoy you, try the function
72  * prepareVideoSourceFromUserSelection(),
73  * which displays a GUI dialog to the user so he/she can choose the desired
74  * camera & its parameters.
75  *
76  * Images can be saved in the "external storage" mode. Detached threads are
77  * created for this task. See \a setPathForExternalImages() and \a
78  * setExternalImageFormat().
79  * These methods are called automatically from the app rawlog-grabber.
80  *
81  * These is the list of all accepted parameters:
82  *
83  * \code
84  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
85  * -------------------------------------------------------
86  * [supplied_section_name]
87  * # Select one of the grabber implementations -----------------------
88  * grabber_type = opencv | dc1394 | bumblebee_dc1394 | ffmpeg | rawlog
89  * | swissranger | svs | kinect | flycap | flycap_stereo | image_dir | duo3d
90  *
91  * # Options for any grabber_type ------------------------------------
92  * preview_decimation = 0 // N<=0 (or not present): No preview; N>0,
93  * display 1 out of N captured frames.
94  * preview_reduction = 0 // 0 or 1 (or not present): The preview shows
95  * the actual image. For 2,3,..., reduces the size of the image by that factor,
96  * only for the preview window.
97  * capture_grayscale = 0 // 1:capture in grayscale, whenever the driver
98  * allows it. Default=0
99  * # For externaly stored images, the format of image files (default=jpg)
100  * #external_images_format = jpg
101  *
102  * # For externaly stored images: whether to spawn independent threads to
103  * save the image files.
104  * #external_images_own_thread = 1 // 0 or 1
105  *
106  * # If external_images_own_thread=1, this changes the number of threads to
107  * launch
108  * # to save image files. The default is determined from
109  * mrpt::system::getNumberOfProcessors()
110  * # and should be OK unless you want to save processor time for other
111  * things.
112  * #external_images_own_thread_count = 2 // >=1
113  *
114  * # (Only when external_images_format=jpg): Optional parameter to set the
115  * JPEG compression quality:
116  * #external_images_jpeg_quality = 95 // [1-100]. Default: 95
117  *
118  * # Pose of the sensor on the robot:
119  * pose_x=0 ; (meters)
120  * pose_y=0
121  * pose_z=0
122  * pose_yaw=0 ; (Angles in degrees)
123  * pose_pitch=0
124  * pose_roll=0
125  *
126  * # Options for grabber_type= opencv ------------------------------------
127  * cv_camera_index = 0 // [opencv] Number of camera to open
128  * cv_camera_type = CAMERA_CV_AUTODETECT
129  * cv_frame_width = 640 // [opencv] Capture width (not present or set
130  * to 0 for default)
131  * cv_frame_height = 480 // [opencv] Capture height (not present or set
132  * to 0 for default)
133  * cv_fps = 15 // [opencv] IEEE1394 cams only: Capture FPS
134  * (not present or 0 for default)
135  * cv_gain = 0 // [opencv] Camera gain, if available (nor
136  * present or set to 0 for default).
137  *
138  * # Options for grabber_type= dc1394 -------------------------------------
139  * dc1394_camera_guid = 0 | 0x11223344 // 0 (or not present): the first
140  * camera; A hexadecimal number: The GUID of the camera to open
141  * dc1394_camera_unit = 0 // 0 (or not present): the first
142  * camera; 0,1,2,...: The unit number (within the given GUID) of the camera to
143  * open (Stereo cameras: 0 or 1)
144  * dc1394_frame_width = 640
145  * dc1394_frame_height = 480
146  * dc1394_framerate = 15 // eg: 7.5, 15, 30, 60,
147  * etc... For posibilities see mrpt::hwdrivers::TCaptureOptions_dc1394
148  * dc1394_mode7 = -1 // -1: Ignore, i>=0, set to
149  * MODE7_i
150  * dc1394_color_coding = COLOR_CODING_YUV422 // For posibilities see
151  * mrpt::hwdrivers::TCaptureOptions_dc1394
152  * # Options for setting feature values: dc1394_<feature> = <n>
153  * # with <feature> = brightness | exposure | sharpness | white_balance |
154  * gamma | shutter | gain
155  * # <n> a value, or -1 (or not present) for not to change this feature
156  * value in the camera, possible values are shown in execution
157  * dc1394_shutter = -1
158  * # Options for setting feature modes: dc1394_<feature>_mode = <n>
159  * # with <feature> = brightness | exposure | sharpness | white_balance |
160  * gamma | shutter | gain
161  * # <n> = -1 (or not present) [not to change] | 0 [manual] | 1 [auto]
162  * | 2 [one_push_auto]
163  * dc1394_shutter_mode = -1
164  * # Options for setting trigger options:
165  * dc1394_trigger_power = -1 // -1 (or not present) for not to change
166  * | 0 [OFF] | 1 [ON]
167  * dc1394_trigger_mode = -1 // -1 (or not present) for not to change |
168  * 0..7 corresponding to possible modes 0,1,2,3,4,5,14,15
169  * dc1394_trigger_source= -1 // -1 (or not present) for not to change |
170  * 0..4 corresponding to possible sources 0,1,2,3,SOFTWARE
171  * dc1394_trigger_polarity = -1 // -1 (or not present) for not to change | 0
172  * [ACTIVE_LOW] | 1 [ACTIVE_HIGH]
173  * dc1394_ring_buffer_size = 15 // Length of frames ring buffer (internal
174  * to libdc1394)
175  *
176  * # Options for grabber_type= bumblebee_dc1394
177  * ----------------------------------
178  * bumblebee_dc1394_camera_guid = 0 | 0x11223344 // 0 (or not present):
179  * the first camera; A hexadecimal number: The GUID of the camera to open
180  * bumblebee_dc1394_camera_unit = 0 // 0 (or not present):
181  * the first camera; 0,1,2,...: The unit number (within the given GUID) of the
182  * camera to open (Stereo cameras: 0 or 1)
183  * bumblebee_dc1394_framerate = 15 // eg: 7.5, 15, 30,
184  * 60, etc... For posibilities see mrpt::hwdrivers::TCaptureOptions_dc1394
185  *
186  * # Options for grabber_type= ffmpeg -------------------------------------
187  * ffmpeg_url = rtsp://127.0.0.1 // [ffmpeg] The video file
188  * or IP camera to open
189  *
190  * # Options for grabber_type= rawlog -------------------------------------
191  * rawlog_file = mylog.rawlog // [rawlog] This can be
192  * used to simulate the capture of images already grabbed in the past in the
193  * form of a MRPT rawlog.
194  * rawlog_camera_sensor_label = CAMERA1 // [rawlog] If this field
195  * is not present, all images found in the rawlog will be retrieved. Otherwise,
196  * only those observations with a matching sensor label.
197  *
198  * # Options for grabber_type= svs -------------------------------------
199  * svs_camera_index = 0
200  * svs_frame_width = 800
201  * svs_frame_height = 600
202  * svs_framerate = 25.0
203  * svs_NDisp = ...
204  * svs_Corrsize = ...
205  * svs_LR = ...
206  * svs_Thresh = ...
207  * svs_Unique = ...
208  * svs_Horopter = ...
209  * svs_SpeckleSize = ...
210  * svs_procesOnChip = false
211  * svs_calDisparity = true
212  *
213  * # Options for grabber_type= swissranger
214  * -------------------------------------
215  * sr_use_usb = true // True: use USB, false: use
216  * ethernet
217  * sr_IP = 192.168.2.14 // If sr_use_usb=false, the camera
218  * IP
219  * sr_grab_grayscale = true // whether to save the intensity
220  * channel
221  * sr_grab_3d = true // whether to save the 3D points
222  * sr_grab_range = true // whether to save the range image
223  * sr_grab_confidence = true // whether to save the confidence
224  * image
225  *
226  * # Options for grabber_type= XBox kinect
227  * -------------------------------------
228  * kinect_grab_intensity = true // whether to save the intensity
229  * (RGB) channel
230  * kinect_grab_3d = true // whether to save the 3D points
231  * kinect_grab_range = true // whether to save the depth
232  * image
233  * #kinect_video_rgb = true // Optional. If set to "false",
234  * the IR intensity channel will be grabbed instead of the color RGB channel.
235  *
236  * # Options for grabber_type= flycap (Point Grey Research's FlyCapture 2
237  * for Monocular and Stereo cameras, e.g. Bumblebee2) --------
238  * flycap_camera_index = 0
239  * #... (all the parameters enumerated in
240  * mrpt::hwdrivers::TCaptureOptions_FlyCapture2 with the prefix "flycap_")
241  *
242  * # Options for grabber_type= flycap_stereo (Point Grey Research's
243  * FlyCapture 2, two cameras setup as a stereo pair) ------
244  * # fcs_start_synch_capture = false // *Important*: Only set to true if
245  * using Firewire cameras: the "startSyncCapture()" command is unsupported in
246  * USB3 and GigaE cameras.
247  *
248  * fcs_LEFT_camera_index = 0
249  * #... (all the parameters enumerated in
250  * mrpt::hwdrivers::TCaptureOptions_FlyCapture2 with the prefix "fcs_LEFT_")
251  * fcs_RIGHT_camera_index = 0
252  * #... (all the parameters enumerated in
253  * mrpt::hwdrivers::TCaptureOptions_FlyCapture2 with the prefix "fcs_RIGHT_")
254  *
255  * # Options for grabber_type= image_dir
256  * image_dir_url = // [string] URL of the
257  * directory
258  * left_filename_format = imL_%05d.jpg // [string] Format
259  * including prefix, number of trailing zeros, digits and image format
260  * (extension)
261  * right_filename_format = imR_%05d.jpg // [string] Format
262  * including prefix, number of trailing zeros, digits and image format
263  * (extension). Leave blank if only images from one camera will be used.
264  * start_index = 0 // [int]
265  * Starting index for images
266  * end_index = 100 // [int] End index
267  * for the images
268  *
269  * # Options for grabber_type= duo3d
270  * Create a section like this:
271  * [DUO3DOptions]
272  * rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore
273  * this section (it is not a separate device!)
274  *
275  * image_width = 640 // [int] x Resolution
276  * image_height = 480 // [int] y Resolution
277  * fps = 30 // [int] Frames per second
278  * (<= 30)
279  * exposure = 50 // [int] Exposure value (1..100)
280  * led = 0 // [int] Led intensity
281  * (only for some device models) (1..100).
282  * gain = 50 // [int] Camera gain (1..100)
283  * capture_rectified = false // [bool] Rectify
284  * captured images
285  * capture_imu = true // [bool] Capture IMU data
286  * from DUO3D device (if available)
287  * calibration_from_file = true // [bool] Use YML
288  * calibration files provided by calibration application supplied with DUO3D
289  * device
290  * intrinsic_filename = "" // [string] Intrinsic
291  * parameters file. This filename should contain a substring _RWWWxHHH_ with WWW
292  * being the image width and HHH the image height, as provided by the
293  * calibration application.
294  * extrinsic_filename = "" // [string] Extrinsic
295  * parameters file. This filename should contain a substring _RWWWxHHH_ with WWW
296  * being the image width and HHH the image height, as provided by the
297  * calibration application.
298  * rectify_map_filename = "" // [string] Rectification map
299  * file. This filename should contain a substring _RWWWxHHH_ with WWW being the
300  * image width and HHH the image height, as provided by the calibration
301  * application.
302  *
303  * // if 'calibration_from_file' = false, three more sections containing the
304  * calibration must be provided:
305  * [DUO3D_LEFT]
306  * rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore
307  * this section (it is not a separate device!)
308  * resolution = [640 480]
309  * cx = 320
310  * cy = 240
311  * fx = 700
312  * fy = 700
313  * dist = [0 0 0 0 0]
314  *
315  * [DUO3D_RIGHT]
316  * rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore
317  * this section (it is not a separate device!)
318  * resolution = [640 480]
319  * cx = 320
320  * cy = 240
321  * fx = 700
322  * fy = 700
323  * dist = [0 0 0 0 0]
324  *
325  * [DUO3D_LEFT2RIGHT_POSE]
326  * rawlog-grabber-ignore = true // Instructs rawlog-grabber to ignore
327  * this section (it is not a separate device!)
328  * pose_quaternion = [0.12 0 0 1 0 0 0]
329  *
330  * \endcode
331  *
332  * \note The execution rate, in rawlog-grabber or the user code calling
333  * doProcess(), should be greater than the required capture FPS.
334  * \note In Linux you may need to execute "chmod 666 /dev/video1394/ * " and
335  * "chmod 666 /dev/raw1394" for allowing any user R/W access to firewire
336  * cameras.
337  * \note [New in MRPT 1.4.0] The `bumblebee` driver has been deleted, use the
338  * `flycap` driver in stereo mode.
339  * \sa mrpt::hwdrivers::CImageGrabber_OpenCV,
340  * mrpt::hwdrivers::CImageGrabber_dc1394, CGenericSensor,
341  * prepareVideoSourceFromUserSelection()
342  * \ingroup mrpt_hwdrivers_grp
343  */
345 {
347 
348  public:
349  using Ptr = std::shared_ptr<CCameraSensor>;
350  /** Constructor. The camera is not open until "initialize" is called. */
351  CCameraSensor();
352 
353  /** Destructor */
354  virtual ~CCameraSensor();
355 
356  // See docs in parent class
357  void doProcess();
358 
359  /** Retrieves the next frame from the video source, raising an exception on
360  *any error.
361  * Note: The returned observations can be of one of these classes (you can
362  *use IS_CLASS(obs,CObservationXXX) to determine it):
363  * - mrpt::obs::CObservationImage (For normal cameras or video sources)
364  * - mrpt::obs::CObservationStereoImages (For stereo cameras)
365  * - mrpt::obs::CObservation3DRangeScan (For 3D cameras)
366  */
368  void getNextFrame(
369  std::vector<mrpt::serialization::CSerializable::Ptr>& out_obs);
370 
371  /** Tries to open the camera, after setting all the parameters with a call
372  * to loadConfig.
373  * \exception This method must throw an exception with a descriptive
374  * message if some critical error is found.
375  */
376  virtual void initialize();
377 
378  /** Close the camera (if open).
379  * This method is called automatically on destruction.
380  */
381  void close();
382 
383  /** Set Software trigger level value (ON or OFF) for cameras with this
384  * function available.
385  */
386  void setSoftwareTriggerLevel(bool level);
387 
388  /** Set the path where to save off-rawlog image files (this class DOES take
389  * into account this path).
390  * An empty string (the default value at construction) means to save
391  * images embedded in the rawlog, instead of on separate files.
392  * \exception std::exception If the directory doesn't exists and cannot be
393  * created.
394  */
395  virtual void setPathForExternalImages(const std::string& directory);
396 
397  /** This must be called before initialize() */
398  void enableLaunchOwnThreadForSavingImages(bool enable = true)
399  {
401  };
402 
403  /** Functor type */
404  using TPreSaveUserHook = std::function<void(
405  const mrpt::obs::CObservation::Ptr& obs, void* user_ptr)>;
406 
407  /** Provides a "hook" for user-code to be run BEFORE an image is going to be
408  * saved to disk if external storage is enabled (e.g. to rectify images,
409  * preprocess them, etc.)
410  * Notice that this code may be called from detached threads, so it must be
411  * thread safe.
412  * If used, call this before initialize() */
413  void addPreSaveHook(TPreSaveUserHook user_function, void* user_ptr)
414  {
415  m_hook_pre_save = user_function;
416  m_hook_pre_save_param = user_ptr;
417  };
418 
419  protected:
420  // Options for any grabber_type ------------------------------------
422 
423  /** Can be "opencv",... */
426 
427  // Options for grabber_type= opencv ------------------------------------
431 
432  // Options for grabber_type= dc1394 -------------------------------------
438 
439  // Options for grabber_type= bumblebee_dc1394
440  // ----------------------------------
444 
445  // Options for grabber type= svs -----------------------------------------
448 
449  // Options for grabber_type= ffmpeg -------------------------------------
451 
452  // Options for grabber_type= rawlog -------------------------------------
456 
457  // Options for grabber_type= swissranger
458  // -------------------------------------
459  /** true: USB, false: ETH */
462  /** Save the 3D point cloud (default: true) */
464  /** Save the 2D range image (default: true) */
466  /** Save the 2D intensity image (default: true) */
468  /** Save the estimated confidence 2D image (default: false) */
470 
471  // Options for grabber_type= XBox kinect
472  // -------------------------------------
473  /** Save the 3D point cloud (default: true) */
475  /** Save the 2D range image (default: true) */
477  /** Save the 2D intensity image (default: true) */
479  /** Save RGB or IR channels (default:true) */
481 
482  // Options for grabber type= flycap
483  // -----------------------------------------
485 
486  // Options for grabber type= flycap_stereo
487  // -----------------------------------------
490  m_flycap_stereo_options[2]; // [0]:left, [1]:right
491 
492  // Options for grabber type= image_dir
498 
501 
502  // Options for grabber type= duo3d
504 
505  // Other options:
506  /** Whether to launch independent thread */
508 
509  /** See the class documentation at the top for expected parameters */
511  const mrpt::config::CConfigFileBase& configSource,
512  const std::string& iniSection);
513 
514  private:
515  // Only one of these will be !=nullptr at a time ===========
516  /** The OpenCV capture object. */
517  std::unique_ptr<CImageGrabber_OpenCV> m_cap_cv;
518  /** The dc1394 capture object. */
519  std::unique_ptr<CImageGrabber_dc1394> m_cap_dc1394;
520  /** The FlyCapture2 object */
521  std::unique_ptr<CImageGrabber_FlyCapture2> m_cap_flycap;
522  /** The FlyCapture2 object for stereo pairs */
523  std::unique_ptr<CImageGrabber_FlyCapture2> m_cap_flycap_stereo_l,
525  std::unique_ptr<CStereoGrabber_Bumblebee_libdc1394> m_cap_bumblebee_dc1394;
526  /** The svs capture object. */
527  std::unique_ptr<CStereoGrabber_SVS> m_cap_svs;
528  /** The FFMPEG capture object */
529  std::unique_ptr<CFFMPEG_InputStream> m_cap_ffmpeg;
530  /** The input file for rawlogs */
531  std::unique_ptr<mrpt::io::CFileGZInputStream> m_cap_rawlog;
532  /** SR 3D camera object. */
533  std::unique_ptr<CSwissRanger3DCamera> m_cap_swissranger;
534  /** Kinect camera object. */
535  std::unique_ptr<CKinect> m_cap_kinect;
536  /** OpenNI2 object. */
537  std::unique_ptr<COpenNI2Sensor> m_cap_openni2;
538  /** Read images from directory */
539  std::unique_ptr<std::string> m_cap_image_dir;
540  /** The DUO3D capture object */
541  std::unique_ptr<CDUO3DCamera> m_cap_duo3d;
542  // =========================
543 
546 
548  /** Normally we'll use only one window, but for stereo images we'll use two
549  * of them. */
551 
552  /** @name Stuff related to working threads to save images to disk
553  @{ */
554  /** Number of working threads. Default:1, set to 2 in quad cores. */
556  std::vector<std::thread> m_threadImagesSaver;
557 
559  /** The critical section for m_toSaveList */
560  std::mutex m_csToSaveList;
561  /** The queues of objects to be returned by getObservations, one for each
562  * working thread. */
563  std::vector<TListObservations> m_toSaveList;
564  /** Thread to save images to files. */
565  void thread_save_images(unsigned int my_working_thread_index);
566 
569  /** @} */
570 
571 }; // end class
572 
573 /** Used only from MRPT apps: Use with caution since "panel" MUST be a
574  * "mrpt::gui::CPanelCameraSelection *"
575  */
577 
578 /** Parse the user options in the wxWidgets "panel" and write the configuration
579  * into the given section of the given configuration file.
580  * Use with caution since "panel" MUST be a "mrpt::gui::CPanelCameraSelection
581  * *"
582  * \sa prepareVideoSourceFromUserSelection, prepareVideoSourceFromPanel,
583  * readConfigIntoVideoSourcePanel
584  */
586  void* panel, const std::string& in_cfgfile_section_name,
587  mrpt::config::CConfigFileBase* out_cfgfile);
588 
589 /** Parse the given section of the given configuration file and set accordingly
590  * the controls of the wxWidgets "panel".
591  * Use with caution since "panel" MUST be a "mrpt::gui::CPanelCameraSelection
592  * *"
593  * \sa prepareVideoSourceFromUserSelection, prepareVideoSourceFromPanel,
594  * writeConfigFromVideoSourcePanel
595  */
597  void* panel, const std::string& in_cfgfile_section_name,
598  const mrpt::config::CConfigFileBase* in_cfgfile);
599 
600 /** Show to the user a list of possible camera drivers and creates and open the
601  * selected camera.
602  */
604 
605 }
606 #endif
607 
608 
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
This class allows loading and storing values and vectors of different types from a configuration text...
std::shared_ptr< CDisplayWindow > Ptr
The central class for camera grabbers in MRPT, implementing the "generic sensor" interface.
bool m_sr_save_confidence
Save the estimated confidence 2D image (default: false)
void enableLaunchOwnThreadForSavingImages(bool enable=true)
This must be called before initialize()
std::unique_ptr< mrpt::io::CFileGZInputStream > m_cap_rawlog
The input file for rawlogs.
bool m_kinect_save_range_img
Save the 2D range image (default: true)
std::unique_ptr< CStereoGrabber_SVS > m_cap_svs
The svs capture object.
void addPreSaveHook(TPreSaveUserHook user_function, void *user_ptr)
Provides a "hook" for user-code to be run BEFORE an image is going to be saved to disk if external st...
virtual void initialize()
Tries to open the camera, after setting all the parameters with a call to loadConfig.
bool m_kinect_save_3d
Save the 3D point cloud (default: true)
unsigned int m_external_image_saver_count
Number of working threads.
std::unique_ptr< std::string > m_cap_image_dir
Read images from directory.
TCaptureOptions_DUO3D m_duo3d_options
TCaptureOptions_dc1394 m_dc1394_options
std::unique_ptr< CDUO3DCamera > m_cap_duo3d
The DUO3D capture object.
std::mutex m_csToSaveList
The critical section for m_toSaveList.
bool m_sr_open_from_usb
true: USB, false: ETH
std::vector< TListObservations > m_toSaveList
The queues of objects to be returned by getObservations, one for each working thread.
bool m_kinect_video_rgb
Save RGB or IR channels (default:true)
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
bool m_external_images_own_thread
Whether to launch independent thread.
TCaptureOptions_FlyCapture2 m_flycap_stereo_options[2]
bool m_sr_save_3d
Save the 3D point cloud (default: true)
bool m_sr_save_intensity_img
Save the 2D intensity image (default: true)
std::unique_ptr< COpenNI2Sensor > m_cap_openni2
OpenNI2 object.
TCaptureOptions_FlyCapture2 m_flycap_options
TCaptureOptions_SVS m_svs_options
std::unique_ptr< CFFMPEG_InputStream > m_cap_ffmpeg
The FFMPEG capture object.
void close()
Close the camera (if open).
bool m_kinect_save_intensity_img
Save the 2D intensity image (default: true)
mrpt::obs::CObservation::Ptr getNextFrame()
Retrieves the next frame from the video source, raising an exception on any error.
std::unique_ptr< CImageGrabber_FlyCapture2 > m_cap_flycap_stereo_r
std::shared_ptr< CCameraSensor > Ptr
bool m_sr_save_range_img
Save the 2D range image (default: true)
std::unique_ptr< CImageGrabber_FlyCapture2 > m_cap_flycap
The FlyCapture2 object.
void thread_save_images(unsigned int my_working_thread_index)
Thread to save images to files.
virtual void setPathForExternalImages(const std::string &directory)
Set the path where to save off-rawlog image files (this class DOES take into account this path).
std::string m_grabber_type
Can be "opencv",...
virtual ~CCameraSensor()
Destructor.
TPreSaveUserHook m_hook_pre_save
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
std::vector< std::thread > m_threadImagesSaver
void setSoftwareTriggerLevel(bool level)
Set Software trigger level value (ON or OFF) for cameras with this function available.
std::unique_ptr< CImageGrabber_FlyCapture2 > m_cap_flycap_stereo_l
The FlyCapture2 object for stereo pairs.
std::unique_ptr< CStereoGrabber_Bumblebee_libdc1394 > m_cap_bumblebee_dc1394
std::unique_ptr< CSwissRanger3DCamera > m_cap_swissranger
SR 3D camera object.
std::unique_ptr< CImageGrabber_dc1394 > m_cap_dc1394
The dc1394 capture object.
TCaptureCVOptions m_cv_options
std::function< void(const mrpt::obs::CObservation::Ptr &obs, void *user_ptr)> TPreSaveUserHook
Functor type.
std::unique_ptr< CKinect > m_cap_kinect
Kinect camera object.
std::unique_ptr< CImageGrabber_OpenCV > m_cap_cv
The OpenCV capture object.
mrpt::gui::CDisplayWindow::Ptr m_preview_win2
mrpt::gui::CDisplayWindow::Ptr m_preview_win1
Normally we'll use only one window, but for stereo images we'll use two of them.
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:45
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:87
Versatile class for consistent logging and management of output messages.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLint level
Definition: glext.h:3600
GLsizei const GLchar ** string
Definition: glext.h:4101
Contains classes for various device interfaces.
CCameraSensor::Ptr prepareVideoSourceFromPanel(void *panel)
Used only from MRPT apps: Use with caution since "panel" MUST be a "mrpt::gui::CPanelCameraSelection ...
void writeConfigFromVideoSourcePanel(void *panel, const std::string &in_cfgfile_section_name, mrpt::config::CConfigFileBase *out_cfgfile)
Parse the user options in the wxWidgets "panel" and write the configuration into the given section of...
CCameraSensor::Ptr prepareVideoSourceFromUserSelection()
Show to the user a list of possible camera drivers and creates and open the selected camera.
void readConfigIntoVideoSourcePanel(void *panel, const std::string &in_cfgfile_section_name, const mrpt::config::CConfigFileBase *in_cfgfile)
Parse the given section of the given configuration file and set accordingly the controls of the wxWid...
unsigned __int64 uint64_t
Definition: rptypes.h:50
Options used when creating an OpenCV capture object Some options apply to IEEE1394 cameras only.
Options used when creating a camera capture object of type CImageGrabber_FlyCapture2.
Definition: CDUO3DCamera.h:22
Options used when creating a camera capture object of type CImageGrabber_FlyCapture2.
Options used when creating a STOC Videre Design camera capture object.
Options used when creating an dc1394 capture object All but the frame size, framerate,...



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 814d80880 Fri Aug 24 01:51:28 2018 +0200 at mar 26 may 2026 12:30:59 CEST