当前位置:网站首页>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 .
边栏推荐
- Qt实现界面滑动切换效果
- SSL证书续费相关问题详解
- 2022CoCa: Contrastive Captioners are Image-Text Fountion Models
- Summary and sorting of 8 pits of redis distributed lock
- Li Chi's work and life summary in June 2022
- .NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
- DeFi生态NFT流动性挖矿系统开发搭建
- 2014合肥市第三十一届青少年信息学奥林匹克竞赛(小学组)试题
- 2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
- BI技巧丨权限轴
猜你喜欢

PointNeXt:通过改进的模型训练和缩放策略审视PointNet++

Nebula Importer 数据导入实践

与二值化阈值处理相关的OpenCV函数、方法汇总,便于对比和拿来使用

Process of manually encrypt the mass-producing firmware and programming ESP devices

Bi skills - permission axis

“只跑一趟”,小区装维任务主动推荐探索
![[release] a tool for testing WebService and database connection - dbtest v1.0](/img/4e/4154fec22035725d6c7aecd3371b05.jpg)
[release] a tool for testing WebService and database connection - dbtest v1.0

LeetCode第300场周赛(20220703)

Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?

Don't just learn Oracle and MySQL!
随机推荐
Shell programming core technology II
Perfect JS event delegation
Pytorch学习(四)
神经网络物联网是什么意思通俗的解释
建立自己的网站(15)
prometheus安装
SSL证书续费相关问题详解
使用FTP
正则替换【JS,正则表达式】
Have you guys ever used CDC direct Mysql to Clickhouse
测试工程师如何“攻城”(上)
其他InterSystems %Net工具
性能优化之关键渲染路径
Shell 编程核心技术《四》
Wechat reading notes of "work, consumerism and the new poor"
Shell programming core technology "I"
Send and receive IBM WebSphere MQ messages
Other InterSystems%net tools
Unity adds a function case similar to editor extension to its script, the use of ContextMenu
请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗