NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
feature_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 #ifndef VISION_COMMON_FEATURE_IMAGE_H_
19 #define VISION_COMMON_FEATURE_IMAGE_H_
20 
21 #include <opencv2/core.hpp>
22 #include <opencv2/features2d.hpp>
23 
24 #include <vector>
25 
26 namespace vision_common {
27 class FeatureImage {
28  public:
29  FeatureImage(const cv::Mat& image, cv::Feature2D& feature_detector) : image_(image) {
30  feature_detector.detectAndCompute(image_, cv::Mat(), keypoints_, descriptors_);
31  cv::KeyPoint::convert(keypoints_, feature_points_);
32  }
33  const cv::Mat& image() const { return image_; }
34  const int rows() const { return image_.rows; }
35  const int cols() const { return image_.cols; }
36  const std::vector<cv::KeyPoint>& keypoints() const { return keypoints_; }
37  const std::vector<cv::Point2f>& feature_points() const { return feature_points_; }
38  const cv::Mat& descriptors() const { return descriptors_; }
39 
40  private:
41  cv::Mat image_;
42  std::vector<cv::KeyPoint> keypoints_;
43  std::vector<cv::Point2f> feature_points_;
44  cv::Mat descriptors_;
45 };
46 } // namespace vision_common
47 
48 #endif // VISION_COMMON_FEATURE_IMAGE_H_
vision_common::FeatureImage::image
const cv::Mat & image() const
Definition: feature_image.h:33
vision_common
Definition: brisk_feature_detector_and_matcher.h:25
vision_common::FeatureImage::keypoints
const std::vector< cv::KeyPoint > & keypoints() const
Definition: feature_image.h:36
vision_common::FeatureImage::rows
const int rows() const
Definition: feature_image.h:34
vision_common::FeatureImage
Definition: feature_image.h:27
vision_common::FeatureImage::cols
const int cols() const
Definition: feature_image.h:35
vision_common::FeatureImage::feature_points
const std::vector< cv::Point2f > & feature_points() const
Definition: feature_image.h:37
vision_common::FeatureImage::FeatureImage
FeatureImage(const cv::Mat &image, cv::Feature2D &feature_detector)
Definition: feature_image.h:29
vision_common::FeatureImage::descriptors
const cv::Mat & descriptors() const
Definition: feature_image.h:38