如何使用Rect_构造函数中的contains()函数检查矩形中是否包含给定点...请给我确切的函数及其参数。就像当我输入这个
Point b(2,2);
Rect a(10,10,50,50);
cout<< Rect_::contains(b);
There is a compile error saying 1>c:\users\kaushal\documents\visual studio 2008\projects\test1\test1.cpp(23) : error C2352: 'cv::Rect_<_Tp>::contains' : illegal call of non-static member function
1>c:\opencv2.1\include\opencv\cxcore.hpp(385) : see declaration of 'cv::Rect_<_Tp>::contains'
最佳答案
您想要使用a
实例来定义区域来运行确定a
包含b
的方法。 contains
方法不是静态的,因此您不能在Rect类上调用它。
Point b(2,2);
Rect a(10,10,50,50);
cout<< Rect_::contains(b); // error here - contains is not static so can't be called on class
cout<< a.contains(b); // this is what you want - use instance with knowledge of rect
关于visual-c++ - Visual c++ OpenCV 2.1 contains(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2991705/