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

标签 visual-c++ opencv

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

相关文章:

c++ - Compaq Visual Fortran 中对 DFOR.LIB 的引用

c++ - (内存地址)处的未处理异常 (msvcr110.dll)

c - 这是有效的标准 c 吗?

python - 从源码安装 Opencv 到 conda 环境

opencv - face_eyes检测和跟踪使用opencv

qt - 在 OpenCV 中使用 Haar 分类器进行键盘控制?

java - 使用 OpenCV 和 Java 从 gif 帧中获取 Mats

c++ - 为什么我的代码在 Windows 7 下无法在 "C:\Program Files"中创建目录?

java - 使用opencv 3.0 java裁剪检测到的人脸

java - 如何将键和鼠标事件发送到 Java 小程序?