[英]Train svm with ORB descriptors?
Hi i've been trying to train a svm with features, but i don't understand what to do with the descriptors that are computed of the keypoints using ORB. 嗨,我一直在尝试训练带有功能的svm,但我不明白如何处理使用ORB计算关键点的描述符。 I know that svm needs a data matrix and a label matrix, but i don't know how can i pass the descriptors Mat to a valid format.
我知道svm需要一个数据矩阵和一个标签矩阵,但我不知道如何将描述符Mat传递给有效的格式。 I've read about the BoF (Bag of Words/Features) but i don't know how to use it.
我读过BoF(Bag of Words / Features),但我不知道如何使用它。 Thanks for any help.
谢谢你的帮助。
The code below allows me to get the descriptors of an image. 下面的代码允许我获取图像的描述符。 What's the next step?
下一步是什么?
std::vector<KeyPoint> kp;
Mat desc;
// Default parameters of ORB
int nfeatures = 128;
float scaleFactor = 1.2f;
int nlevels = 8;
int edgeThreshold = 15; // Changed default (31);
int firstLevel = 0;
int WTA_K = 2;
int scoreType = ORB::HARRIS_SCORE;
int patchSize = 31;
int fastThreshold = 20;
Ptr<ORB> myORB = ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, scoreType,
patchSize, fastThreshold);
myORB->detectAndCompute(src, Mat(), kp, desc);
features.push_back(desc);
I would highly recommend you to use python with OpenCV that will save you a lot of time. 我强烈建议你使用OpenCV的python,这将节省你很多时间。 In python, this will be just 10 lines of code.
在python中,这将只有10行代码。
You can refer to this link for ORB. 您可以参考ORB的此链接 。 And once you get features then you can use scikit-learn svm for training an SVM classifier.
一旦获得功能,您就可以使用scikit-learn svm来训练SVM分类器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.