Tutorial: Create OpenCV Project

Prepare Project Workspace

Create the lecture workspace as C:\Users\yourID\source\repos\DLIP

  • e.g. C:\Users\ykkim\source\repos\DLIP

Then, create sub-directories as :

  • C:\Users\yourID\source\repos\DLIP\Tutorial

  • C:\Users\yourID\source\repos\DLIP\Include

Save Property Sheet

Copy or move the OpenCV setup property sheets you have created in the Include folder.

  • C:\Users\yourID\source\repos\DLIP\Include

Property Sheets

  • opencv-4.9.0_debug_x64.props

  • opencv-4.9.0_release_x64.props

If you don't have property sheets, then follow the instruction:

OpenCV Install and Setup

Create a New Project in VS

Create a new C++ project in Visual Studio Community

  • ์ƒˆ ํ”„๋กœ์ ํŠธ ๋งŒ๋“ค๊ธฐ > ๋นˆ ํ”„๋กœ์ ํŠธ(C++)

Project Name and Location

  • Project Name: DLIP_OpenCV_Simple_Demo

  • Project Folder: ~\DLIP\Tutorial\

Setup of Project Property

Include the already created OpenCV property sheets

(Debug x64)

  • VS ๋ฉ”๋‰ด๋ฐ”: ๋ณด๊ธฐ>๋‹ค๋ฅธ ์ฐฝ>์†์„ฑ ๊ด€๋ฆฌ์ž ์„ ํƒ

  • ์†์„ฑ ๊ด€๋ฆฌ์ž ํƒญ: ํ”„๋กœ์ ํŠธ๋ช… > Debugx64 RightClick.

  • ๊ธฐ์กด ์†์„ฑ ์‹œํŠธ ์ถ”๊ฐ€ ์„ ํƒ ํ›„ ์ €์žฅ๋œ " opencv-4.9.0_debug_x64.props " ์ถ”๊ฐ€

    • It should be located in "~\DLIP\Include\"

(Release x64)

  • ์†์„ฑ ๊ด€๋ฆฌ์ž ํƒญ: ํ”„๋กœ์ ํŠธ๋ช… > Releasex64 RightClick.

  • ๊ธฐ์กด ์†์„ฑ ์‹œํŠธ ์ถ”๊ฐ€ ์„ ํƒ ํ›„ ์ €์žฅ๋œ " opencv-4.9.0_release_x64.props " ์ถ”๊ฐ€

Create Demo Program

Create a new C+ source file

  • File Name: DLIP_OpenCV_Simple_Demo.cpp

  • ์†”๋ฃจ์…˜ํƒ์ƒ‰๊ธฐ ํƒญ: [ํ”„๋กœ์ ํŠธ] > ์†Œ์Šค ํŒŒ์ผ > ์ถ”๊ฐ€ > ์ƒˆํ•ญ๋ชฉ > C++ํŒŒ์ผ(cpp) ์„ ํƒ

๊ตฌ์„ฑ ๊ด€๋ฆฌ์ž๋ฅผ Debug x64๋กœ ์„ค์ •

Run the following demo program. You can run the program by pressing (CTRL+F5)

Demo 1: Image File Read

  • ์ด๋ฏธ์ง€ ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ: Click here

์ด๋ฏธ์ง€ ํŒŒ์ผ๊ณผ ์†Œ์Šค์ฝ”๋“œ๊ฐ€ ๋™์ผ ํด๋”์— ์žˆ์–ด์•ผ ํ•จ!!

Expected Output


Demo 2: Video Cam capture

Expected Output

Last updated

Was this helpful?