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



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