Im试图在向量中查找并计算重复的cv :: Points2f。为此,我尝试使用以下功能。但是当我尝试使用取消引用的值rv[*val]++
时,我得到一个错误。在cv的向量中计数重复项:: Points2f
std::map<cv::Point2f, unsigned int> counter(const std::vector<Point2f>& vals)
{
std::map<Point2f, unsigned int> rv;
for (auto val = vals.begin(); val != vals.end(); ++val) {
rv[*val]++;
}
return rv;
}
当时我想HABE与键列表中选择一个容器结束(不重复的),有多少次发现他们每个人在原来的载体。
例如以下矢量
vector<Point2f> v{Point2f(2,2),Point2f(3,3),Point2f(1,2),Point2f(2,2),Point2f(3,3)};
我想获得与该信息的容器: (1,2)1; (2,2)2; (3,3)2
编辑:
只是为了澄清我得到不同的注意事项和错误为:
/usr/include/c++/5/bits/stl_function.h:387:20: error: no match for ‘operator<’ (operand types are ‘const cv::Point_<float>’ and ‘const cv::Point_<float>’)
{ return __x < __y; }
/usr/local/include/opencv2/core/cvstd.hpp:1031:20: note: no known conversion for argument 1 from ‘const cv::Point_<float>’ to ‘const cv::String&’
非常感谢你提前!
什么是“*错误*”? –