#include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #
include <opencv2/highgui/highgui_c.h> #include <iostream> #include <stdio.h> #
include <vector> using namespace cv; using namespace std; /** @function main */
int main(int argc, char** argv) { Mat src, src_gray; /// Load image src = imread(
“ Fill in the picture position here ”, 1 ); if( !src.data ) { return -1; } /// Convert to grayscale : cvtColor( src,
src_gray, CV_BGR2GRAY ); /// Perform Gaussian blur to reduce noise GaussianBlur( src_gray, src_gray, Size(9
, 9), 2, 2 ); vector<Vec3f> circles; /// Perform Hough circle transformation HoughCircles( src_gray, circles
, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 ); // src_gray: input image
( Grayscale image ) //circles: Store the following three parameters : x_{c}, y_{c}, r Collection to represent each detected circle . //
CV_HOUGH_GRADIENT: Specify detection method . Now? OpenCV There is only Hoff gradient method //dp = 1: Inverse resolution of accumulator image // min_dist =
src_gray.rows/8: Minimum distance between centers detected //param_1 = 200: Canny High threshold of edge function // param_2 = 100:
Center detection threshold . // min_radius = 0: Minimum detectable circle radius , The default is 0. // max_radius = 0: Maximum detectable circle radius , The default is 0
/// Draw the detected circle : for( size_t i = 0; i < circles.size(); i++ ) { Point center(cvRound
(circles[i][0]), cvRound(circles[i][1])); int radius = cvRound(circles[i][2]);
// circle center circle( src, center, 3, Scalar(0,255,0), -1, 8, 0 ); // circle
outline circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 ); } /// Show detected circles :
namedWindow( "Hough Circle Transform Demo", CV_WINDOW_AUTOSIZE ); imshow(
"Hough Circle Transform Demo", src ); waitKey(0); return 0; }

Technology
©2019-2020 Toolsou All rights reserved,
Dijkstra Algorithmic Python realization - Shortest path problem 415 Status code to background error ( Essence )2020 year 7 month 15 day Wechat applet template Use of Map---Java judge Map Contains a key Maximum security risk of cloud computing : Unclear safety responsibility Go language Array initialization and basic operations be based on RK3399 PWM Drive development ( Essence )2020 year 8 month 15 day redis database StackExchange.Redis in Set type (C# edition )el-select At the same time label and value value ( Essence 2020 year 6 month 2 Daily update ) TypeScript Function explanation