当前位置:网站首页>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 .
边栏推荐
- 自由小兵儿
- [uniapp] uniapp development app online Preview PDF file
- 请教一下 flinksql中 除了数据统计结果是状态被保存 数据本身也是状态吗
- Learning path PHP -- phpstudy "hosts file does not exist or is blocked from opening" when creating the project
- 2022CoCa: Contrastive Captioners are Image-Text Fountion Models
- 发送和接收IBM WebSphere MQ消息
- 小发猫物联网平台搭建与应用模型
- IBM WebSphere MQ retrieving messages
- 国元期货是正规平台吗?在国元期货开户安全吗?
- 反射(一)
猜你喜欢
Lm10 cosine wave homeopathic grid strategy
Summary and sorting of 8 pits of redis distributed lock
Hough Transform 霍夫变换原理
Don't just learn Oracle and MySQL!
Oracle with as ora-00903: invalid table name multi report error
Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?
神经网络物联网应用技术就业前景【欢迎补充】
性能优化之关键渲染路径
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
神经网络物联网是什么意思通俗的解释
随机推荐
升级智能开关,“零火版”、“单火”接线方式差异有多大?
生成XML元素
[release] a tool for testing WebService and database connection - dbtest v1.0
Rookie post station management system based on C language
《看完就懂系列》字符串截取方法substr() 、 slice() 和 substring()之间的区别和用法
The CDC of sqlserver can read the data for the first time, but it can't read the data after adding, deleting and modifying. What's the reason
如何使用Async-Awati异步任务处理代替BackgroundWorker?
PointNeXt:通过改进的模型训练和缩放策略审视PointNet++
Is the securities account opened by qiniu safe?
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
Using SSH
2022健康展,北京健博会,中国健康展,大健康展11月13日
prometheus安装
1672. 最富有客户的资产总量
Safer, smarter and more refined, Chang'an Lumin Wanmei Hongguang Mini EV?
Lex and yacc based lexical analyzer + parser
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
A method of using tree LSTM reinforcement learning for connection sequence selection
物联网应用技术的就业前景和现状
Guys, for help, I use MySQL CDC 2.2.1 (Flink 1.14.5) to write Kafka and set