当前位置:网站首页>cv. Houghcircles: Circular Hough transform opencv
cv. Houghcircles: Circular Hough transform opencv
2022-06-11 03:03:00 【Solitary rest】
The basic principle :
For every point on the circumference , Find its gradient , According to the gradient, the tangent line about this point can be made , The direction perpendicular to the tangent is the gradient like direction , The intersection of the gradient direction of each point is the center of the circle , Then the radius can be determined according to the position of the center of the circle .
Straight line Hough change :
Images Hough Transformation _ A lonely blog -CSDN Blog
function :
circles=cv.HoughCircles(image, method, dp, minDist[, param1[, param2[, minRadius[, maxRadius]]]]])
image: Grayscale image
method: It's usually cv.HOUGH_GRADIENT
dp: Inverse ratio between accumulator resolution and image resolution , It's usually 1
minDist: The minimum distance between different center points , Too often some circles are omitted , Too small will produce many unrelated circles
param1: Pass to canny High threshold of edge detection operator , The low threshold is half of the high threshold
param2: It is the cumulative threshold of the circle center in the detection stage . The smaller the size, the more false circles can be detected . The larger the circle that can pass the test, the closer it is to the perfect circle .
minRadius: Minimum radius
maxRadius: Maximum radius example :
import cv2.cv2
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img1 = cv.imread(r'XXXXX.jpg')
img=img1.copy()
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
img = cv.medianBlur(img,5)
cimg = cv.cvtColor(img,cv.COLOR_GRAY2BGR)
circles = cv.HoughCircles(img,cv.HOUGH_GRADIENT,1,300,
param1=50,param2=30,minRadius=50,maxRadius=200)
circles = np.uint16(np.around(circles))
for i in circles[0,:]:
# A circle :
cv.circle(img1,(i[0],i[1]),i[2],(0,255,0),5)
# center of a circle :
cv.circle(img1,(i[0],i[1]),2,(0,0,255),5)
cv.imshow('detected circles',img1)
cv.waitKey(0)
cv.destroyAllWindows()

边栏推荐
- [big guy show] aiops in the eyes of Borui data, choosing the right track and the right people
- Error in Solr access: error initializing queryelevationcomponent
- Longest increasing subsequence
- [C language classic]: inverted string
- 深入解析问号表达式
- Android WiFi hide SSID
- 怎样确保消息的可靠性投递?
- 马志强:语音识别技术研究进展和应用落地分享丨RTC Dev Meetup
- 数据库唯一索引和普通索引的区别?
- The Google search console webmaster tool cannot read the sitemap?
猜你喜欢

The new colleague asked me what "where 1=1" means???

How to state clearly and concisely the product requirements?

Question bank and answers for 2022 melting welding and thermal cutting operation certificate examination

Explication du cours de graphacademy: neo4j Graph Data Science Foundation

重磅直播!ORB-SLAM3系列之特征匹配(MLPnP、词袋模型等)。

Why did those who left Beijing, Shanghai and Guangzhou with a smile cry in the end?

2022年6月中国数据库排行榜:TiDB卷土重来摘桂冠,达梦蛰伏五月夺探花

Graphacademy course explanation: Fundamentals of neo4j graph data science

Error in Solr access: error initializing queryelevationcomponent

RS232/RS485转4G DTU 上传基于Modbus协议的温湿度传感器数据到远程TCP服务器
随机推荐
AOSP ~ logcat chatty line expired
AOSP ~ WiFi on by default + GPS off by default + Bluetooth off by default + rotary screen off
【大咖秀】博睿数据眼中的AIOps,选择正确的赛道正确的人
CPT 102_ LEC 13-14
How to fix syntax errors in WordPress websites
反射三种方式
Ora-00392 ora-00312 error handling
Will your company choose to develop data center?
判断一串数字是否是快速排序某一次的结果
The new colleague asked me what "where 1=1" means???
数据库唯一索引和普通索引的区别?
Determine whether a string of numbers is the result of a quick sort
Rs232/rs485 to 4G DTU uploading temperature and humidity sensor data based on Modbus protocol to remote TCP server
WinDbg-虚拟机-双机调试-驱动文件的调试
The two request sessionids of the same user are inconsistent ----- record the problem
Unity项目优化详解(持续补充ing)
Construction of Flink development environment and wordcount
[C language classic]: inverted string
Win10 安装Office 2016出现错误代码30204-44怎么处理?
Graphacademy course explanation: Fundamentals of neo4j graph data science