Opencv push_back function in Mat
I`m having serious problem.
class Set
{
Point_<int> point;
int val;
double *module;
};
Mat m;
Set s;
m.push_back(s);
It says see r开发者_StackOverfloweference to function template instantiation 'void cv::Mat::push_back(const _Tp &)' being compiled When i add after push_back it brings me: see reference to class template instantiation 'cv::Mat_<_Tp>' being compiled
Gotta admit that I'm not familiar with OpenCV, but reasoning from this documentation, push_back
member function of the Mat
class seems to be a template function and it needs to know the type of the object you are going to "push back". So possibly try this:
m.push_back<Set>(s);
If doesn't work, the last suggestion would be
Mat<Set> m;
Set s;
m.push_back(s);
You could write
#include<vector>
class Set
{
Point_<int> point;
int val;
double *module;
};
std::vector<Set> m;
Set s;
m.push_back(s);
I don't think you can push_back anything that is not OpenCV primitive types. Why not just use a STL container?
精彩评论