From 7335a40a61e29edf1d1c48300197c39b6bdf7b4d Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Wed, 18 Mar 2015 17:23:42 +0300 Subject: [PATCH] Replaced CV_PURE_PROPERTY macros with corresponding code --- doc/Doxyfile.in | 6 +- modules/core/include/opencv2/core.hpp | 13 - modules/ml/include/opencv2/ml.hpp | 225 ++++++++++++++---- modules/superres/include/opencv2/superres.hpp | 50 +++- .../include/opencv2/superres/optical_flow.hpp | 120 ++++++++-- .../video/include/opencv2/video/tracking.hpp | 60 ++++- 6 files changed, 365 insertions(+), 109 deletions(-) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 93ccafaae..192081e9b 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -243,11 +243,7 @@ PREDEFINED = __cplusplus=1 \ CV_NORETURN= \ CV_DEFAULT(x)=" = x" \ CV_NEON=1 \ - FLANN_DEPRECATED= \ - "CV_PURE_PROPERTY(type, name)= /** \@see set##name */ virtual type get##name() const = 0; /** \@copybrief get##name \@see get##name */ virtual void set##name(type val) = 0;" \ - "CV_IMPL_PROPERTY(type, name, x)= /** \@see set##name */ virtual type get##name() const = 0; /** \@copybrief get##name \@see get##name */ virtual void set##name(type val) = 0;" \ - "CV_IMPL_PROPERTY_S(type, name, x)= /** \@see set##name */ virtual type get##name() const = 0; /** \@copybrief get##name \@see get##name */ virtual void set##name(const type & val);" \ - "CV_IMPL_PROPERTY_RO(type, name, x)= virtual type get##name() const;" + FLANN_DEPRECATED= EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES TAGFILES = diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 896aa12bf..ae6de3a97 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -2821,19 +2821,6 @@ public: virtual void read(const FileNode& fn) { (void)fn; } }; -// define properties - -#define CV_PURE_PROPERTY(type, name) \ - CV_WRAP virtual type get##name() const = 0; \ - CV_WRAP virtual void set##name(type val) = 0; - -#define CV_PURE_PROPERTY_S(type, name) \ - CV_WRAP virtual type get##name() const = 0; \ - CV_WRAP virtual void set##name(const type & val) = 0; - -#define CV_PURE_PROPERTY_RO(type, name) \ - CV_WRAP virtual type get##name() const = 0; - // basic property implementation #define CV_IMPL_PROPERTY_RO(type, name, member) \ diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index 8959c58d8..f5aa85064 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -440,16 +440,28 @@ class CV_EXPORTS_W KNearest : public StatModel public: /** Default number of neighbors to use in predict method. */ - CV_PURE_PROPERTY(int, DefaultK) + /** @see setDefaultK */ + virtual int getDefaultK() const = 0; + /** @copybrief getDefaultK @see getDefaultK */ + virtual void setDefaultK(int val) = 0; /** Whether classification or regression model should be trained. */ - CV_PURE_PROPERTY(bool, IsClassifier) + /** @see setIsClassifier */ + virtual bool getIsClassifier() const = 0; + /** @copybrief getIsClassifier @see getIsClassifier */ + virtual void setIsClassifier(bool val) = 0; /** Parameter for KDTree implementation. */ - CV_PURE_PROPERTY(int, Emax) + /** @see setEmax */ + virtual int getEmax() const = 0; + /** @copybrief getEmax @see getEmax */ + virtual void setEmax(int val) = 0; /** %Algorithm type, one of KNearest::Types. */ - CV_PURE_PROPERTY(int, AlgorithmType) + /** @see setAlgorithmType */ + virtual int getAlgorithmType() const = 0; + /** @copybrief getAlgorithmType @see getAlgorithmType */ + virtual void setAlgorithmType(int val) = 0; /** @brief Finds the neighbors and predicts responses for input vectors. @@ -518,44 +530,71 @@ public: /** Type of a %SVM formulation. See SVM::Types. Default value is SVM::C_SVC. */ - CV_PURE_PROPERTY(int, Type) + /** @see setType */ + virtual int getType() const = 0; + /** @copybrief getType @see getType */ + virtual void setType(int val) = 0; /** Parameter \f$\gamma\f$ of a kernel function. For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1. */ - CV_PURE_PROPERTY(double, Gamma) + /** @see setGamma */ + virtual double getGamma() const = 0; + /** @copybrief getGamma @see getGamma */ + virtual void setGamma(double val) = 0; /** Parameter _coef0_ of a kernel function. For SVM::POLY or SVM::SIGMOID. Default value is 0.*/ - CV_PURE_PROPERTY(double, Coef0) + /** @see setCoef0 */ + virtual double getCoef0() const = 0; + /** @copybrief getCoef0 @see getCoef0 */ + virtual void setCoef0(double val) = 0; /** Parameter _degree_ of a kernel function. For SVM::POLY. Default value is 0. */ - CV_PURE_PROPERTY(double, Degree) + /** @see setDegree */ + virtual double getDegree() const = 0; + /** @copybrief getDegree @see getDegree */ + virtual void setDegree(double val) = 0; /** Parameter _C_ of a %SVM optimization problem. For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0. */ - CV_PURE_PROPERTY(double, C) + /** @see setC */ + virtual double getC() const = 0; + /** @copybrief getC @see getC */ + virtual void setC(double val) = 0; /** Parameter \f$\nu\f$ of a %SVM optimization problem. For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0. */ - CV_PURE_PROPERTY(double, Nu) + /** @see setNu */ + virtual double getNu() const = 0; + /** @copybrief getNu @see getNu */ + virtual void setNu(double val) = 0; /** Parameter \f$\epsilon\f$ of a %SVM optimization problem. For SVM::EPS_SVR. Default value is 0. */ - CV_PURE_PROPERTY(double, P) + /** @see setP */ + virtual double getP() const = 0; + /** @copybrief getP @see getP */ + virtual void setP(double val) = 0; /** Optional weights in the SVM::C_SVC problem, assigned to particular classes. They are multiplied by _C_ so the parameter _C_ of class _i_ becomes `classWeights(i) * C`. Thus these weights affect the misclassification penalty for different classes. The larger weight, the larger penalty on misclassification of data from the corresponding class. Default value is empty Mat. */ - CV_PURE_PROPERTY_S(cv::Mat, ClassWeights) + /** @see setClassWeights */ + virtual cv::Mat getClassWeights() const = 0; + /** @copybrief getClassWeights @see getClassWeights */ + virtual void setClassWeights(const cv::Mat &val) = 0; /** Termination criteria of the iterative %SVM training procedure which solves a partial case of constrained quadratic optimization problem. You can specify tolerance and/or the maximum number of iterations. Default value is `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`; */ - CV_PURE_PROPERTY_S(cv::TermCriteria, TermCriteria) + /** @see setTermCriteria */ + virtual cv::TermCriteria getTermCriteria() const = 0; + /** @copybrief getTermCriteria @see getTermCriteria */ + virtual void setTermCriteria(const cv::TermCriteria &val) = 0; /** Type of a %SVM kernel. See SVM::KernelTypes. Default value is SVM::RBF. */ @@ -755,17 +794,26 @@ public: Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. Some of %EM implementation could determine the optimal number of mixtures within a specified value range, but that is not the case in ML yet. */ - CV_PURE_PROPERTY(int, ClustersNumber) + /** @see setClustersNumber */ + virtual int getClustersNumber() const = 0; + /** @copybrief getClustersNumber @see getClustersNumber */ + virtual void setClustersNumber(int val) = 0; /** Constraint on covariance matrices which defines type of matrices. See EM::Types. */ - CV_PURE_PROPERTY(int, CovarianceMatrixType) + /** @see setCovarianceMatrixType */ + virtual int getCovarianceMatrixType() const = 0; + /** @copybrief getCovarianceMatrixType @see getCovarianceMatrixType */ + virtual void setCovarianceMatrixType(int val) = 0; /** The termination criteria of the %EM algorithm. The %EM algorithm can be terminated by the number of iterations termCrit.maxCount (number of M-steps) or when relative change of likelihood logarithm is less than termCrit.epsilon. Default maximum number of iterations is EM::DEFAULT_MAX_ITERS=100. */ - CV_PURE_PROPERTY_S(TermCriteria, TermCriteria) + /** @see setTermCriteria */ + virtual TermCriteria getTermCriteria() const = 0; + /** @copybrief getTermCriteria @see getTermCriteria */ + virtual void setTermCriteria(const TermCriteria &val) = 0; /** @brief Returns weights of the mixtures @@ -926,46 +974,70 @@ public: values. In case of regression and 2-class classification the optimal split can be found efficiently without employing clustering, thus the parameter is not used in these cases. Default value is 10.*/ - CV_PURE_PROPERTY(int, MaxCategories) + /** @see setMaxCategories */ + virtual int getMaxCategories() const = 0; + /** @copybrief getMaxCategories @see getMaxCategories */ + virtual void setMaxCategories(int val) = 0; /** The maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than maxDepth. The root node has zero depth. The actual depth may be smaller if the other termination criteria are met (see the outline of the training procedure @ref ml_intro_trees "here"), and/or if the tree is pruned. Default value is INT_MAX.*/ - CV_PURE_PROPERTY(int, MaxDepth) + /** @see setMaxDepth */ + virtual int getMaxDepth() const = 0; + /** @copybrief getMaxDepth @see getMaxDepth */ + virtual void setMaxDepth(int val) = 0; /** If the number of samples in a node is less than this parameter then the node will not be split. Default value is 10.*/ - CV_PURE_PROPERTY(int, MinSampleCount) + /** @see setMinSampleCount */ + virtual int getMinSampleCount() const = 0; + /** @copybrief getMinSampleCount @see getMinSampleCount */ + virtual void setMinSampleCount(int val) = 0; /** If CVFolds \> 1 then algorithms prunes the built decision tree using K-fold cross-validation procedure where K is equal to CVFolds. Default value is 10.*/ - CV_PURE_PROPERTY(int, CVFolds) + /** @see setCVFolds */ + virtual int getCVFolds() const = 0; + /** @copybrief getCVFolds @see getCVFolds */ + virtual void setCVFolds(int val) = 0; /** If true then surrogate splits will be built. These splits allow to work with missing data and compute variable importance correctly. Default value is false. @note currently it's not implemented.*/ - CV_PURE_PROPERTY(bool, UseSurrogates) + /** @see setUseSurrogates */ + virtual bool getUseSurrogates() const = 0; + /** @copybrief getUseSurrogates @see getUseSurrogates */ + virtual void setUseSurrogates(bool val) = 0; /** If true then a pruning will be harsher. This will make a tree more compact and more resistant to the training data noise but a bit less accurate. Default value is true.*/ - CV_PURE_PROPERTY(bool, Use1SERule) + /** @see setUse1SERule */ + virtual bool getUse1SERule() const = 0; + /** @copybrief getUse1SERule @see getUse1SERule */ + virtual void setUse1SERule(bool val) = 0; /** If true then pruned branches are physically removed from the tree. Otherwise they are retained and it is possible to get results from the original unpruned (or pruned less aggressively) tree. Default value is true.*/ - CV_PURE_PROPERTY(bool, TruncatePrunedTree) + /** @see setTruncatePrunedTree */ + virtual bool getTruncatePrunedTree() const = 0; + /** @copybrief getTruncatePrunedTree @see getTruncatePrunedTree */ + virtual void setTruncatePrunedTree(bool val) = 0; /** Termination criteria for regression trees. If all absolute differences between an estimated value in a node and values of train samples in this node are less than this parameter then the node will not be split further. Default value is 0.01f*/ - CV_PURE_PROPERTY(float, RegressionAccuracy) + /** @see setRegressionAccuracy */ + virtual float getRegressionAccuracy() const = 0; + /** @copybrief getRegressionAccuracy @see getRegressionAccuracy */ + virtual void setRegressionAccuracy(float val) = 0; /** @brief The array of a priori class probabilities, sorted by the class label value. @@ -982,7 +1054,10 @@ public: category is 1 and the weight of the second category is 10, then each mistake in predicting the second category is equivalent to making 10 mistakes in predicting the first category. Default value is empty Mat.*/ - CV_PURE_PROPERTY_S(cv::Mat, Priors) + /** @see setPriors */ + virtual cv::Mat getPriors() const = 0; + /** @copybrief getPriors @see getPriors */ + virtual void setPriors(const cv::Mat &val) = 0; /** @brief The class represents a decision tree node. */ @@ -1071,13 +1146,19 @@ public: /** If true then variable importance will be calculated and then it can be retrieved by RTrees::getVarImportance. Default value is false.*/ - CV_PURE_PROPERTY(bool, CalculateVarImportance) + /** @see setCalculateVarImportance */ + virtual bool getCalculateVarImportance() const = 0; + /** @copybrief getCalculateVarImportance @see getCalculateVarImportance */ + virtual void setCalculateVarImportance(bool val) = 0; /** The size of the randomly selected subset of features at each tree node and that are used to find the best split(s). If you set it to 0 then the size will be set to the square root of the total number of features. Default value is 0.*/ - CV_PURE_PROPERTY(int, ActiveVarCount) + /** @see setActiveVarCount */ + virtual int getActiveVarCount() const = 0; + /** @copybrief getActiveVarCount @see getActiveVarCount */ + virtual void setActiveVarCount(int val) = 0; /** The termination criteria that specifies when the training algorithm stops. Either when the specified number of trees is trained and added to the ensemble or when @@ -1086,7 +1167,10 @@ public: pass a certain number of trees. Also to keep in mind, the number of tree increases the prediction time linearly. Default value is TermCriteria(TermCriteria::MAX_ITERS + TermCriteria::EPS, 50, 0.1)*/ - CV_PURE_PROPERTY_S(TermCriteria, TermCriteria) + /** @see setTermCriteria */ + virtual TermCriteria getTermCriteria() const = 0; + /** @copybrief getTermCriteria @see getTermCriteria */ + virtual void setTermCriteria(const TermCriteria &val) = 0; /** Returns the variable importance array. The method returns the variable importance vector, computed at the training stage when @@ -1115,16 +1199,25 @@ class CV_EXPORTS_W Boost : public DTrees public: /** Type of the boosting algorithm. See Boost::Types. Default value is Boost::REAL. */ - CV_PURE_PROPERTY(int, BoostType) + /** @see setBoostType */ + virtual int getBoostType() const = 0; + /** @copybrief getBoostType @see getBoostType */ + virtual void setBoostType(int val) = 0; /** The number of weak classifiers. Default value is 100. */ - CV_PURE_PROPERTY(int, WeakCount) + /** @see setWeakCount */ + virtual int getWeakCount() const = 0; + /** @copybrief getWeakCount @see getWeakCount */ + virtual void setWeakCount(int val) = 0; /** A threshold between 0 and 1 used to save computational time. Samples with summary weight \f$\leq 1 - weight_trim_rate\f$ do not participate in the *next* iteration of training. Set this parameter to 0 to turn off this functionality. Default value is 0.95.*/ - CV_PURE_PROPERTY(double, WeightTrimRate) + /** @see setWeightTrimRate */ + virtual double getWeightTrimRate() const = 0; + /** @copybrief getWeightTrimRate @see getWeightTrimRate */ + virtual void setWeightTrimRate(double val) = 0; /** Boosting type. Gentle AdaBoost and Real AdaBoost are often the preferable choices. */ @@ -1232,37 +1325,61 @@ public: You can specify the maximum number of iterations (maxCount) and/or how much the error could change between the iterations to make the algorithm continue (epsilon). Default value is TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, 0.01).*/ - CV_PURE_PROPERTY(TermCriteria, TermCriteria) + /** @see setTermCriteria */ + virtual TermCriteria getTermCriteria() const = 0; + /** @copybrief getTermCriteria @see getTermCriteria */ + virtual void setTermCriteria(TermCriteria val) = 0; /** BPROP: Strength of the weight gradient term. The recommended value is about 0.1. Default value is 0.1.*/ - CV_PURE_PROPERTY(double, BackpropWeightScale) + /** @see setBackpropWeightScale */ + virtual double getBackpropWeightScale() const = 0; + /** @copybrief getBackpropWeightScale @see getBackpropWeightScale */ + virtual void setBackpropWeightScale(double val) = 0; /** BPROP: Strength of the momentum term (the difference between weights on the 2 previous iterations). This parameter provides some inertia to smooth the random fluctuations of the weights. It can vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or so is good enough. Default value is 0.1.*/ - CV_PURE_PROPERTY(double, BackpropMomentumScale) + /** @see setBackpropMomentumScale */ + virtual double getBackpropMomentumScale() const = 0; + /** @copybrief getBackpropMomentumScale @see getBackpropMomentumScale */ + virtual void setBackpropMomentumScale(double val) = 0; /** RPROP: Initial value \f$\Delta_0\f$ of update-values \f$\Delta_{ij}\f$. Default value is 0.1.*/ - CV_PURE_PROPERTY(double, RpropDW0) + /** @see setRpropDW0 */ + virtual double getRpropDW0() const = 0; + /** @copybrief getRpropDW0 @see getRpropDW0 */ + virtual void setRpropDW0(double val) = 0; /** RPROP: Increase factor \f$\eta^+\f$. It must be \>1. Default value is 1.2.*/ - CV_PURE_PROPERTY(double, RpropDWPlus) + /** @see setRpropDWPlus */ + virtual double getRpropDWPlus() const = 0; + /** @copybrief getRpropDWPlus @see getRpropDWPlus */ + virtual void setRpropDWPlus(double val) = 0; /** RPROP: Decrease factor \f$\eta^-\f$. It must be \<1. Default value is 0.5.*/ - CV_PURE_PROPERTY(double, RpropDWMinus) + /** @see setRpropDWMinus */ + virtual double getRpropDWMinus() const = 0; + /** @copybrief getRpropDWMinus @see getRpropDWMinus */ + virtual void setRpropDWMinus(double val) = 0; /** RPROP: Update-values lower limit \f$\Delta_{min}\f$. It must be positive. Default value is FLT_EPSILON.*/ - CV_PURE_PROPERTY(double, RpropDWMin) + /** @see setRpropDWMin */ + virtual double getRpropDWMin() const = 0; + /** @copybrief getRpropDWMin @see getRpropDWMin */ + virtual void setRpropDWMin(double val) = 0; /** RPROP: Update-values upper limit \f$\Delta_{max}\f$. It must be \>1. Default value is 50.*/ - CV_PURE_PROPERTY(double, RpropDWMax) + /** @see setRpropDWMax */ + virtual double getRpropDWMax() const = 0; + /** @copybrief getRpropDWMax @see getRpropDWMax */ + virtual void setRpropDWMax(double val) = 0; /** possible activation functions */ enum ActivationFunctions { @@ -1318,24 +1435,42 @@ class CV_EXPORTS LogisticRegression : public StatModel public: /** Learning rate. */ - CV_PURE_PROPERTY(double, LearningRate) + /** @see setLearningRate */ + virtual double getLearningRate() const = 0; + /** @copybrief getLearningRate @see getLearningRate */ + virtual void setLearningRate(double val) = 0; /** Number of iterations. */ - CV_PURE_PROPERTY(int, Iterations) + /** @see setIterations */ + virtual int getIterations() const = 0; + /** @copybrief getIterations @see getIterations */ + virtual void setIterations(int val) = 0; /** Kind of regularization to be applied. See LogisticRegression::RegKinds. */ - CV_PURE_PROPERTY(int, Regularization) + /** @see setRegularization */ + virtual int getRegularization() const = 0; + /** @copybrief getRegularization @see getRegularization */ + virtual void setRegularization(int val) = 0; /** Kind of training method used. See LogisticRegression::Methods. */ - CV_PURE_PROPERTY(int, TrainMethod) + /** @see setTrainMethod */ + virtual int getTrainMethod() const = 0; + /** @copybrief getTrainMethod @see getTrainMethod */ + virtual void setTrainMethod(int val) = 0; /** Specifies the number of training samples taken in each step of Mini-Batch Gradient Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. It has to take values less than the total number of training samples. */ - CV_PURE_PROPERTY(int, MiniBatchSize) + /** @see setMiniBatchSize */ + virtual int getMiniBatchSize() const = 0; + /** @copybrief getMiniBatchSize @see getMiniBatchSize */ + virtual void setMiniBatchSize(int val) = 0; /** Termination criteria of the algorithm. */ - CV_PURE_PROPERTY(TermCriteria, TermCriteria) + /** @see setTermCriteria */ + virtual TermCriteria getTermCriteria() const = 0; + /** @copybrief getTermCriteria @see getTermCriteria */ + virtual void setTermCriteria(TermCriteria val) = 0; //! Regularization kinds enum RegKinds { diff --git a/modules/superres/include/opencv2/superres.hpp b/modules/superres/include/opencv2/superres.hpp index acc067302..dec8e4eda 100644 --- a/modules/superres/include/opencv2/superres.hpp +++ b/modules/superres/include/opencv2/superres.hpp @@ -105,34 +105,64 @@ namespace cv virtual void collectGarbage(); //! @brief Scale factor - CV_PURE_PROPERTY(int, Scale) + /** @see setScale */ + virtual int getScale() const = 0; + /** @copybrief getScale @see getScale */ + virtual void setScale(int val) = 0; //! @brief Iterations count - CV_PURE_PROPERTY(int, Iterations) + /** @see setIterations */ + virtual int getIterations() const = 0; + /** @copybrief getIterations @see getIterations */ + virtual void setIterations(int val) = 0; //! @brief Asymptotic value of steepest descent method - CV_PURE_PROPERTY(double, Tau) + /** @see setTau */ + virtual double getTau() const = 0; + /** @copybrief getTau @see getTau */ + virtual void setTau(double val) = 0; //! @brief Weight parameter to balance data term and smoothness term - CV_PURE_PROPERTY(double, Labmda) + /** @see setLabmda */ + virtual double getLabmda() const = 0; + /** @copybrief getLabmda @see getLabmda */ + virtual void setLabmda(double val) = 0; //! @brief Parameter of spacial distribution in Bilateral-TV - CV_PURE_PROPERTY(double, Alpha) + /** @see setAlpha */ + virtual double getAlpha() const = 0; + /** @copybrief getAlpha @see getAlpha */ + virtual void setAlpha(double val) = 0; //! @brief Kernel size of Bilateral-TV filter - CV_PURE_PROPERTY(int, KernelSize) + /** @see setKernelSize */ + virtual int getKernelSize() const = 0; + /** @copybrief getKernelSize @see getKernelSize */ + virtual void setKernelSize(int val) = 0; //! @brief Gaussian blur kernel size - CV_PURE_PROPERTY(int, BlurKernelSize) + /** @see setBlurKernelSize */ + virtual int getBlurKernelSize() const = 0; + /** @copybrief getBlurKernelSize @see getBlurKernelSize */ + virtual void setBlurKernelSize(int val) = 0; //! @brief Gaussian blur sigma - CV_PURE_PROPERTY(double, BlurSigma) + /** @see setBlurSigma */ + virtual double getBlurSigma() const = 0; + /** @copybrief getBlurSigma @see getBlurSigma */ + virtual void setBlurSigma(double val) = 0; //! @brief Radius of the temporal search area - CV_PURE_PROPERTY(int, TemporalAreaRadius) + /** @see setTemporalAreaRadius */ + virtual int getTemporalAreaRadius() const = 0; + /** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */ + virtual void setTemporalAreaRadius(int val) = 0; //! @brief Dense optical flow algorithm - CV_PURE_PROPERTY_S(Ptr, OpticalFlow) + /** @see setOpticalFlow */ + virtual Ptr getOpticalFlow() const = 0; + /** @copybrief getOpticalFlow @see getOpticalFlow */ + virtual void setOpticalFlow(const Ptr &val) = 0; protected: SuperResolution(); diff --git a/modules/superres/include/opencv2/superres/optical_flow.hpp b/modules/superres/include/opencv2/superres/optical_flow.hpp index add606c02..d2f29a39b 100644 --- a/modules/superres/include/opencv2/superres/optical_flow.hpp +++ b/modules/superres/include/opencv2/superres/optical_flow.hpp @@ -64,13 +64,34 @@ namespace cv class CV_EXPORTS FarnebackOpticalFlow : public virtual DenseOpticalFlowExt { public: - CV_PURE_PROPERTY(double, PyrScale) - CV_PURE_PROPERTY(int, LevelsNumber) - CV_PURE_PROPERTY(int, WindowSize) - CV_PURE_PROPERTY(int, Iterations) - CV_PURE_PROPERTY(int, PolyN) - CV_PURE_PROPERTY(double, PolySigma) - CV_PURE_PROPERTY(int, Flags) + /** @see setPyrScale */ + virtual double getPyrScale() const = 0; + /** @copybrief getPyrScale @see getPyrScale */ + virtual void setPyrScale(double val) = 0; + /** @see setLevelsNumber */ + virtual int getLevelsNumber() const = 0; + /** @copybrief getLevelsNumber @see getLevelsNumber */ + virtual void setLevelsNumber(int val) = 0; + /** @see setWindowSize */ + virtual int getWindowSize() const = 0; + /** @copybrief getWindowSize @see getWindowSize */ + virtual void setWindowSize(int val) = 0; + /** @see setIterations */ + virtual int getIterations() const = 0; + /** @copybrief getIterations @see getIterations */ + virtual void setIterations(int val) = 0; + /** @see setPolyN */ + virtual int getPolyN() const = 0; + /** @copybrief getPolyN @see getPolyN */ + virtual void setPolyN(int val) = 0; + /** @see setPolySigma */ + virtual double getPolySigma() const = 0; + /** @copybrief getPolySigma @see getPolySigma */ + virtual void setPolySigma(double val) = 0; + /** @see setFlags */ + virtual int getFlags() const = 0; + /** @copybrief getFlags @see getFlags */ + virtual void setFlags(int val) = 0; }; CV_EXPORTS Ptr createOptFlow_Farneback(); CV_EXPORTS Ptr createOptFlow_Farneback_CUDA(); @@ -82,14 +103,38 @@ namespace cv class CV_EXPORTS DualTVL1OpticalFlow : public virtual DenseOpticalFlowExt { public: - CV_PURE_PROPERTY(double, Tau) - CV_PURE_PROPERTY(double, Lambda) - CV_PURE_PROPERTY(double, Theta) - CV_PURE_PROPERTY(int, ScalesNumber) - CV_PURE_PROPERTY(int, WarpingsNumber) - CV_PURE_PROPERTY(double, Epsilon) - CV_PURE_PROPERTY(int, Iterations) - CV_PURE_PROPERTY(bool, UseInitialFlow) + /** @see setTau */ + virtual double getTau() const = 0; + /** @copybrief getTau @see getTau */ + virtual void setTau(double val) = 0; + /** @see setLambda */ + virtual double getLambda() const = 0; + /** @copybrief getLambda @see getLambda */ + virtual void setLambda(double val) = 0; + /** @see setTheta */ + virtual double getTheta() const = 0; + /** @copybrief getTheta @see getTheta */ + virtual void setTheta(double val) = 0; + /** @see setScalesNumber */ + virtual int getScalesNumber() const = 0; + /** @copybrief getScalesNumber @see getScalesNumber */ + virtual void setScalesNumber(int val) = 0; + /** @see setWarpingsNumber */ + virtual int getWarpingsNumber() const = 0; + /** @copybrief getWarpingsNumber @see getWarpingsNumber */ + virtual void setWarpingsNumber(int val) = 0; + /** @see setEpsilon */ + virtual double getEpsilon() const = 0; + /** @copybrief getEpsilon @see getEpsilon */ + virtual void setEpsilon(double val) = 0; + /** @see setIterations */ + virtual int getIterations() const = 0; + /** @copybrief getIterations @see getIterations */ + virtual void setIterations(int val) = 0; + /** @see setUseInitialFlow */ + virtual bool getUseInitialFlow() const = 0; + /** @copybrief getUseInitialFlow @see getUseInitialFlow */ + virtual void setUseInitialFlow(bool val) = 0; }; CV_EXPORTS Ptr createOptFlow_DualTVL1(); CV_EXPORTS Ptr createOptFlow_DualTVL1_CUDA(); @@ -99,17 +144,35 @@ namespace cv { public: //! @brief Flow smoothness - CV_PURE_PROPERTY(double, Alpha) + /** @see setAlpha */ + virtual double getAlpha() const = 0; + /** @copybrief getAlpha @see getAlpha */ + virtual void setAlpha(double val) = 0; //! @brief Gradient constancy importance - CV_PURE_PROPERTY(double, Gamma) + /** @see setGamma */ + virtual double getGamma() const = 0; + /** @copybrief getGamma @see getGamma */ + virtual void setGamma(double val) = 0; //! @brief Pyramid scale factor - CV_PURE_PROPERTY(double, ScaleFactor) + /** @see setScaleFactor */ + virtual double getScaleFactor() const = 0; + /** @copybrief getScaleFactor @see getScaleFactor */ + virtual void setScaleFactor(double val) = 0; //! @brief Number of lagged non-linearity iterations (inner loop) - CV_PURE_PROPERTY(int, InnerIterations) + /** @see setInnerIterations */ + virtual int getInnerIterations() const = 0; + /** @copybrief getInnerIterations @see getInnerIterations */ + virtual void setInnerIterations(int val) = 0; //! @brief Number of warping iterations (number of pyramid levels) - CV_PURE_PROPERTY(int, OuterIterations) + /** @see setOuterIterations */ + virtual int getOuterIterations() const = 0; + /** @copybrief getOuterIterations @see getOuterIterations */ + virtual void setOuterIterations(int val) = 0; //! @brief Number of linear system solver iterations - CV_PURE_PROPERTY(int, SolverIterations) + /** @see setSolverIterations */ + virtual int getSolverIterations() const = 0; + /** @copybrief getSolverIterations @see getSolverIterations */ + virtual void setSolverIterations(int val) = 0; }; CV_EXPORTS Ptr createOptFlow_Brox_CUDA(); @@ -117,9 +180,18 @@ namespace cv class PyrLKOpticalFlow : public virtual DenseOpticalFlowExt { public: - CV_PURE_PROPERTY(int, WindowSize) - CV_PURE_PROPERTY(int, MaxLevel) - CV_PURE_PROPERTY(int, Iterations) + /** @see setWindowSize */ + virtual int getWindowSize() const = 0; + /** @copybrief getWindowSize @see getWindowSize */ + virtual void setWindowSize(int val) = 0; + /** @see setMaxLevel */ + virtual int getMaxLevel() const = 0; + /** @copybrief getMaxLevel @see getMaxLevel */ + virtual void setMaxLevel(int val) = 0; + /** @see setIterations */ + virtual int getIterations() const = 0; + /** @copybrief getIterations @see getIterations */ + virtual void setIterations(int val) = 0; }; CV_EXPORTS Ptr createOptFlow_PyrLK_CUDA(); diff --git a/modules/video/include/opencv2/video/tracking.hpp b/modules/video/include/opencv2/video/tracking.hpp index 90be72ea2..718d76523 100644 --- a/modules/video/include/opencv2/video/tracking.hpp +++ b/modules/video/include/opencv2/video/tracking.hpp @@ -441,29 +441,65 @@ class CV_EXPORTS_W DualTVL1OpticalFlow : public DenseOpticalFlow { public: //! @brief Time step of the numerical scheme - CV_PURE_PROPERTY(double, Tau) + /** @see setTau */ + virtual double getTau() const = 0; + /** @copybrief getTau @see getTau */ + virtual void setTau(double val) = 0; //! @brief Weight parameter for the data term, attachment parameter - CV_PURE_PROPERTY(double, Lambda) + /** @see setLambda */ + virtual double getLambda() const = 0; + /** @copybrief getLambda @see getLambda */ + virtual void setLambda(double val) = 0; //! @brief Weight parameter for (u - v)^2, tightness parameter - CV_PURE_PROPERTY(double, Theta) + /** @see setTheta */ + virtual double getTheta() const = 0; + /** @copybrief getTheta @see getTheta */ + virtual void setTheta(double val) = 0; //! @brief coefficient for additional illumination variation term - CV_PURE_PROPERTY(double, Gamma) + /** @see setGamma */ + virtual double getGamma() const = 0; + /** @copybrief getGamma @see getGamma */ + virtual void setGamma(double val) = 0; //! @brief Number of scales used to create the pyramid of images - CV_PURE_PROPERTY(int, ScalesNumber) + /** @see setScalesNumber */ + virtual int getScalesNumber() const = 0; + /** @copybrief getScalesNumber @see getScalesNumber */ + virtual void setScalesNumber(int val) = 0; //! @brief Number of warpings per scale - CV_PURE_PROPERTY(int, WarpingsNumber) + /** @see setWarpingsNumber */ + virtual int getWarpingsNumber() const = 0; + /** @copybrief getWarpingsNumber @see getWarpingsNumber */ + virtual void setWarpingsNumber(int val) = 0; //! @brief Stopping criterion threshold used in the numerical scheme, which is a trade-off between precision and running time - CV_PURE_PROPERTY(double, Epsilon) + /** @see setEpsilon */ + virtual double getEpsilon() const = 0; + /** @copybrief getEpsilon @see getEpsilon */ + virtual void setEpsilon(double val) = 0; //! @brief Inner iterations (between outlier filtering) used in the numerical scheme - CV_PURE_PROPERTY(int, InnerIterations) + /** @see setInnerIterations */ + virtual int getInnerIterations() const = 0; + /** @copybrief getInnerIterations @see getInnerIterations */ + virtual void setInnerIterations(int val) = 0; //! @brief Outer iterations (number of inner loops) used in the numerical scheme - CV_PURE_PROPERTY(int, OuterIterations) + /** @see setOuterIterations */ + virtual int getOuterIterations() const = 0; + /** @copybrief getOuterIterations @see getOuterIterations */ + virtual void setOuterIterations(int val) = 0; //! @brief Use initial flow - CV_PURE_PROPERTY(bool, UseInitialFlow) + /** @see setUseInitialFlow */ + virtual bool getUseInitialFlow() const = 0; + /** @copybrief getUseInitialFlow @see getUseInitialFlow */ + virtual void setUseInitialFlow(bool val) = 0; //! @brief Step between scales (<1) - CV_PURE_PROPERTY(double, ScaleStep) + /** @see setScaleStep */ + virtual double getScaleStep() const = 0; + /** @copybrief getScaleStep @see getScaleStep */ + virtual void setScaleStep(double val) = 0; //! @brief Median filter kernel size (1 = no filter) (3 or 5) - CV_PURE_PROPERTY(int, MedianFiltering) + /** @see setMedianFiltering */ + virtual int getMedianFiltering() const = 0; + /** @copybrief getMedianFiltering @see getMedianFiltering */ + virtual void setMedianFiltering(int val) = 0; }; /** @brief Creates instance of cv::DenseOpticalFlow