Created Date : 2007.7
Language : C++
Tool : Visual C++ 6.0
Library & Utilized : OpenCV 1.0(for image saving)
Reference : Hough Transform reference
etc. : -
This is Hough Transform program.
We can progress two type Hough Transform. One is Line Hough Transform, Second is Circle Hough Transform.
After processing, Hough Transform result, Edge Image and Parameter Space(txt) files save in your directory.
You can download source code
<here>.
If you have good idea or advanced opinion, please reply me. Thank you
(Please understand my bad english ability. If you point out my mistake, I would correct pleasurably. Thank you!!)
-------------------------------------------------------------------------------
▣ ํํ๋ณํ ํ๋ก๊ทธ๋จ ๊ฒฐ๊ณผ
<์คํ 1>
1. ์
๋ ฅ ๋ฐ์ดํฐ
2. ์์ง ์์
3. Line ๊ฒ์ถ ๊ฒฐ๊ณผ
4. Parameter Space voting ์์
▣ ์์ค ์ฝ๋ ์ค๋ช
1. Line ๊ฒ์ถ
①voting ๋ถ๋ถ
theta๋ฅผ 0~180๊น์ง ์ฆ๊ฐ์ํค๋ฉด์ rho๋ฅผ ๊ตฌํ๊ณ ๊ทธ ๊ฐ์ [theta][rho]์ 2์ฐจ์ ๋ฐฐ์ด์ Votingํ๋ค.
②Sorting ๋ถ๋ถ
voting๋ Parameter๋ฅผ ์ ๋ ฌํ๋ค. ์ ๋ ฌ์ STL์ ์ฌ์ฉํจ.
③Line ๊ทธ๋ฆฌ๋ ๋ถ๋ถ
์ ๋ ฌ๋ theta์ rho๊ฐ์ ์ด์ฉํ์ฌ ์ง์ ์ ๋ฐฉ์ ์์ ๊ธฐ์ธ๊ธฐ์ ์ ํธ์ ๊ตฌํ๊ณ OpenCV์ Line Drawํจ์๋ฅผ ์ด์ฉํ์ฌ ๋ผ์ธ์ ๊ทธ๋ฆฐ๋ค. ๊ทธ๋ ค์ง ๋ผ์ธ์ OpenCV์ IplImage์ ์ ์ฅ๋๋ค.
๋ผ์ธ์ ๊ทธ๋ฆด ๋๋ voting์ด ๊ฐ์ฅ ๋ง์ด ๋ ๊ฒ์ ์ ์์ 255, ๊ฐ์ฅ voting์ด ์๋ ๊ฒ์ ์ ์์ 0์ผ๋ก, Voting๋ ๊ฒ์ ์ ๋๋ฅผ ์์ผ๋ก ๋ํ๋ด์๋ค.
2. Circle ๊ฒ์ถ
①voting ๋ถ๋ถ
๋ฐ์ง๋ฆ์ <10>์์ <์ด๋ฏธ์ง ๋๊ฐ๋ฐฉํฅ์ ํฝ์
๊ธธ์ด ๋นผ๊ธฐ 10>๊น์ง ์ฆ๊ฐ์ํค๋ฉด์ theta๋ฅผ 0~360๊น์ง ์ฆ๊ฐ์ํค๋ฉฐ, ์์ ์ค์ฌ ์์น Cx, Cy์ ๋ํ์ฌ voting์ ํ๋ค. voting๋ ๊ฒฐ๊ณผ๋
๋ฅผ ๋ด์ ์ ์๋ Vector์ ์ ์ฅ๋๋ค.
②Sorting ๋ถ๋ถ
์ ์ ๋ณด๋ฅผ ๊ฐ๊ณ ์๋ Vector์์ Voring ๊ฐ์ผ๋ก ์ ๋ ฌ์ ํ๋ค.
③Circle ๊ทธ๋ฆฌ๋ ๋ถ๋ถ
์ ๋ ฌ๋ ์์ค์์ ์์ 1%๋ง ๋๋ก์ํ๋ค.
๋๋ก์ํ ๋๋ ๋ผ์ธ์ ๊ทธ๋ฆด๋์ ๋ง์ฐฌ๊ฐ์ง๋ก ์ ์ผ ๋ง์ด voting๋ ๊ฒ์ 255์, ์ ์ผ ์ ๊ฒ voting๋๊ฒ์ 0์์ผ๋ก ๊ทธ๋ ค์ voting์ ๋๋ฅผ ํ์ํ๋ค.
▣ ์ธํฐํ์ด์ค ์ค๋ช
์คํ ํ์ผ์ ์คํํ์ฌ ํ์ผ๋ช
์ ์
๋ ฅํ๊ณ , Line์ ๊ฒ์ถํ๋ ค๋ฉด 1์ ์
๋ ฅ Circle์ ๊ฒ์ถํ๋ ค๋ฉด 2๋ฅผ ์
๋ ฅํ๋ค.
๊ฒ์ถ์ด ๋๋๋ฉด ์คํ ์๊ฐ์ด ๋์จ๋ค.
์ ์ฒด ์์๋ ์ฌ๊ธฐ์ ๋ค์ด ๋ฐ์ ์ ์์ต๋๋ค.
<here>
์ข์ ์๊ฒฌ ์ด๋ค ๊ธ์ด๋ ๋ต๋ณ ๋จ๊ฒจ์ฃผ์ธ์
๊ฐ์ฌํฉ๋๋ค.