首页 > 代码库 > OpenCV Machine Learning 之正态贝叶斯分类器源代码分析(Normal Bayes Classifier)
OpenCV Machine Learning 之正态贝叶斯分类器源代码分析(Normal Bayes Classifier)
1. CvNormalBayesClassifier的 类 定 义
在ml.hpp中有以下类定义:
[cpp] view plaincopyprint?
- class CV_EXPORTS_W CvNormalBayesClassifier : public CvStatModel
- {
- public:
- CV_WRAP CvNormalBayesClassifier();
- virtual ~CvNormalBayesClassifier();
- CvNormalBayesClassifier( const CvMat* trainData, const CvMat* responses,
- const CvMat* varIdx=0, const CvMat* sampleIdx=0 );
- virtual bool train( const CvMat* trainData, const CvMat* responses,
- const CvMat* varIdx = 0, const CvMat* sampleIdx=0, bool update=false );
- virtual float predict( const CvMat* samples, CV_OUT CvMat* results=0 ) const;
- CV_WRAP virtual void clear();
- CV_WRAP CvNormalBayesClassifier( const cv::Mat& trainData, const cv::Mat& responses,
- const cv::Mat& varIdx=cv::Mat(), const cv::Mat& sampleIdx=cv::Mat() );
- CV_WRAP virtual bool train( const cv::Mat& trainData, const cv::Mat& responses,
- const cv::Mat& varIdx = cv::Mat(), const cv::Mat& sampleIdx=cv::Mat(),
- bool update=false );
- CV_WRAP virtual float predict( const cv::Mat& samples, CV_OUT cv::Mat* results=0 ) const;
- virtual void write( CvFileStorage* storage, const char* name ) const;
- virtual void read( CvFileStorage* storage, CvFileNode* node );
- protected:
- int var_count, var_all;
- CvMat* var_idx;
- CvMat* cls_labels;
- CvMat** count;
- CvMat** sum;
- CvMat** productsum;
- CvMat** avg;
- CvMat** inv_eigen_values;
- CvMat** cov_rotate_mats;
- CvMat* c;
- };
2.类的实现文件
<script src="https://code.csdn.net/snippets/376535.js" type="text/javascript"></script>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。