Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV undefined reference CvSVM::predict, maybe it is a bug , please check it.

Hello, The code is from http://www.opencv.jp/sample/svm.html. I have tested the SVM in OpenCV 2.4.6.1, but there is an error as follow:

undefined reference to `CvSVM::predict(CvMat const*) const'
collect2: ld returned 1 exit status

and I have linked the project with libraries as follows:

-lopencv_core  -lopencv_imgproc  -lopencv_highgui -lopencv_legacy -lopencv_nonfree -lopencv_optim -lopencv_ml

Then, I replace the "#include <ml.h>" with "#include <ml.hpp>", there are more than 2000 errors, some are as follows:

/include/opencv2/core/cvdef.h:219: conflicting declaration 'typedef int64_t int64'
/include/cxtypes.h:145: 'int64' has a previous declaration as 'typedef long long int int64'
and so on

Then, I still use the "#include <ml.h>", and I comment the "svm.predict(&m)", then everything is OK!

Then, I change the line 71 "ret = svm.predict (&m);" into "ret = svm.predict (&m ,false);", and modify the ml.h, in line 492, I add one row, like this:

virtual float predict( const CvMat* _sample ) const;
virtual float predict( const CvMat* _sample, bool returnDFVal ) const;

Then, everything is OK!

I think the ml.h should add some more override functions, because I check the modules/ml/src/svm.cpp, there are no override function for "virtual float predict( const CvMat* _sample ) const;". Maybe this is the problem. Please Check it. Thanks.

OpenCV undefined reference CvSVM::predict, maybe it is a bug , please check it.

Hello, The code is from http://www.opencv.jp/sample/svm.html. I have tested the SVM in OpenCV 2.4.6.1, but there is an error as follow:

undefined reference to `CvSVM::predict(CvMat const*) const'
collect2: ld returned 1 exit status

and I have linked the project with libraries as follows:

-lopencv_core  -lopencv_imgproc  -lopencv_highgui -lopencv_legacy -lopencv_legacy
-lopencv_nonfree -lopencv_optim -lopencv_ml

Then, I replace the "#include <ml.h>" with "#include <ml.hpp>", there are more than 2000 errors, some are as follows:

/include/opencv2/core/cvdef.h:219: conflicting declaration 'typedef int64_t int64'
/include/cxtypes.h:145: 'int64' has a previous declaration as 'typedef long long int int64'
and so on

Then, I still use the "#include <ml.h>", and I comment the "svm.predict(&m)", then everything is OK!

Then, I change the line 71 "ret = svm.predict (&m);" into "ret = svm.predict (&m ,false);", and modify the ml.h, in line 492, I add one row, like this:

virtual float predict( const CvMat* _sample ) const;
virtual float predict( const CvMat* _sample, bool returnDFVal ) const;

Then, everything is OK!

I think the ml.h should add some more override functions, because I check the modules/ml/src/svm.cpp, there are no override function for "virtual float predict( const CvMat* _sample ) const;". Maybe this is the problem. Please Check it. Thanks.

OpenCV undefined reference CvSVM::predict, maybe it is a bug , please check it.

Hello, The code is from http://www.opencv.jp/sample/svm.html. I have tested the SVM in OpenCV 2.4.6.1, but there is an error as follow:

undefined reference to `CvSVM::predict(CvMat const*) const'
collect2: ld returned 1 exit status

and I have linked the project with libraries as follows:

-lopencv_core  -lopencv_imgproc  -lopencv_highgui -lopencv_legacy
-lopencv_nonfree -lopencv_optim -lopencv_ml

Then, I replace the "#include <ml.h>" with "#include <ml.hpp>", there are more than 2000 errors, some are as follows:

/include/opencv2/core/cvdef.h:219: conflicting declaration 'typedef int64_t int64'
/include/cxtypes.h:145: 'int64' has a previous declaration as 'typedef long long int int64'
and so on

Then, I still use the "#include <ml.h>", and I comment the "svm.predict(&m)", line 71 "ret = svm.predict(&m)", then everything is OK!

Then, I change the line 71 "ret = svm.predict (&m);" into "ret = svm.predict (&m ,false);", and modify the ml.h, in line 492, I add one row, like this:

virtual float predict( const CvMat* _sample ) const;
virtual float predict( const CvMat* _sample, bool returnDFVal ) const;

Then, everything is OK!

I think the ml.h should add some more override functions, because I check the modules/ml/src/svm.cpp, there are no override function for "virtual float predict( const CvMat* _sample ) const;". Maybe this is the problem. Please Check it. Thanks.