OSVR-Core
GenericBlobExtractor.h
Go to the documentation of this file.
1 
11 // Copyright 2016 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_GenericBlobExtractor_h_GUID_0EE9AD0D_FCD3_498A_EF04_19D24185ED6B
26 #define INCLUDED_GenericBlobExtractor_h_GUID_0EE9AD0D_FCD3_498A_EF04_19D24185ED6B
27 
28 // Internal Includes
29 #include "LedMeasurement.h"
30 
31 // Library/third-party includes
32 #include <opencv2/core/core.hpp>
33 
34 // Standard includes
35 #include <memory>
36 
37 namespace osvr {
38 namespace vbtracker {
39 
44  public:
45  virtual ~GenericBlobExtractor();
46 
47  cv::Mat const &getLatestGrayImage() const { return lastGrayImage_; }
48  cv::Mat const &getDebugThresholdImage();
49  cv::Mat const &getDebugBlobImage();
50 
51  LedMeasurementVec const &extractBlobs(cv::Mat const &grayImage);
52  LedMeasurementVec const &getLatestMeasurements() const {
53  return latestMeasurements_;
54  }
55 
56  protected:
57  virtual cv::Mat generateDebugThresholdImage_() const = 0;
58  virtual cv::Mat generateDebugBlobImage_() const = 0;
59  virtual LedMeasurementVec extractBlobs_() = 0;
60  GenericBlobExtractor() = default;
61 
62  private:
63  cv::Mat lastGrayImage_;
64  LedMeasurementVec latestMeasurements_;
65 
66  bool m_debugThresholdImageDirty = true;
67  cv::Mat m_debugThresholdImage;
68 
69  bool m_debugBlobImageDirty = true;
70  cv::Mat m_debugBlobImage;
71  };
72  using BlobExtractorPtr = std::shared_ptr<GenericBlobExtractor>;
73 
74 } // namespace vbtracker
75 } // namespace osvr
76 #endif // INCLUDED_GenericBlobExtractor_h_GUID_0EE9AD0D_FCD3_498A_EF04_19D24185ED6B
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
This is an interface/base class for blob extractors that have the ability to provide graphical debug ...
Definition: GenericBlobExtractor.h:43