简体   繁体   English

不完整类型“cv :: Mat”opencv c ++

[英]Incomplete type “cv::Mat” opencv c++

I want to create a matrice in opencv for my project of raytracing. 我想在opencv中为我的光线追踪项目创建一个矩阵。 This is the code I have come up: 这是我提出的代码:

#include "Windows.h"
#include "core/mat.hpp"
#include "core/core.hpp"
#include "core/types_c.h"

using namespace cv;

Mat createImage()
{
     Mat b(480, 640, CV_8UC3);
     return b;
}

And I have problem with the two Mat. 而我对两个Mat有问题。 It says variable has incomplete type "cv::Mat" . 它说variable has incomplete type "cv::Mat" I can't understand what it means. 我无法理解这意味着什么。 I always wrote only Mat nothing else. 我总是只写Mat没有别的。

Can someone help me please? 有人能帮助我吗?

Just include "opencv2/core/core.hpp" . 只需包含“opencv2 / core / core.hpp”
You can use below example code. 您可以使用下面的示例代码。

#include "opencv2/core/core.hpp"
using namespace cv;   

Mat createImage()
{
 Mat b(480, 640, CV_8UC3);
 return b;
}

int main()
{
   createImage();
}

You only need to '#include "core/core.hpp"` 你只需要'#include'core / core.hpp“`

The compiler needs to be able to find the include files, do you have Opencv/Include in the compiler's include directory list? 编译器需要能够找到包含文件,在编译器的include目录列表中是否有Opencv/Include Did it give any error about finding core.hpp? 找到core.hpp有什么错误吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM