/usr/include/OTB-6.4/otbCvRTreesWrapper.h is in libotb-dev 6.4.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | /*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbCvRTreesWrapper_h
#define otbCvRTreesWrapper_h
#include "otbOpenCVUtils.h"
#include <vector>
namespace otb
{
/** \class CvRTreesWrapper
* \brief Wrapper for OpenCV Random Trees
*
* \ingroup OTBSupervised
*/
class OTBSupervised_EXPORT CvRTreesWrapper
#ifdef OTB_OPENCV_3
: public cv::ml::RTrees
#else
: public CvRTrees
#endif
{
public:
typedef std::vector<unsigned int> VotesVectorType;
CvRTreesWrapper();
~CvRTreesWrapper() ITK_OVERRIDE;
/** Compute the number of votes for each class. */
void get_votes(const cv::Mat& sample,
const cv::Mat& missing,
VotesVectorType& vote_count) const;
/** Predict the confidence of the classifcation by computing the proportion
of trees which voted for the majority class.
*/
float predict_confidence(const cv::Mat& sample,
const cv::Mat& missing =
cv::Mat()) const;
/** Predict the confidence margin of the classifcation by computing the
difference in votes between the first and second most voted classes.
This measure is preferred to the proportion of votes of the majority
class, since it provides information about the conflict between the
most likely classes.
*/
float predict_margin(const cv::Mat& sample,
const cv::Mat& missing =
cv::Mat()) const;
#ifdef OTB_OPENCV_3
#define OTB_CV_WRAP_PROPERTY(type,name) \
virtual type get##name() const; \
virtual void set##name(type val);
#define OTB_CV_WRAP_PROPERTY_REF(type,name) \
virtual type get##name() const; \
virtual void set##name(const type &val);
#define OTB_CV_WRAP_CSTREF_GET(type, name) \
virtual const type& get##name() const;
// TODO : wrap all method used
virtual int getVarCount() const;
virtual bool isTrained() const;
virtual bool isClassifier() const;
OTB_CV_WRAP_PROPERTY(int, MaxCategories)
OTB_CV_WRAP_PROPERTY(int, MaxDepth)
OTB_CV_WRAP_PROPERTY(int, MinSampleCount)
OTB_CV_WRAP_PROPERTY(bool, UseSurrogates)
OTB_CV_WRAP_PROPERTY(int, CVFolds)
OTB_CV_WRAP_PROPERTY(bool, Use1SERule)
OTB_CV_WRAP_PROPERTY(bool,TruncatePrunedTree)
OTB_CV_WRAP_PROPERTY(float, RegressionAccuracy)
OTB_CV_WRAP_PROPERTY(bool, CalculateVarImportance)
OTB_CV_WRAP_PROPERTY(int, ActiveVarCount)
OTB_CV_WRAP_PROPERTY_REF(cv::Mat, Priors)
OTB_CV_WRAP_PROPERTY_REF(cv::TermCriteria, TermCriteria)
OTB_CV_WRAP_CSTREF_GET(std::vector<int>, Roots)
OTB_CV_WRAP_CSTREF_GET(std::vector<cv::ml::DTrees::Node>, Nodes)
OTB_CV_WRAP_CSTREF_GET(std::vector<cv::ml::DTrees::Split>, Splits)
OTB_CV_WRAP_CSTREF_GET(std::vector<int>, Subsets)
virtual cv::Mat getVarImportance() const;
virtual cv::String getDefaultName () const;
virtual void read (const cv::FileNode &fn);
virtual void write (cv::FileStorage &fs) const;
virtual void save (const cv::String &filename) const;
virtual bool train(cv::InputArray samples, int layout, cv::InputArray responses);
virtual bool train( const cv::Ptr<cv::ml::TrainData>& trainData, int flags=0 );
virtual float predict (cv::InputArray samples, cv::OutputArray results=cv::noArray(), int flags=0) const;
static cv::Ptr<CvRTreesWrapper> create();
#undef OTB_CV_WRAP_PROPERTY
#undef OTB_CV_WRAP_PROPERTY_REF
#undef OTB_CV_WRAP_CSTREF_GET
private:
cv::Ptr<cv::ml::RTrees> m_Impl;
#endif // OTB_OPENCV_3
};
}
#endif
|