1 | initial version |
the code you're trying with, is unfortunately from opencv's deprecated 2.x api (not even 3.2 !), a lot of things changed in the api:
SIFT was moved back to the main repository (patent expired) with 4.3, you would use that like:
#include "opencv2/features2d.hpp"
Ptr<Feature2D> sift = SIFT::create()
sift->detect(...)
also the ml api changed significantly:
#include "opencv2/ml.hpp"
Ptr<ml::SVM> svm = ml::SVM::create(); //no more params & ml namespace
svm->setKernel(ml::SVM::LINEAR); // setters for the params
svm->train(data, ml::ROW_SAMPLE, labels);
2 | No.2 Revision |
the code you're trying with, is unfortunately from opencv's deprecated 2.x api (not even 3.2 !), a lot of things changed in the api:since then:
SIFT was moved back to the main repository (patent expired) with 4.3, you would use that like:
#include "opencv2/features2d.hpp"
Ptr<Feature2D> sift = SIFT::create()
sift->detect(...)
also the ml api changed significantly:
#include "opencv2/ml.hpp"
Ptr<ml::SVM> svm = ml::SVM::create(); //no more params struct & ml namespace
svm->setKernel(ml::SVM::LINEAR); // setters for the params
svm->train(data, ml::ROW_SAMPLE, labels);
3 | No.3 Revision |
the code you're trying with, is unfortunately from opencv's deprecated 2.x api (not even 3.2 !), a lot of things changed since then:
SIFT was moved back to the main repository (patent expired) with 4.3, you would use that like:
#include "opencv2/features2d.hpp"
Ptr<Feature2D> sift = SIFT::create()
sift->detect(...)
also the ml api changed significantly:
#include "opencv2/ml.hpp"
Ptr<ml::SVM> svm = ml::SVM::create(); //no more params struct & ml namespace
svm->setKernel(ml::SVM::LINEAR); // setters for the params
svm->train(data, ml::ROW_SAMPLE, labels);
then, you need more / better data ! trying BoW with 40 images is ridiculous.
you'll probably also get better results using a cnn and transfer learning