错误 C2679:二进制'=':未找到采用类型 'IplImage *' 的右侧操作数的运算符(或没有可接受的转换) OpenCV

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'IplImage *' (or there is no acceptable conversion) OpenCV

本文关键字:运算符 操作数 可接受 OpenCV 转换 IplImage 二进制 C2679 错误 类型      更新时间:2023-10-16

嗨,我正在尝试使用这段代码级联分类器。我在标题上弄错了。我使用的是VS 2013和OpenCV 3.0。

我是新来的,我不明白为什么这个代码适用于除我之外的所有人?修复它的方法是什么?

此处错误行:

frame = cvQueryFrame(capture);

cvQueryFrame返回一个IplImage*,而您的frame的类型是Mat

你有两个选择:

1) 从IplImage*转换为Mat

frame = Mat(cvQueryFrame(capture));

2) 使用C++语法,使用VideoCapture(推荐

VideoCapture cap(0);
...
for(;;)
{
    Mat frame;
    cap >> frame;
    ...
}
相关文章: