๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ› Research/OCR

[์˜คํ”ˆ ์†Œ์Šค] ๋ฌธ์„œ ์Šค์บ๋„ˆ / ๋ฌธ์„œ ์ •๋ฉด ๋ทฐ ๋ณ€ํ™˜ / ๋ฌธ์„œ ์ด๋ฏธ์ง€ Perspective Transformation

by ๋ญ…์ฆค 2022. 12. 15.
๋ฐ˜์‘ํ˜•

 

https://github.com/andrewdcampbell/OpenCV-Document-Scanner

 

GitHub - andrewdcampbell/OpenCV-Document-Scanner: An interactive document scanner built in Python using OpenCV featuring automat

An interactive document scanner built in Python using OpenCV featuring automatic corner detection, image sharpening, and color thresholding. - GitHub - andrewdcampbell/OpenCV-Document-Scanner: An i...

github.com

 

Document Scanner ?

 

๋ฌธ์„œ๋‚˜ ์ข…์ด ๋˜๋Š” ์ด๋ฏธ์ง€ ์ƒ์—์„œ ๊ฒฝ๊ณ„๊ฐ€ ํ™•์‹คํ•œ ๊ฐ์ฒด์˜ ์ปจํˆฌ์–ด๋ฅผ ์ฐพ์•„ ์ •๋ฉด ๋ทฐ๋กœ ๋ณ€ํ™˜ํ•ด์ฃผ๋Š” ์˜คํ”ˆ ์†Œ์Šค๋ฅผ ์†Œ๊ฐœํ•œ๋‹ค.

 

์ด๋ฏธ์ง€ ์ „์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด ๋ฌธ์„œ์˜ ์ปจํˆฌ์–ด๋ฅผ ์ฐพ๊ณ  perspective transformation(warping) ์„ ํ†ตํ•ด ๋ฌธ์„œ๋ฅผ ์ •๋ฉด ๋ทฐ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ํ”ํžˆ ์Šค๋งˆํŠธํฐ์œผ๋กœ ๋ฌธ์„œ๋ฅผ ์ดฌ์˜ํ•  ๋•Œ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋ฉฐ OCR ๊ณผ ๊ฐ™์€ ๋น„์ „ ๊ด€๋ จ ๊ฐœ๋ฐœ์„ ํ•˜๋‹ค๋ณด๋ฉด ์š”๊ธดํ•˜๊ฒŒ ์“ฐ์ผ ์ˆ˜ ์žˆ๋Š” ๊ธฐ์ˆ ์ด๋‹ค.

 

์•Œ๊ณ ๋ฆฌ์ฆ˜

  • ๋ณธ ๋ ˆํผ์ง€ํ† ๋ฆฌ์—์„œ๋Š” [๋ฌธ์„œ ์ด๋ฏธ์ง€ gray ์Šค์ผ€์ผ๋กœ ๋ณ€ํ™˜ → ๊ฐ€์šฐ์‹œ์•ˆ ๋ธ”๋Ÿฌ์™€ ๋ชจํด๋กœ์ง€ ์—ฐ์‚ฐ → canny edge detection → ๊ฐ€์žฅ ์ ์ ˆํ•œ ์ปจํˆฌ์–ด ํƒ์ƒ‰ → perspective transformation] ์˜ ๊ณผ์ •์„ ๊ฑฐ์นœ๋‹ค.
  • ๊ฐ€์šฐ์‹œ์•ˆ ๋ธ”๋Ÿฌ, ๋ชจํด๋กœ์ง€ ์—ฐ์‚ฐ, canny edge detector์˜ ํŒŒ๋ผ๋ฏธํ„ฐ ๋ณ€๊ฒฝ์„ ํ†ตํ•ด ํŠน์ • ํ™˜๊ฒฝ์— ์ ํ•ฉํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด ์žฅ์ 
๋ฐ˜์‘ํ˜•

 

Document Scanner ์ฝ”๋“œ ์‹คํ–‰ ์˜ˆ์‹œ

์˜ˆ์‹œ๋Š” ์ด๋ฏธ์ง€๋ฅผ gray ์Šค์ผ€์ผ๋กœ ๋ณ€ํ™˜ํ–ˆ์ง€๋งŒ, ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•ด์„œ ์›๋ณธ ์ƒ‰์ƒ์œผ๋กœ๋„ ๋ณ€ํ™˜ํ•  ์ˆ˜ ์žˆ๋‹ค.

๋ ˆํผ์ง€ํ† ๋ฆฌ ์˜ˆ์‹œ ์ด๋ฏธ์ง€
์ง์ ‘ ํ…Œ์ŠคํŠธํ•œ ๊ฒฐ๊ณผ

 

๋ฐ˜์‘ํ˜•