OpenCV霍夫圆检测原理
来源:互联网 发布:网易公开课 知乎 编辑:程序博客网 时间:2024/05/22 16:55
Here I’ll tell you how to detect circles (which are quite important in computer vision application) using a technique similar to the standard Hough transform. This article assumes you know how the Hough transform works, or you’ve understood the previous articles in this series (The Hough Transform).
The parameterization
A circle can be described completely with three pieces of information: the center (a, b) and the radius. (The center consists of two parts, hence a total of three)
x = a + Rcosθ
y = b + Rsinθ
When the θ varies from 0 to 360, a complete circle of radius R is generated.
So with the Circle Hough Transform, we expect to find triplets of (x, y, R) that are highly probably circles in the image. That is, we want to find three parameters. Thus, the parameter space is 3D… meaning things can get ugly if you don’t tread slowly. Out of memory errors are common even if your programming language uses virtual memory.
So we’ll start simple.
Assuming R is known
To begin, we’ll start with the assumption that you’re looking for circles of a particular radius, that is, R is known. The equation of each circle is:
x = a + Rcosθ
y = b + Rsinθ
So, every point in the xy space will be equivalent to a circle in the ab space (R isn’t a parameter, we already know it). This is because on rearranging the equations, we get:
a = x1 – Rcosθ
b = y1 – Rsinθ
for a particular point (x1, y1). And θ sweeps from 0 to 360 degrees.
So, the flow of events is something like this:
Load an image
Detect edges and generate a binary image
For every ‘edge’ pixel, generate a circle in the ab space
For every point on the circle in the ab space, cast ‘votes’ in the accumulator cells
The cells with greater number of votes are the centers
When R is not known
When the radius is not known, the simplest solution is to just guess. Assume R = 1, and then run the same algorithm. Then assume R = 2, and run it again. Assume R = 3…. and so on.
Whats the upper limit of R? A safe limit would be the length of the diagonal of the image. No possible circle on the image can have a radius greater than or equal to the diagonal.
The parameterization
A circle can be described completely with three pieces of information: the center (a, b) and the radius. (The center consists of two parts, hence a total of three)
x = a + Rcosθ
y = b + Rsinθ
When the θ varies from 0 to 360, a complete circle of radius R is generated.
So with the Circle Hough Transform, we expect to find triplets of (x, y, R) that are highly probably circles in the image. That is, we want to find three parameters. Thus, the parameter space is 3D… meaning things can get ugly if you don’t tread slowly. Out of memory errors are common even if your programming language uses virtual memory.
So we’ll start simple.
Assuming R is known
To begin, we’ll start with the assumption that you’re looking for circles of a particular radius, that is, R is known. The equation of each circle is:
x = a + Rcosθ
y = b + Rsinθ
So, every point in the xy space will be equivalent to a circle in the ab space (R isn’t a parameter, we already know it). This is because on rearranging the equations, we get:
a = x1 – Rcosθ
b = y1 – Rsinθ
for a particular point (x1, y1). And θ sweeps from 0 to 360 degrees.
So, the flow of events is something like this:
Load an image
Detect edges and generate a binary image
For every ‘edge’ pixel, generate a circle in the ab space
For every point on the circle in the ab space, cast ‘votes’ in the accumulator cells
The cells with greater number of votes are the centers
When R is not known
When the radius is not known, the simplest solution is to just guess. Assume R = 1, and then run the same algorithm. Then assume R = 2, and run it again. Assume R = 3…. and so on.
Whats the upper limit of R? A safe limit would be the length of the diagonal of the image. No possible circle on the image can have a radius greater than or equal to the diagonal.
0 0
- OpenCV霍夫圆检测原理
- opencv 霍夫圆检测
- OpenCV之边缘检测原理及代码
- 简单OPENCV人脸检测识别原理
- OPENCV直方图计算原理及反向投影检测原理
- OPENCV直方图计算原理及反向投影检测原理
- 主题:人脸检测原理及示例(OpenCV+Python)
- 基于opencv人脸检测原理及实现
- 基于opencv人脸检测原理及实现
- OpenCV: Canny边缘检测算法原理及其VC实现详解
- 基于opencv人脸检测原理及实现
- 【原理】Opencv HOG行人检测 源码分析(一)
- OpenCV中SURF特征点检测原理与实现
- Harris角点检测原理及openCV实现
- OpenCV: Canny边缘检测算法原理及其VC实现详解
- OpenCV: Canny边缘检测算法原理及其VC实现详解
- opencv之SURF算法原理及关键点检测
- Harris角点检测原理与opencv(python)实现
- Elasticsearch5.0 安装问题集锦
- Html5 新特性
- @Column
- css--清风徐来之选择器区别和选择器声明
- 对linux内核中jiffies、Hz的理解
- OpenCV霍夫圆检测原理
- http://www.myexception.cn/mysql/2040843.html
- eclipse创建maven模块
- 1242ap开启SSH
- setTimeout和setInterval方法找不到方法问题的解决方法(转载)
- Java 通过dbcp管理数据库
- 如何解决XML5619: 文档语法不正确
- unity3d 随机位置 随机时间生成一个敌人
- Android L 沉浸式状态栏和圆形动画实现炫酷效果