开发者

Opencv push_back function in Mat

开发者 https://www.devze.com 2023-04-06 05:52 出处:网络
I`m having serious problem. class Set { Point_<int> point; int val; double *module; }; Mat m; Set s;

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消