opencv_角点检测

文章内容

  1. 一个opencv检测角点的程序
运行效果

opencv_角点检测_第1张图片

#include 
#include 
#include 
#include 

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,opencv)