[OpenCV3.4.3] SVM使用教程

// 参考资料:(建议先阅读此处)
// http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html#introductiontosvms
// https://docs.opencv.org/3.4/d1/d73/tutorial_introduction_to_svm.html
// http://blog.sina.com.cn/s/blog_662c7859010105za.html
// https://blog.csdn.net/xingkongfenqi/article/details/49794567
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/ml.hpp>

int main()
{
    
    // 给训练数据打上标签,对应1类和-1类
    int Labels[4] = {
     1, -1, -1, -1 };
    cv::Mat LabelsMat(4, 1, CV_32SC1, Labels);  // CV_32SC1: 32位有符号单通道矩阵

    // 设置训练数据的坐标,注意要和前面的Labels对应起来
    float TrainingData[4][2] = {
     {
    501., 10.}, {
    255., 10.}, {
    501., 255.}, {
    10., 501.} };
    cv::Mat TrainingDataMat
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值