CameraStereo.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of the Universite de Sherbrooke nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00028 #pragma once
00029 
00030 #include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
00031 
00032 #include "rtabmap/core/CameraModel.h"
00033 #include "rtabmap/core/Camera.h"
00034 #include "rtabmap/core/CameraRGB.h"
00035 #include "rtabmap/core/Version.h"
00036 #include <list>
00037 
00038 namespace FlyCapture2
00039 {
00040 class Camera;
00041 }
00042 
00043 namespace sl
00044 {
00045 class Camera;
00046 }
00047 
00048 namespace rtabmap
00049 {
00050 
00052 // CameraStereoDC1394
00054 class DC1394Device;
00055 
00056 class RTABMAP_EXP CameraStereoDC1394 :
00057         public Camera
00058 {
00059 public:
00060         static bool available();
00061 
00062 public:
00063         CameraStereoDC1394( float imageRate=0.0f, const Transform & localTransform = Transform::getIdentity());
00064         virtual ~CameraStereoDC1394();
00065 
00066         virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
00067         virtual bool isCalibrated() const;
00068         virtual std::string getSerial() const;
00069 
00070 protected:
00071         virtual SensorData captureImage(CameraInfo * info = 0);
00072 
00073 private:
00074 #ifdef RTABMAP_DC1394
00075         DC1394Device *device_;
00076         StereoCameraModel stereoModel_;
00077 #endif
00078 };
00079 
00081 // CameraStereoFlyCapture2
00083 class RTABMAP_EXP CameraStereoFlyCapture2 :
00084         public Camera
00085 {
00086 public:
00087         static bool available();
00088 
00089 public:
00090         CameraStereoFlyCapture2( float imageRate=0.0f, const Transform & localTransform = Transform::getIdentity());
00091         virtual ~CameraStereoFlyCapture2();
00092 
00093         virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
00094         virtual bool isCalibrated() const;
00095         virtual std::string getSerial() const;
00096 
00097 protected:
00098         virtual SensorData captureImage(CameraInfo * info = 0);
00099 
00100 private:
00101 #ifdef RTABMAP_FLYCAPTURE2
00102         FlyCapture2::Camera * camera_;
00103         void * triclopsCtx_; // TriclopsContext
00104 #endif
00105 };
00106 
00108 // CameraStereoZED
00110 class RTABMAP_EXP CameraStereoZed :
00111         public Camera
00112 {
00113 public:
00114         static bool available();
00115 
00116 public:
00117         CameraStereoZed(
00118                         int deviceId,
00119                         int resolution = 2, // 0=HD2K, 1=HD1080, 2=HD720, 3=VGA
00120                         int quality = 1,    // 0=NONE, 1=PERFORMANCE, 2=QUALITY
00121                         int sensingMode = 0,// 0=STANDARD, 1=FILL
00122                         int confidenceThr = 100,
00123                         bool computeOdometry = false,
00124                         float imageRate=0.0f,
00125                         const Transform & localTransform = Transform::getIdentity(),
00126                         bool selfCalibration = true);
00127         CameraStereoZed(
00128                         const std::string & svoFilePath,
00129                         int quality = 1,    // 0=NONE, 1=PERFORMANCE, 2=QUALITY
00130                         int sensingMode = 0,// 0=STANDARD, 1=FILL
00131                         int confidenceThr = 100,
00132                         bool computeOdometry = false,
00133                         float imageRate=0.0f,
00134                         const Transform & localTransform = Transform::getIdentity(),
00135                         bool selfCalibration = true);
00136         virtual ~CameraStereoZed();
00137 
00138         virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
00139         virtual bool isCalibrated() const;
00140         virtual std::string getSerial() const;
00141         virtual bool odomProvided() const;
00142 
00143 protected:
00144         virtual SensorData captureImage(CameraInfo * info = 0);
00145 
00146 private:
00147 #ifdef RTABMAP_ZED
00148         sl::Camera * zed_;
00149         StereoCameraModel stereoModel_;
00150         CameraVideo::Source src_;
00151         int usbDevice_;
00152         std::string svoFilePath_;
00153         int resolution_;
00154         int quality_;
00155         bool selfCalibration_;
00156         int sensingMode_;
00157         int confidenceThr_;
00158         bool computeOdometry_;
00159         bool lost_;
00160 #endif
00161 };
00162 
00164 // CameraStereoImages
00166 class CameraImages;
00167 class RTABMAP_EXP CameraStereoImages :
00168         public CameraImages
00169 {
00170 public:
00171         static bool available();
00172 
00173 public:
00174         CameraStereoImages(
00175                         const std::string & pathLeftImages,
00176                         const std::string & pathRightImages,
00177                         bool rectifyImages = false,
00178                         float imageRate=0.0f,
00179                         const Transform & localTransform = Transform::getIdentity());
00180         CameraStereoImages(
00181                         const std::string & pathLeftRightImages,
00182                         bool rectifyImages = false,
00183                         float imageRate=0.0f,
00184                         const Transform & localTransform = Transform::getIdentity());
00185         virtual ~CameraStereoImages();
00186 
00187         virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
00188         virtual bool isCalibrated() const;
00189         virtual std::string getSerial() const;
00190 
00191         virtual void setStartIndex(int index) {CameraImages::setStartIndex(index);camera2_->setStartIndex(index);} // negative means last
00192 
00193 protected:
00194         virtual SensorData captureImage(CameraInfo * info = 0);
00195 
00196 private:
00197         CameraImages * camera2_;
00198         StereoCameraModel stereoModel_;
00199 };
00200 
00201 
00203 // CameraStereoVideo
00205 class CameraImages;
00206 class RTABMAP_EXP CameraStereoVideo :
00207         public Camera
00208 {
00209 public:
00210         static bool available();
00211 
00212 public:
00213         CameraStereoVideo(
00214                         const std::string & pathSideBySide,
00215                         bool rectifyImages = false,
00216                         float imageRate=0.0f,
00217                         const Transform & localTransform = Transform::getIdentity());
00218         CameraStereoVideo(
00219                         const std::string & pathLeft,
00220                         const std::string & pathRight,
00221                         bool rectifyImages = false,
00222                         float imageRate=0.0f,
00223                         const Transform & localTransform = Transform::getIdentity());
00224         CameraStereoVideo(
00225                         int device,
00226                         bool rectifyImages = false,
00227                         float imageRate = 0.0f,
00228                         const Transform & localTransform = Transform::getIdentity());
00229         CameraStereoVideo(
00230                         int deviceLeft,
00231                         int deviceRight,
00232                         bool rectifyImages = false,
00233                         float imageRate = 0.0f,
00234                         const Transform & localTransform = Transform::getIdentity());
00235         virtual ~CameraStereoVideo();
00236 
00237         virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
00238         virtual bool isCalibrated() const;
00239         virtual std::string getSerial() const;
00240 
00241 protected:
00242         virtual SensorData captureImage(CameraInfo * info = 0);
00243 
00244 private:
00245         cv::VideoCapture capture_;
00246         cv::VideoCapture capture2_;
00247         std::string path_;
00248         std::string path2_;
00249         bool rectifyImages_;
00250         StereoCameraModel stereoModel_;
00251         std::string cameraName_;
00252         CameraVideo::Source src_;
00253         int usbDevice_;
00254         int usbDevice2_;
00255 };
00256 
00257 } // namespace rtabmap


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:19