OSVR-Core
ParseBlobParams.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_ParseBlobParams_h_GUID_D159000A_2DAE_4C96_3DB1_C22A119C7513
26 #define INCLUDED_ParseBlobParams_h_GUID_D159000A_2DAE_4C96_3DB1_C22A119C7513
27 
28 // Internal Includes
29 #include <BlobParams.h>
30 #include <GetOptionalParameter.h>
31 
32 // Library/third-party includes
33 #include <json/value.h>
34 
35 // Standard includes
36 // - none
37 
38 namespace osvr {
39 namespace vbtracker {
40  inline void parseBlobParams(Json::Value const &blob, BlobParams &p) {
41  getOptionalParameter(p.absoluteMinThreshold, blob,
42  "absoluteMinThreshold");
43  getOptionalParameter(p.minDistBetweenBlobs, blob,
44  "minDistBetweenBlobs");
45  getOptionalParameter(p.minArea, blob, "minArea");
46  getOptionalParameter(p.filterByCircularity, blob,
47  "filterByCircularity");
48  getOptionalParameter(p.minCircularity, blob, "minCircularity");
49  getOptionalParameter(p.filterByConvexity, blob, "filterByConvexity");
50  getOptionalParameter(p.minConvexity, blob, "minConvexity");
51  getOptionalParameter(p.minThresholdAlpha, blob, "minThresholdAlpha");
52  getOptionalParameter(p.maxThresholdAlpha, blob, "maxThresholdAlpha");
53  getOptionalParameter(p.thresholdSteps, blob, "thresholdSteps");
54  }
55 
56  inline void parseEdgeHoleExtractorParams(Json::Value const &config,
57  EdgeHoleParams &p) {
58  getOptionalParameter(p.preEdgeDetectionBlurSize, config,
59  "preEdgeDetectionBlurSize");
60  getOptionalParameter(p.laplacianKSize, config, "laplacianKSize");
61  getOptionalParameter(p.laplacianScale, config, "laplacianScale");
62  getOptionalParameter(p.edgeDetectErosion, config, "edgeDetectErosion");
63  getOptionalParameter(p.erosionKernelValue, config,
64  "erosionKernelValue");
65  getOptionalParameter(p.postEdgeDetectionBlur, config,
66  "postEdgeDetectionBlur");
67  getOptionalParameter(p.postEdgeDetectionBlurSize, config,
68  "postEdgeDetectionBlurSize");
69  getOptionalParameter(p.postEdgeDetectionBlurThreshold, config,
70  "postEdgeDetectionBlurThreshold");
71  }
72 } // End namespace vbtracker
73 } // End namespace osvr
74 
75 #endif // INCLUDED_ParseBlobParams_h_GUID_D159000A_2DAE_4C96_3DB1_C22A119C7513
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
void getOptionalParameter(T &dest, Json::Value const &obj, const char *key)
Gets an optional parameter from a JSON object: if it&#39;s not present, the existing value is left there...
Definition: GetOptionalParameter.h:60
Header.