文章内容文章来源:https://www.toymoban.com/news/detail-799332.html
- 一个opencv检测角点的程序
运行效果
文章来源地址https://www.toymoban.com/news/detail-799332.html
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
void detectCorners(Mat image)
{
Mat grayImage;
cvtColor(image, grayImage, COLOR_BGR2GRAY);
vector<Point2f> corners;
goodFeaturesToTrack(grayImage, corners, 100, 0.01, 10);
for (int i = 0; i < corners.size(); i++)
{
circle(image, corners[i], 5, Scalar(0, 0, 255), -1);
}
imshow("Corner Detection", image);
waitKey(0);
}
int main()
{
Mat image = imread("E:\\SOFT_SL\\Opencv_Check\\biaoding.png");
if (image.empty())
{
cout << "Failed to load image" << endl;
return -1;
}
detectCorners(image);
return 0;
}
到了这里,关于opencv_角点检测的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!