vs2019里面使用ximgproc.hpp的thinning函数提示找不到指定文件但是以来包里明明可以找到这个头文件,编写代码的时候也没有提示错误,就是没有颜色。
然后opencv_contrib包之前也下载编译了呀
#include<opencv2/opencv.hpp>
#include<opencv2/ximgproc.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main() {
Mat img = imread("LearnCV_black.png", IMREAD_ANYCOLOR);
if (img.empty()) {
cout << "请输入正确的图像名称" << endl;
return -1;
}
Mat words = Mat::zeros(100, 200, CV_8UC1);
putText(words, "Learn", Point(30, 30), 2, 1, Scalar(255), 2);
putText(words, "OpenCV 4", Point(30, 60), 2, 1, Scalar(255), 2);
circle(words, Point(80, 75), 10, Scalar(255), -1);
circle(words, Point(130, 75), 10, Scalar(255), 3);
Mat thin1, thin2;
ximgproc::thinning(img, thin1, ximgproc::THINNING_ZHANGSUEN);
ximgproc::thinning(words, thin2, ximgproc::THINNING_ZHANGSUEN);
imshow("thin1", thin1);
imshow("img", img);
namedWindow("thin2", WINDOW_NORMAL);
imshow("thin2", thin2);
namedWindow("words", WINDOW_NORMAL);
imshow("words", words);
waitKey(0);
return 0;
}
这段代码的作用就是将图片中的文字进行细化操作
题主怎么解决的
错误2