当前位置:网站首页>Hough transform Hough transform principle
Hough transform Hough transform principle
2022-07-04 19:30:00 【a little cabbage】
Hough Transform Hough transform
principle
In Cartesian coordinates , A straight line consists of two A=(x1, y1) and B=(x1, y2) determine , Here's the picture :
Put a straight line y=kx + b Can be written about (k, q) Function expression for :
The corresponding transformation is visually represented by graphics, as shown in the following figure :
The transformed space is called Hough space . namely : A straight line in Cartesian coordinate system , Corresponding to a point in Hough space . In turn, , The same holds true , A line in Hough space , Corresponds to a point in the Cartesian coordinate system , As shown in the figure below :
Let's see A、B Two points , Corresponding to the case of Hough space :
A Mapping to Hough space is a straight line ,B It also maps to a line in Hough space , These two lines have an intersection in Hough space . This intersection represents the Cartesian coordinate system by A、B The slope and intercept of the straight line formed by two points .
Let's take another look at the collinearity of three points , Here's the picture :
It can be seen that , If the points of the Cartesian coordinate system are collinear , Then the lines corresponding to these points in Hough space intersect at a point .
If there is more than one straight line , As shown in the figure below :
We choose as many straight lines as possible to form points , The three straight lines in the above figure converge into A、B At two o 'clock , Corresponding it back to the straight line in the Descartes coordinate system, as shown in the following figure :
Come here , We seem to have solved the Hough transform , But if it's like the picture below :
Above picture , The slope of a straight line does not exist . To solve this problem , We consider converting Cartesian coordinates to polar coordinates .
It's the same in polar coordinates , Points in polar coordinates correspond to lines in Hough space , This is the Hough space parameter, which is no longer (k, q) 了 , It is (ρ, θ) Space ,ρ Is the vertical distance from the origin to the line ,θ Represents the angle between the vertical line and the horizontal axis in the clockwise direction , The angle of the vertical line is 0 degree , The angle of the horizontal line is 180 degree .
We just need to find the location of the intersection in Hough space , The straight line in the original coordinate system can be obtained .
Implementation process
Suppose there is a size of 100x100 Pictures of the , Use Hough transform to detect the straight line in the picture , The steps are as follows :
Straight lines can be used (ρ, θ) Express , First create a 2D Array , We can call it accumulator , Initialize ownership to 0, Row representation ρ, Column means θ.
The size of the array determines the accuracy of the results , If you want the accuracy of the angle to be 1 degree , It needs to 180 Column . about ρ, The maximum value is the diagonal distance of the picture , If you want the accuracy to reach the pixel level , The number of lines should be equal to the diagonal distance of the image .Take the first point of the contour edge of the binary graph (x, y), Bring it into the polar coordinate formula of the straight line , Then traverse θ The value of :0,1,2,…,180, Find the corresponding ρ value , If this value has a corresponding position in the above accumulator , Then add 1.
Take the first point of the contour edge of the binary graph (x, y), Repeat the above steps , Update accumulator .
Search for the maximum value in the accumulator , And find the corresponding (ρ,θ), The straight lines in the image can be represented .
边栏推荐
- 2021 Hefei informatics competition primary school group
- 整理混乱的头文件,我用include what you use
- “只跑一趟”,小区装维任务主动推荐探索
- [uniapp] uniapp development app online Preview PDF file
- 2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
- 一文掌握数仓中auto analyze的使用
- Shell programming core technology "three"
- 国元期货是正规平台吗?在国元期货开户安全吗?
- Shell 编程核心技术《一》
- Is the securities account opened by qiniu safe?
猜你喜欢
FPGA时序约束分享01_四大步骤简述
Oracle with as ORA-00903: invalid table name 多表报错
物联网应用技术的就业前景和现状
PointNeXt:通过改进的模型训练和缩放策略审视PointNet++
小发猫物联网平台搭建与应用模型
Bi skills - permission axis
Lex and yacc based lexical analyzer + parser
Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
Don't just learn Oracle and MySQL!
node_exporter部署
随机推荐
与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用
To sort out messy header files, I use include what you use
模板_判断素数_开方 / 六素数法
在线文本行固定长度填充工具
2022养生展,健康展,北京大健康展,健康产业展11月举办
Shell 编程核心技术《三》
Shell 編程核心技術《四》
2022-07-04: what is the output of the following go language code? A:true; B:false; C: Compilation error. package main import 'fmt' func
《看完就懂系列》字符串截取方法substr() 、 slice() 和 substring()之间的区别和用法
Lm10 cosine wave homeopathic grid strategy
redis分布式锁的8大坑总结梳理
建立自己的网站(15)
YOLOv5s-ShuffleNetV2
Shell 编程核心技术《四》
测试工程师如何“攻城”(上)
Shell programming core technology "I"
IBM WebSphere MQ检索邮件
The latest progress of Intel Integrated Optoelectronics Research promotes the progress of CO packaging optics and optical interconnection technology
Perfect JS event delegation
Rookie post station management system based on C language