zoukankan      html  css  js  c++  java
  • (23)霍夫圆

    知识点看这个博客:

    https://blog.csdn.net/qq_41167777/article/details/84940109

    ===========================

     1 #include <opencv2/opencv.hpp>
     2 #include <iostream>
     3 using namespace std;
     4 using namespace cv;
     5 
     6 Mat src, dst, gray_src;
     7 const char* input_win = "input";
     8 const char* out_put = "hough-line-detection";
     9 
    10 int main(int agrc, char** agrv) {
    11 
    12     src = imread("C:\Users\32829\Desktop\aa.jpg");
    13     if (!src.data) {
    14         printf("no load..
    ");
    15         return -1;
    16     }
    17     namedWindow(input_win, CV_WINDOW_AUTOSIZE);
    18     namedWindow(out_put, CV_WINDOW_AUTOSIZE);
    19     imshow(input_win, src);
    20 
    21     Mat moutput;
    22     medianBlur(src, moutput, 3);
    23     cvtColor(moutput, moutput, CV_BGR2GRAY);
    24 
    25     //霍夫圆检测
    26     vector<Vec3f> pcircles;
    27     HoughCircles(moutput, pcircles, CV_HOUGH_GRADIENT, 1, 10, 100, 30, 5, 100);
    28     src.copyTo(dst);
    29     for (size_t i = 0; i < pcircles.size(); i++) {
    30         Vec3f cc = pcircles[i];
    31         circle(dst, Point(cc[0], cc[1]), cc[2], Scalar(0, 255, 255), 2, LINE_AA);
    32         circle(dst, Point(cc[0], cc[1]), 2, Scalar(98, 23, 255), 2, LINE_AA);
    33     }
    34     imshow(out_put, dst);
    35     waitKey(0);
    36     return 0;
    37 }

    =================================

  • 相关阅读:
    foreach和each
    one
    存储
    动态添加
    百度描点
    php环境配置
    图文并茂
    css实现鼠标移上去变大,旋转,转别人的额
    vagrant box打包前的准备
    VirtualBox压缩打包
  • 原文地址:https://www.cnblogs.com/xiaoyoucai/p/10196329.html
Copyright © 2011-2022 走看看