错误:使用OpenCV时垫子模棱两可 [英] Error: Mat is ambiguous when using OpenCV
问题描述
我在C ++中还很陌生,我正在尝试使用OpenCV提供的某些库.问题是,当我将代码放在下面时,它说:
I am pretty new in c++ and i am trying to use some of the libraries OpenCV is offering. The problem is that when i put the code below it says:
Error: Mat is ambiguous
,我在其他帖子中已经读过,这意味着编译器无法选择要选择的函数,但这也正是OpenCV教程中调用它的方式. http://docs.opencv.org/doc/tutorials/introduction/display_image /display_image.html
, which i have read in other posts that means that the compiler cannot pick which function to choose, but this is exactly how it was called in the OpenCV tutorial too. http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html
Mat A;
到目前为止,我编写的代码位于.h
文件中:
The code i have written till now is in the .h
file:
#pragma once
#include <E:\opencv\build\include\opencv2/highgui/highgui.hpp>
#include <E:\opencv\build\include\opencv2/core/core.hpp>
using namespace cv;
class Face_Detection
{
public:
Face_Detection();
~Face_Detection();
};
int main(){
cv::Mat image;
//A = imread(argv[1], CV_LOAD_IMAGE_COLOR);
return 1;
}
推荐答案
您可以包括其他也定义了Mat
类型的库/文件.尝试使用,即通过显式添加其命名空间cv
,
You may include other lib/file that also defines a Mat
type. Try to use, i.e. by explicitly add its namespace cv
,
cv::Mat A;
反而避免歧义.
您包含OpenCV头文件的方式使我感到您没有正确使用OpenCV.尝试首先按照以下文章正确设置OpenCV,包括include/library/...
.
The way you included OpenCV header files make me feel you didn't use OpenCV properly. Try to first follow the following post to setup OpenCV correctly, including include/library/...
.
这篇关于错误:使用OpenCV时垫子模棱两可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!