NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
depth_image.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef LOCALIZATION_MEASUREMENTS_DEPTH_IMAGE_H_
20 #define LOCALIZATION_MEASUREMENTS_DEPTH_IMAGE_H_
21 
23 
24 #include <boost/optional.hpp>
25 
26 #include <opencv2/core.hpp>
27 
28 #include <pcl/point_cloud.h>
29 #include <pcl/point_types.h>
30 
31 namespace localization_measurements {
32 class DepthImage {
33  public:
34  DepthImage(const cv::Mat& image, const pcl::PointCloud<pcl::PointXYZI>::Ptr point_cloud);
35  // Point lookups using depth image col and rows need to use the unfiltered point cloud since the indices
36  // of the unfiltered cloud correlate to the image space indices.
37  boost::optional<const pcl::PointXYZI&> UnfilteredPoint3D(const int col, const int row) const;
38  boost::optional<const pcl::PointXYZI&> UnfilteredPoint3D(const double col, const double row) const;
39  boost::optional<pcl::PointXYZI> InterpolatePoint3D(const double col, const double row) const;
40  const cv::Mat& image() const { return image_; }
41  const pcl::PointCloud<pcl::PointXYZI>::Ptr unfiltered_point_cloud() const { return unfiltered_point_cloud_; }
42 
43  private:
44  static bool ValidPoint(const boost::optional<const pcl::PointXYZI&> point);
45 
46  cv::Mat image_;
47  pcl::PointCloud<pcl::PointXYZI>::Ptr unfiltered_point_cloud_;
48 };
49 } // namespace localization_measurements
50 
51 #endif // LOCALIZATION_MEASUREMENTS_DEPTH_IMAGE_H_
localization_measurements::DepthImage::DepthImage
DepthImage(const cv::Mat &image, const pcl::PointCloud< pcl::PointXYZI >::Ptr point_cloud)
Definition: depth_image.cc:24
localization_measurements::DepthImage::image
const cv::Mat & image() const
Definition: depth_image.h:40
localization_measurements::DepthImage::UnfilteredPoint3D
boost::optional< const pcl::PointXYZI & > UnfilteredPoint3D(const int col, const int row) const
Definition: depth_image.cc:27
localization_measurements::DepthImage::unfiltered_point_cloud
const pcl::PointCloud< pcl::PointXYZI >::Ptr unfiltered_point_cloud() const
Definition: depth_image.h:41
localization_measurements::DepthImage
Definition: depth_image.h:32
time.h
localization_measurements
Definition: depth_correspondences.h:25
localization_measurements::DepthImage::InterpolatePoint3D
boost::optional< pcl::PointXYZI > InterpolatePoint3D(const double col, const double row) const
Definition: depth_image.cc:34