Ask Your Question

Revision history [back]

'ml' : is not a class or namespace name

Hi I am using opencv 2.4.13 and I built it in vs2008. Now I want to load a random tree model with .yml extension (saved by python) using c++. I tried the following code:

#include <opencv2/ml.hpp>
#include "opencv2/legacy/legacy.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
    Ptr<ml::RTrees> rf = ml::StatModel::load<ml::RTrees>("rf.yml");
    return 0;
}

I got the following errors : main.cpp(10) : error C2653: 'ml' : is not a class or namespace name 1>.\main.cpp(10) : error C2065: 'RTrees' : undeclared identifier 1>.\main.cpp(10) : error C2653: 'ml' : is not a class or namespace name 1>.\main.cpp(10) : error C2065: 'load' : undeclared identifier 1>.\main.cpp(10) : error C2653: 'ml' : is not a class or namespace name 1>.\main.cpp(10) : error C2065: 'RTrees' : undeclared identifier

I am newbie in opencv. Please help me to correct the above errors.

'ml' : is not a class or namespace name

Hi I am using opencv 2.4.13 and I built it in vs2008. Now I want to load a random tree model with .yml extension (saved by python) using c++. I tried the following code:

#include <opencv2/ml.hpp>
#include "opencv2/legacy/legacy.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
    Ptr<ml::RTrees> rf = ml::StatModel::load<ml::RTrees>("rf.yml");
    return 0;
}

I got the following errors : :

main.cpp(10) : error C2653: 'ml' : is not a class or namespace name
1>.\main.cpp(10) : error C2065: 'RTrees' : undeclared identifier
1>.\main.cpp(10) : error C2653: 'ml' : is not a class or namespace name
1>.\main.cpp(10) : error C2065: 'load' : undeclared identifier
1>.\main.cpp(10) : error C2653: 'ml' : is not a class or namespace name
1>.\main.cpp(10) : error C2065: 'RTrees' : undeclared identifier

identifier

I am newbie in opencv. Please help me to correct the above errors.