1

我正在尝试inpaint在 opencv 中使用该函数,但出现此错误

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:\Users\Francesco\Desktop\prova>g++ -I"C:\opencv\build\include" 
 -L"C:\opencv\build\x86\mingw\lib" 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;
}

谁能帮我?非常感谢。

4

2 回答 2

3

cv::inpaint()photo模块中声明。你需要#include <opencv2/photo/photo.hpp>。或者,您也可以#include <opencv2/opencv.hpp>,其中包含 OpenCV 的所有功能。

于 2013-05-10T15:18:30.203 回答
1

尝试:

inpaint(src, mask, dst, 1, INPAINT_TELEA);

另外,包括:opencv2/photo/photo.hpp

于 2013-05-10T15:17:52.020 回答