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