๋ฐ˜์‘ํ˜•

๋น„์ „ ๊ฒ€์‚ฌ ์žฅ๋น„ ํšŒ์‚ฌ๋Š” ๋น„์ „ ๊ฒ€์‚ฌ๋ฅผ ์œ„ํ•ด์„œ ๋น„์ „ ์•Œ๊ณ ๋ฆฌ์ฆ˜(ํ˜น์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ)์„ ๋ณด์œ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฒ€์‚ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ง์ ‘ ๊ฐœ๋ฐœํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ํšŒ์‚ฌ๋„ ์žˆ๊ณ , ์ƒ์šฉ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๊ตฌ์ž…ํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ํšŒ์‚ฌ๋„ ์žˆ์Šต๋‹ˆ๋‹ค.


๋จธ์‹  ๋น„์ „ ์‚ฐ์—…์—์„œ ์ฃผ์š” ๋น„์ „ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ๋Š” ๋‹ค์Œ์˜ ์ œํ’ˆ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

โ‘  MVTec Halcon

โ‘ก Cognex Vision Pro

โ‘ข Euresys Open eVision

โ‘ฃ Matrox MIL


์œ„์—์„œ ์–ธ๊ธ‰ํ•œ ์ฃผ์š” 4๊ฐœ ์ œํ’ˆ๋“ค์€ ๋ชจ๋‘ ์œ ๋ฃŒ์ž…๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ ์œ ๋ฃŒ์ธ ๋งŒํผ ์„ฑ๋Šฅ ๋ฐ ๊ธฐ์ˆ ์ง€์›์„ ์›ํ™œํžˆ ๋ฐ›์„ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋น ๋ฅธ ๊ฐœ๋ฐœ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.


๋ฐ˜๋ฉด์— OpenCV๋Š” Computer Vision ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ค‘ ํ•˜๋‚˜๋กœ, ์˜คํ”ˆ ์†Œ์Šค ํ˜•ํƒœ๋กœ์„œ ๋ˆ„๊ตฌ๋“ ์ง€ ์ž์œ ๋กญ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฒŒ๋‹ค๊ฐ€ ์ผ๋ถ€ ์ƒ์šฉ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•˜์ง€ ์•Š๋Š”, USB / GigE ์นด๋ฉ”๋ผ๋ฅผ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ์ธํ„ฐํŽ˜์ด์Šค๋„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.


์†Œ๊ฐœ๋Š” ์—ฌ๊ธฐ๊นŒ์ง€ ํ•˜๊ณ , Visual Studio 2015์—์„œ OpenCV 4.0.1์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•์„ ๋ณด์—ฌ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.


๋‹ค์šด๋กœ๋“œ

OpenCV ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.

๋งํฌ : OpenCV ํ™ˆํŽ˜์ด์ง€

2019๋…„ 3์›” 3์ผ ๊ธฐ์ค€, 4.0.1์ด ์ตœ์‹  ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.


์ €๋Š” ์œˆ๋„์šฐ์—์„œ ์ง„ํ–‰ํ•  ์˜ˆ์ •์ด๋ฏ€๋กœ, 'Win pack'์„ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ฒ ์Šต๋‹ˆ๋‹ค.

โ€ป ๋งŒ์•ฝ, ์œ„ OpenCV ํ™ˆํŽ˜์ด์ง€์—์„œ ๋‹ค์šด๋กœ๋“œ๊ฐ€ ์•ˆ๋˜์‹œ๋Š” ๊ฒฝ์šฐ github์—์„œ ๋™์ผํ•˜๊ฒŒ ๋‹ค์šด๋กœ๋“œ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๋งํฌ : OpenCV Github

Visual Studio 2015์—์„œ ์ž‘์—…ํ•  ๊ฒƒ์ด๋ฏ€๋กœ opencv-4.0.1-vc14_vc15.exe๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์Šต๋‹ˆ๋‹ค.


์„ค์น˜

๋‹ค์šด๋กœ๋“œ ๋ฐ›์€ ํŒŒ์ผ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด ํ‘œ์‹œ๋˜๋ฉด ์••์ถ• ํ•ด์ œ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.


์••์ถ• ํ•ด์ œ๊ฐ€ ๋ชจ๋‘ ์ง„ํ–‰๋˜๋ฉด ์ž๋™์œผ๋กœ ์ฐฝ์ด ์‚ฌ๋ผ์ง‘๋‹ˆ๋‹ค.


์••์ถ•์ด ๋ชจ๋‘ ํ•ด์ œ๋˜๋ฉด 'opencv'ํด๋”๊ฐ€ ์žˆ์œผ๋ฉฐ, ๋‚ด๋ถ€์—๋Š” ๋‹ค์Œ์˜ ํŒŒ์ผ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

'build' ํด๋” ๋‚ด์—๋Š” ๋‹ค์Œ์˜ ํŒŒ์ผ๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

x86 ๋˜๋Š” ๊ทธ ์™ธ์˜ ๊ฐœ๋ฐœํ™˜๊ฒฝ(vc14, vc15์™ธ ๋ฒ„์ „)์—์„œ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ์—๋Š” CMake๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ถ”๊ฐ€ ๋นŒ๋“œํ•˜์—ฌ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

โ€ป ์ด ๋‚ด์šฉ์€ ์ถ”ํ›„ ์ž์„ธํžˆ ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


์ด์ œ 'opencv' ํด๋”๋ฅผ 'C:\opencv'๋กœ ์˜ฎ๊ฒจ ๋†“๊ฒ ์Šต๋‹ˆ๋‹ค.

Visual Studio 2015 & OpenCV ํ™˜๊ฒฝ ๊ตฌ์„ฑ

์ด์ œ Visual Studio 2015๋ฅผ ์‹คํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

MFC (Dialog base) x64 ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.


ํ”„๋กœ์ ํŠธ์˜ ์†์„ฑ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.


'Configuration Properties > C/C++ > General > Additional Include Directories'์— 'opncv > include' ํด๋” ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.


'Configuration Properties > Linker > General > Additional Library Directories'์— 'opencv > x64 > vc14 > lib' ํด๋” ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.


'Configuration Properties > Debugging > Environment'์— 'PATH=C:\opencv\build\x64\vc14\bin;%PATH%'๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.


์ด์ œ ํ”„๋กœ์ ํŠธ์˜ ์„ค์ •์€ ๋ชจ๋‘ ์™„๋ฃŒ๋์Šต๋‹ˆ๋‹ค.

์ฝ”๋“œ์—์„œ๋Š” ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š”์ง€ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

Main Dialog ๋˜๋Š” OpenCV ์‚ฌ์šฉ์„ ์œ„ํ•œ ํด๋ž˜์Šค์˜ Header์— ์•„๋ž˜์˜ ์ฝ”๋“œ๋ฅผ ์‚ฝ์ž…ํ•ฉ๋‹ˆ๋‹ค.

'opencv_world401d.lib' ํŒŒ์ผ์„ 'Configuration Properties > Linker > Input > Additional Dependencies'์— ์ถ”๊ฐ€ํ•ด๋„ ๋˜์ง€๋งŒ,

์ €๋Š” ์ฝ”๋“œ๋กœ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.


์ด์ œ ์‹คํ–‰ํ•ด ๋ณผ๊นŒ์š”?

์•„๋ž˜ ๊ทธ๋ฆผ์€ Debug Mode์—์„œ์˜ ์‹คํ–‰ ํ™”๋ฉด ์ž…๋‹ˆ๋‹ค.

์ •์ƒ์ ์œผ๋กœ ์ž˜ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ, ํ”„๋กœ๊ทธ๋žจ์ด ์ข…๋ฃŒ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜ ํ˜„์ƒ์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.


์ด๋Ÿฌํ•œ ํ˜„์ƒ์€ 'False Memory Leak'์ด๋ผ๊ณ  ํ•˜๋Š”๋ฐ,

Visual Studio๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด์„œ OpenCV dll ๋‚ด๋ถ€์˜ ๋ฉ”๋ชจ๋ฆฌ ํ•ด์ œ ๋™์ž‘์ด ์‹คํ–‰๋˜์ง€ ์•Š์•„ Compiler์—์„œ ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๊ฐ€ ๊ฐ์ง€๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.


ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์กฐ์น˜ํ•ฉ๋‹ˆ๋‹ค.

'Configuration Properties > Linker > Input > Delay Loaded Dlls'์— ์‚ฌ์šฉ๋˜๋Š” dllํŒŒ์ผ ์ด๋ฆ„์„ ๋ชจ๋‘ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.


์œ„์™€ ๊ฐ™์ด ์กฐ์น˜ํ•˜๊ณ  ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ํ›„ ๋‹ค์‹œ ์ข…๋ฃŒํ•˜๋ฉด, ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๊ฐ€ ๊ฐ์ง€๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.


์—ฌ๊ธฐ๊นŒ์ง€ Visual Studio 2015์—์„œ OpenCV 4.0.1์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ๊ณผ์ •์„ ๋ณด์—ฌ๋“œ๋ ธ์Šต๋‹ˆ๋‹ค.

์ถ”ํ›„์—๋Š” OpenCV๋ฅผ ํ™œ์šฉํ•œ ์˜ˆ์ œ๋“ค์„ ์†Œ๊ฐœํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋ฐ˜์‘ํ˜•