OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
EdgeHoleBlobExtractor.cpp
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 // Internal Includes
26 #include "EdgeHoleBlobExtractor.h"
27 #include "cvUtils.h"
28 
29 // Library/third-party includes
30 // - none
31 
32 // Standard includes
33 // - none
34 
35 namespace osvr {
36 namespace vbtracker {
37  EdgeHoleBlobExtractor::EdgeHoleBlobExtractor(
38  BlobParams const &blobParams, EdgeHoleParams const &extParams)
39  : m_params(blobParams), m_extractor(extParams) {}
40  cv::Mat EdgeHoleBlobExtractor::generateDebugThresholdImage_() const {
41  return m_extractor.getEdgeDetectedImage().clone();
42  }
43 
44  cv::Mat EdgeHoleBlobExtractor::generateDebugBlobImage_() const {
45  // Draw outlines and centers of detected LEDs in blue.
46  cv::Mat gray = getLatestGrayImage();
47  return drawSingleColoredContours(gray, m_extractor.getContours(),
48  cv::Scalar(255, 0, 0));
49  }
50 
51  LedMeasurementVec EdgeHoleBlobExtractor::extractBlobs_() {
52  return m_extractor(getLatestGrayImage(), m_params);
53  }
54 
55  BlobExtractorPtr
56  makeEdgeHoleBlobExtractor(BlobParams const &blobParams,
57  EdgeHoleParams const &extParams) {
58  auto extractor =
59  std::make_shared<EdgeHoleBlobExtractor>(blobParams, extParams);
60  return extractor;
61  }
62 
63 } // namespace vbtracker
64 } // namespace osvr
Header.
double Scalar
Common scalar type.