C++์—์„œ ์‹œ์ž‘ํ•ด๋ณด๋Š” OpenCV

๋ฐ˜์‘ํ˜•



What is OpenCV?

OpenCV๋Š” Open Computer Vision์˜ ์•ฝ์ž๋กœ, ์‹ค์‹œ๊ฐ„ ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌ์— ์ค‘์ ์„ ๋‘” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋ฉฐ, C, C++, Python ์–ธ์–ด์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ณธ๋ž˜๋Š” Intel์ด ์ฃผ๋„์ ์œผ๋กœ ๊ฐœ๋ฐœํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์˜€์œผ๋‚˜ ํ˜„์žฌ๋Š” Intel์ด ์ „ํ˜€ ๊ด€์—ฌํ•˜์ง€ ์•Š๊ณ  ์žˆ๊ณ , Open Source Library์ž…๋‹ˆ๋‹ค.


๋ณธ๋ž˜ ์ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๋ชฉ์ ์€ ๊ธฐ๊ณ„์˜ ์‹œ๊ฐ์— ํ•ด๋‹นํ•˜๋Š” ๋ถ€๋ถ„์„ ์—ฐ๊ตฌํ•˜๋Š” ๊ฒƒ์ด ๋ชฉ์ ์ด์—ˆ๊ณ , ํ˜„์žฌ๋Š” ๋จธ์‹  ๋Ÿฌ๋‹์—์„œ์˜ ์ด๋ฏธ์ง€ ์ธ์‹, ์ด๋ฏธ์ง€ ๊ฒ€์ƒ‰ ๋“ฑ์— ์ด์šฉ๋˜๊ณ  ์žˆ์œผ๋ฉฐ ์ด ์™ธ์— CCTV์—์„œ ๋ฒ”์ฃ„์ž๋ฅผ ์บ์น˜ํ•˜๊ฑฐ๋‚˜ ์ด์ƒ ํ–‰๋™ ์š”๋ น์„ ๊ฐ์‹œํ•˜๊ณ  ์žˆ๋Š” ์ „๋ฌธ ๋ถ„์•ผ ๋“ฑ์—์„œ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค.



How to use OpenCV?

OpenCV๋Š” Python, C, C++์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Python ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, C/C++ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ œ๊ณตํ•˜๋ฉฐ ์•„๋ž˜์˜ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด OpenCV ํ™ˆํŽ˜์ด์ง€์—์„œ OS๋ณ„๋กœ ์ œ๊ณต๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ง€์›ํ•˜๋Š” OS๋Š” OS X, Linux, Windows, iOS, Android๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.


Go to OpenCV site


์ตœ๊ทผ OpenCV๋Š” NVIDIA CUDA๋ฅผ ์ง€์›ํ•˜์—ฌ GPU๋ฅผ ์‚ฌ์šฉํ•œ ์ด๋ฏธ์ง€/์˜์ƒ์ฒ˜๋ฆฌ๋„ ๊ฐ€๋Šฅํ•ด์กŒ์Šต๋‹ˆ๋‹ค.


OpenCV for Github


OpenCV๋Š” Github์— ๋ฌด๋ฃŒ๋กœ ๊ณต๊ฐœ ๋˜์–ด ์žˆ์–ด ์ž์‹ ์ด ์ฒ˜๋ฆฌํ•˜๊ณ ์ž ํ•˜๋Š” ์ฝ”๋“œ ์ž‘์„ฑ ํ›„, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์—ฌ๋Ÿฌ๋ถ„๋“ค์ด ์ง์ ‘ ์ด๋ฅผ ์ˆ˜์ •ํ•˜๊ณ , ๊ธฐ์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.



C++ for OpenCV / OpenCV Version

์ €๋Š” OpenCV๋ฅผ C++ ์–ธ์–ด๋กœ ์‹œ์ž‘ํ•˜์˜€๊ณ , ์ด ๋ธ”๋กœ๊ทธ์—๋„ C++์™€ ๊ด€๋ จ๋˜์–ด ๋ธ”๋กœ๊ทธ ํฌ์ŠคํŠธ๋กœ ๋‚จ๊ธฐ๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค. (์ถ”ํ›„ Python์„ ์‚ฌ์šฉํ•ด Tensorflow์— ์ ์šฉํ•˜๊ฒŒ ๋˜๋ฉด, ๋˜ ํฌ์ŠคํŒ… ํ•  ์ˆ˜๋„ ์žˆ๊ฒ ์ง€๋งŒ, ์ผ๋‹จ ์ง€๊ธˆ์€..) 


OpenCV ๋ฒ„์ „์€ 2.x ๋ฒ„์ „๊ณผ 3.x ๋ฒ„์ „์œผ๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค. (๊ณต๊ต๋กญ๊ฒŒ๋„ ๋‘ ๋ฒ„์ „ ๋™์‹œ์— ์‚ฌ์šฉ์ด ์•ˆ ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค..)

Linux์˜ ๊ฒฝ์šฐ ์ตœ์‹  ๋ฒ„์ „์˜ OpenCV์ธ 3.1.x ๋ฒ„์ „์„ ๊ถŒ์žฅํ•˜๊ณ , GPU๊ฐ€ ์žˆ๋‹ค๋ฉด, ํ•ด๋‹น GPU์— ๋งž์ถฐ, ๋“œ๋ผ์ด๋ฒ„์™€ CUDA๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. CMake๋ฅผ ์ด์šฉํ•ด ๋นŒ๋“œํ•ด์„œ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Windows๋Š” ์ž˜ ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ, ์•„๋งˆ ๋˜‘๊ฐ™์ด CMake๋ฅผ ์‚ฌ์šฉํ•  ๊ฒƒ์ด๊ณ , GPU๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋“ฏํ–ˆ์Šต๋‹ˆ๋‹ค.


OpenCV 2.4๋ฒ„์ „์€ OpenCV ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ๊ฐ€์žฅ ์•ˆ์ •์ ์ธ ๋ฒ„์ „์œผ๋กœ ์•Œ๋ ค์ ธ ์žˆ์œผ๋ฉฐ ์ถ”์ฒœํ•˜๋Š” ๋ฒ„์ „์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ €๋Š” Ubuntu ๋ฒ„์ „๊ณผ ํŠน์„ฑ์ƒ 3.1 ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ณ , ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์ถ”ํ›„์— Ubuntu ๊ฒŒ์‹œํŒ์— ์˜ฌ๋ฆด ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.


OpenCV 2 ๋ฒ„์ „, 3 ๋ฒ„์ „ ๋ชจ๋‘ C++๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ OpenCV๋ฅผ ๋งŒ์•ฝ ์ฒ˜์Œ ์‚ฌ์šฉํ•ด๋ณด์‹œ๋ ค๋Š” ๊ฐœ๋ฐœ์ž๋ผ๋ฉด, C++์— ๋Œ€ํ•œ ์ง€์‹๊ณผ ๊ฐœ๋…์ด ์ถฉ๋ถ„ํžˆ ๊ฐ–์ถฐ์ง„ ํ›„ ์‚ฌ์šฉํ•ด๋ณด๊ธฐ๋ฅผ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. ์ ์–ด๋„ STL์€ ์ถฉ๋ถ„ํžˆ ๋–ผ์—ฌํ•˜์ง€ ์•Š์„๊นŒ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.



ํฌ์ŠคํŒ…๊ณผ ํ–ฅํ›„..

OpenCV๋Š” ํ˜„์žฌ ์ œ๊ฐ€ ํ•™๋ถ€์—์„œ ๋ฐฐ์šฐ๊ณ  ์žˆ๋Š” ๊ฒƒ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. ์˜ˆ์ „์—๋„ ์ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์“ฐ๋ ค๊ณ  ์‹œ๋„ํ–‡์—ˆ์ง€๋งŒ ๋งค์šฐ ์–ด๋ ค์šด ํƒ“, ๊ทธ๋ฆฌ๊ณ  ๊ฐœ๋ฐœํ•˜๋Š” ๋ฐ ๊ฐ€์žฅ ๋ฌธ์ œ๊ฐ€ ์ปธ์—ˆ๋˜ ๊ฒƒ์€ ๋ฐ”๋กœ ์˜์ƒ์— ๋Œ€ํ•œ ๊ธฐ๋ณธ ์ง€์‹ ๋ถ€์กฑ์ด ๋ฌธ์ œ์˜€์Šต๋‹ˆ๋‹ค. (์‚ฌ์‹ค ์ง€๊ธˆ๋„ ๊ทธ๋Ÿฌํ•ฉ๋‹ˆ๋‹ค... ใ… ใ… )


๊ฐœ๋…๊ณผ ๋”๋ถˆ์–ด ๋‚˜์ค‘์— ํ•„์ž์ธ ์ œ๊ฐ€ ๋ดค์„ ๋•Œ๋„ ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋„๋ก ์ž‘์„ฑํ•  ์˜ˆ์ •์ด๋ฉฐ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•, ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‹ค๋ฃจ๋Š” ๋ฐฉ๋ฒ• ๋“ฑ์„ ๊ฐ„๋žตํ•˜๊ฒŒ๋‚˜๋งˆ ํฌ์ŠคํŒ… ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋ฐ˜์‘ํ˜•
TAGS.

Tistory Comments