使用OpenCV的边缘检测
代码如下:
#include "infer.h"
using namespace cv;
using namespace std;
int main::getResult(string fileName)
{
Mat src = imread(fileName);
Mat dst;
cvtColor(src, src, COLOR_BGR2GRAY);
blur(src, src, Size(3, 3));
Canny(src, dst, 3, 9, 3);
imshow(src);
return 0;
}
![img](https://i-blog.csdnimg.cn/blog_migrate/d25ef5f59a84fbe80d2b4812b8ae6ac1.png)
![img](https://i-blog.csdnimg.cn/blog_migrate/b7fac3a71ee8ba831a8b5ebaaa25da20.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/3b436b074c983bae77e4d21e6b96d814.png)