visual-c++ - Visual c++ OpenCV 2.1 contains()

如何使用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

https://stackoverflow.com/questions/2991705/

相关文章:

visual-c++ - 使用卷积方法处理35 x 35内核

user-interface - 在Win32应用程序中使用opencv进行图像显示

visual-c++ - cxcore210d.dll丢失

opencv - 模拟相机的进纸

docker - TeamCity 构建代理 : Error registering on the

opencv - 相机和投影仪校准

visual-studio-2008 - CBlobResult令人费解。使用Visual C++2

image - OpenCV模板匹配

visual-studio-2008 - OpenCV图像从RGB转换为HSV阈值难题

docker - 创建 Docker 自己的 node_modules