CameraRGBDImages.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
28 
29 namespace rtabmap
30 {
31 
33 {
34  return true;
35 }
36 
38  const std::string & pathRGBImages,
39  const std::string & pathDepthImages,
40  float depthScaleFactor,
41  float imageRate,
42  const Transform & localTransform) :
43  CameraImages(pathRGBImages, imageRate, localTransform)
44 {
45  UASSERT(depthScaleFactor >= 1.0);
46  cameraDepth_.setPath(pathDepthImages);
47  cameraDepth_.setDepth(true, depthScaleFactor);
48 }
49 
51 {
52 }
53 
54 bool CameraRGBDImages::init(const std::string & calibrationFolder, const std::string & cameraName)
55 {
56  bool success = false;
57  if(CameraImages::init(calibrationFolder, cameraName) && cameraDepth_.init())
58  {
59  if(this->imagesCount() == cameraDepth_.imagesCount())
60  {
61  success = true;
62  }
63  else
64  {
65  UERROR("Cameras don't have the same number of images (%d vs %d)",
67  }
68  }
69 
70  return success;
71 }
72 
74 {
76 
77  SensorData rgb, depth;
79  if(!rgb.imageRaw().empty())
80  {
81  depth = cameraDepth_.takeImage();
82  if(!depth.depthRaw().empty())
83  {
84  data = SensorData(rgb.imageRaw(), depth.depthRaw(), rgb.cameraModels(), rgb.id(), rgb.stamp());
85  data.setGroundTruth(rgb.groundTruth());
86  }
87  }
88  return data;
89 }
90 
91 
92 } // namespace rtabmap
rtabmap::SensorData
Definition: SensorData.h:51
rtabmap::CameraImages
Definition: CameraImages.h:39
rtabmap::CameraRGBDImages::~CameraRGBDImages
virtual ~CameraRGBDImages()
Definition: CameraRGBDImages.cpp:50
CameraRGBDImages.h
rtabmap::CameraImages::setPath
void setPath(const std::string &dir)
Definition: CameraImages.h:61
rtabmap::SensorData::stamp
double stamp() const
Definition: SensorData.h:176
rtabmap::SensorData::cameraModels
const std::vector< CameraModel > & cameraModels() const
Definition: SensorData.h:240
rtabmap::SensorCaptureInfo
Definition: SensorCaptureInfo.h:36
data
int data[]
rtabmap::CameraRGBDImages::init
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Definition: CameraRGBDImages.cpp:54
rtabmap::SensorData::id
int id() const
Definition: SensorData.h:174
rtabmap::CameraImages::imagesCount
unsigned int imagesCount() const
Definition: CameraImages.cpp:647
info
else if n * info
rtabmap::CameraRGBDImages::available
static bool available()
Definition: CameraRGBDImages.cpp:32
UASSERT
#define UASSERT(condition)
rtabmap::CameraRGBDImages::captureImage
virtual SensorData captureImage(SensorCaptureInfo *info=0)
Definition: CameraRGBDImages.cpp:73
rtabmap::CameraImages::setDepth
void setDepth(bool isDepth, float depthScaleFactor=1.0f)
Definition: CameraImages.h:114
rtabmap::CameraImages::init
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Definition: CameraImages.cpp:109
rtabmap::CameraRGBDImages::cameraDepth_
CameraImages cameraDepth_
Definition: CameraRGBDImages.h:59
rtabmap::SensorData::imageRaw
const cv::Mat & imageRaw() const
Definition: SensorData.h:183
rtabmap::Transform
Definition: Transform.h:41
rtabmap::CameraRGBDImages::CameraRGBDImages
CameraRGBDImages(const std::string &pathRGBImages, const std::string &pathDepthImages, float depthScaleFactor=1.0f, float imageRate=0.0f, const Transform &localTransform=Transform::getIdentity())
Definition: CameraRGBDImages.cpp:37
rtabmap::SensorData::depthRaw
cv::Mat depthRaw() const
Definition: SensorData.h:210
rtabmap
Definition: CameraARCore.cpp:35
UERROR
#define UERROR(...)
rtabmap::Camera::takeImage
SensorData takeImage(SensorCaptureInfo *info=0)
Definition: Camera.h:48
rtabmap::SensorData::groundTruth
const Transform & groundTruth() const
Definition: SensorData.h:284
rtabmap::CameraImages::captureImage
virtual SensorData captureImage(SensorCaptureInfo *info=0)
Definition: CameraImages.cpp:673


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:07