函数上漆"was not declare in this scope"
Function inpaint "was not declare in this scope"
我试图在opencv中使用inpaint
函数,但我得到这个错误
loadimg.cpp: In function 'int main(int, char**)':
loadimg.cpp:19:28: error: 'INPAINT_TELEA' is not a member of 'cv'
loadimg.cpp:19:45: error: 'inpaint' was not declared in this scope
从输入:
C:UsersFrancescoDesktopprova>g++ -I"C:opencvbuildinclude"
-L"C:opencvbuildx86mingwlib" loadimg.cpp -lopencv_core245 -lopencv_highgui245
-lopencv_img proc245 -o loadimg
这是我的代码:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv/cv.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat src = cv::imread("prova.jpg");
Mat mask;
cvtColor(src, mask, CV_RGB2GRAY);
threshold(mask, mask, 220, 255, CV_THRESH_BINARY);
Mat dst;
inpaint(src, mask, dst, 1, cv::INPAINT_TELEA);
imshow("image", dst);
waitKey(0);
return 0;
}
有人能帮我吗?非常感谢。
cv::inpaint()
在photo
模块中声明。你需要#include <opencv2/photo/photo.hpp>
。或者,你可以选择#include <opencv2/opencv.hpp>
,它包含了所有OpenCV的功能。
try:
inpaint(src, mask, dst, 1, INPAINT_TELEA);
还包括:opencv2/photo/photo.hpp
相关文章:
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 类中的数组变量C++导致"was not declared in this scope"实现文件的一个函数中错误,但在构造函数中不会导致错误
- 如何解决"cout was not declared in this scope"错误?
- 为什么程序显示我"was not declared in this scope"?
- 为什么我会收到此警告? "Member 'x' was not initialized in this constructor"
- 即使包含 <time.h 后仍"‘CLOCK_PER_SEC’ was not declared in this scope"错误>
- С 错误"s1, s2 are used uninitialised in this function"
- "C4649: attributes are ignored in this context"的含义是什么?
- 我正在接受"Error: string was not declared in this scope"
- C++ 我一直在"was not declared in this scope error"
- 将 .ui 文件导入 Qt5 C++时出错"was not declared in this scope"
- 编译 CPP 应用程序时出错。 "error: 'posix_memalign' was not declared in this scope"
- main.cpp中的错误:函数库中的函数"not declared in this scope",但实际上是
- "Error: 'dungeon_t' was not declared in this scope"但包含在标题中
- "pointer was not declared in this scope"是什么意思
- "error: not declared in this scope?"是什么意思
- 宣布时的另一个'not declared in this scope'问题
- " 'X' not declared in this scope "错误
- 子类模板错误 (C++): "error: 'root' was not declared in this scope"
- Eclipse C++ Linux "to_string was not declared in this scope"