blob_detector.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2017
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the institute nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Notes:
37  * The following code makes use of the OpenCV library.
38  * OpenCV is licensed under the terms of the 3-clause BSD License.
39  *
40  * Authors: Franz Albers, Christoph Rösmann
41  *********************************************************************/
42 
43 #ifndef BLOBDETECTOR_H_
44 #define BLOBDETECTOR_H_
45 
46 // Basically the OpenCV SimpleBlobDetector, extended with getContours()
47 
48 #include <opencv2/features2d/features2d.hpp>
49 
60 class BlobDetector : public cv::SimpleBlobDetector
61 {
62 public:
64  BlobDetector(const cv::SimpleBlobDetector::Params& parameters = cv::SimpleBlobDetector::Params());
65 
67  static cv::Ptr<BlobDetector> create(const BlobDetector::Params& params);
68 
83  virtual void detect(const cv::Mat& image, std::vector<cv::KeyPoint>& keypoints,
84  const cv::Mat& mask = cv::Mat());
85 
90  const std::vector<std::vector<cv::Point>>& getContours() { return contours_; }
91 
93  void updateParameters(const cv::SimpleBlobDetector::Params& parameters);
94 
95 protected:
96  struct Center
97  {
98  cv::Point2d location;
99  double radius;
100  double confidence;
101  };
102 
103  virtual void findBlobs(const cv::Mat& image, const cv::Mat& binary_image, std::vector<Center>& centers,
104  std::vector<std::vector<cv::Point>>& cur_contours) const;
105 
106  std::vector<std::vector<cv::Point>> contours_;
107 
108  Params params_;
109 };
110 
111 #endif // BLOBDETECTOR_H_
Detect blobs in image (specialized for dynamic obstacles in the costmap)
Definition: blob_detector.h:60
virtual void detect(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints, const cv::Mat &mask=cv::Mat())
Detects keypoints in an image and extracts contours.
void updateParameters(const cv::SimpleBlobDetector::Params &parameters)
Update internal parameters.
virtual void findBlobs(const cv::Mat &image, const cv::Mat &binary_image, std::vector< Center > &centers, std::vector< std::vector< cv::Point >> &cur_contours) const
BlobDetector(const cv::SimpleBlobDetector::Params &parameters=cv::SimpleBlobDetector::Params())
Default constructor which optionally accepts custom parameters.
const std::vector< std::vector< cv::Point > > & getContours()
Access contours extracted during detection stage.
Definition: blob_detector.h:90
cv::Point2d location
Definition: blob_detector.h:98
static cv::Ptr< BlobDetector > create(const BlobDetector::Params &params)
Create shared instance of the blob detector with given parameters.
std::vector< std::vector< cv::Point > > contours_


costmap_converter
Author(s): Christoph Rösmann , Franz Albers , Otniel Rinaldo
autogenerated on Fri Jun 7 2019 21:48:43