Check the Desktop development with C++ in the install options. You may want to take 15 minutes to try the Hello World C++ tutorial:

Similar documents
APPLICATION NOTE. Getting Started with pylon and OpenCV

C++ - OpenGL - Setting up Visual Studio

Lab: Supplying Inputs to Programs

Lab 1: First Steps in C++ - Eclipse

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

Scientific Visualization A Programming Guide using Fltk and Visual Studio

CMPT 300. Operating Systems. Brief Intro to UNIX and C

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

OpenCV introduction. Mašinska vizija, 2017.

Compiling MapleSim C-Code in Visual C Express

Win8 on Intel Programming Course Desktop : Perceptual Computing Cédric Andreolli

WRITING CONSOLE APPLICATIONS IN C

TREX Set-Up Guide: Creating a TREX Executable File for Windows

EDEM Dynamics Coupling Quick Start Guide

Introduction to MS Visual C/C++

1) Log on to the computer using your PU net ID and password.

Opening Microsoft Visual Studio. On Microsoft Windows Vista and XP to open the visual studio do the following:

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

Eclipse Environment Setup

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #1: A Simple C Program Due Monday, 1/29/18, 11:59:59 PM

Configuring Visual Studio 2017 with SFML Game Engine

Image Processing (1) Basic Concepts and Introduction of OpenCV

MS Visual Studio.Net 2008 Tutorial

Document Revision No.: 1 Revised: 03/12/09 RIT KGCOE MSD Program. P09027 Upper Extremity Motion Capture System. Software Manual

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

UNic Eclipse Mini Tutorial (Updated 06/09/2012) Prepared by Harald Gjermundrod

GUI and API Application Note

First Steps with Visual FlagShip 8 for MS-Windows

Getting Started with Visual Studio

Laboratory 1 Semester 1 11/12

Installing and Using Dev-C++

The NAO Robot, a case of study Robotics Franchi Alessio Mauro

5.4.8 Optional Lab: Managing System Files with Built-in Utilities in Windows Vista

IMSL C Numerical Library

Lab 1: Introduction to C Programming. (Creating a program using the Microsoft developer Studio, Compiling and Linking)

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

Assembly Language Lab # 1

Visual C++ Tutorial. For Introduction to Programming with C++ By Y. Daniel Liang

First C or C++ Lab Paycheck-V1.0 Using Microsoft Visual Studio

CS 210 November 3, 2016 Notes on Separately Compile Programs

Writing a Client Application for Genesis II Contributors: Chris Sosa Last Modified: 06/05/2007

Software Development With Emacs: The Edit-Compile-Debug Cycle

Download, Install and Setup the Linux Development Workload Create a New Linux Project Configure a Linux Project Configure a Linux CMake Project

Saleae Device SDK Starting a Device SDK Project on Windows Starting a Device SDK Project on Linux... 7

COMP s1 Lecture 1

Using Eclipse for Java. Using Eclipse for Java 1 / 1

IMPLEMENTATION OF COMPUTER VISION TECHNIQUES USING OPENCV

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems

Engr 123 Spring 2018 Notes on Visual Studio

IRIS 3D Face Recognition

Lab-1: Profiling/Optimizing Video Decoder Using ADS. National Chiao Tung University Chun-Jen Tsai 3/3/2011

CS520 Setting Up the Programming Environment for Windows Suresh Kalathur. For Windows users, download the Java8 SDK as shown below.

RVDS 4.0 Introductory Tutorial

Tutorial on text transformation with pure::variants

Setting up a compiler

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Guide for getting started with SystemC development

Module 3: Working with C/C++

Lab 8. Follow along with your TA as they demo GDB. Make sure you understand all of the commands, how and when to use them.

Introduction to Computation and Problem Solving

We first learn one useful option of gcc. Copy the following C source file to your

APPENDIX A. CODE COMPOSER STUDIO (CCS) v5: A BRIEF TUTORIAL FOR THE DSK6713

Windows 2000 Safe Mode

Code Composer Studio Operation Manual

We assume that the user has basic knowledge of C# and is able to create a new C# project.

Required Setup for 32-bit Applications

1. In Outlook click on the blue (2013) or yellow (2010) File tab in the top left corner of the window. 2. Click on + Add Account

- It computes the Standard Deviation by calculating the difference of each channel (R,G,B and A) of a pixel.

Instructions. First, download the file

OOSIML SIMULATION MODELS. On Windows and Linux

Click on the Start Icon. Click on All Programs

Problem Set 1: Unix Commands 1

Laboratory Assignment #4 Debugging in Eclipse CDT 1

OpenCV. Basics. Department of Electrical Engineering and Computer Science

Install Visual Studio Community Version 2017

Unit 10. Linux Operating System

Multimedia Retrieval Exercise Course 2 Basic Knowledge about Images in OpenCV

Command Line Navigation and Compiling

Building AMD64 Applications with the Microsoft Platform SDK. Developer Application Note

5.4.8 Lab: Managing System Files with Built-in Utilities in Windows XP

Experiment 6 Finite Impulse Response Digital Filter (FIR).

Qt Essentials - Fundamentals of Qt Module

Programming the DMCC in C

RVDS 3.0 Introductory Tutorial

Configuring Ubuntu to Code for the OmniFlash or OmniEP

Lab 3-2: Exploring the Heap

AN 834: Developing for the Intel HLS Compiler with an IDE

Laboratory Assignment #3 Eclipse CDT

Conventions in this tutorial

CSE 351. GDB Introduction

Read Me First! Start Here. Read Me First! Start Here.

Compute Cluster Server Lab 2: Carrying out Jobs under Microsoft Compute Cluster Server 2003

GLUT Tutorial. John Tsiombikas (Nuclear / The Lab Demos) May 6, Introduction to GLUT (OpenGL Utility Toolkit)

1. Navigate to in a browser.

Assignment 1 - Use OpenCV for camera calibration

MnCHOICES Assessment 1.0 and Windows 10 troubleshooting

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 14

CS 392/681 Lab 6 Experiencing Buffer Overflows and Format String Vulnerabilities

Transcription:

CS262 Computer Vision OpenCV 3 Configuration with Visual Studio 2017 Prof. John Magee Clark University Install Visual Studio 2017 Community Check the Desktop development with C++ in the install options. You may want to take 15 minutes to try the Hello World C++ tutorial: https://tutorials.visualstudio.com/cpp-console/intro or look it over as the install happens. 1) Start Visual Studio. You can sign in with your Clark account information. It will ask you to fill out some information you can skip the optional Visual Studio Team Service Site. 2) Note that C++ compiler may not be installed with default options. You may be able to select it with the advanced install. 3) The first time you open Visual Studio, you can set the default configuration for General Use.

4) Go to File New Project and select Visual C++. You should see the options below, starting with Windows Console Application. Download and Extract OpenCV 3 Download from http://www.opencv.org Run the self-extracting executable. Select where you would like to store the library. On my computer, I extracted the library to c:\opencv\ You should see the build and sources subdirectories there: Set Environment Variables You can set environment variables two ways. One way is the System control panel. Open the System control panel, then select Advanced system settings. Then press the button for Environment Variables

The top User Variables for will set for only the current user of the computer. If you are the only user of your computer, you can use this. If you want to set it for all users, use the bottom System Variables. Alternative to the System control panel, you can use setx command from the command prompt. setx OPENCV_DIR c:\opencv\build\x64\vc15 1) Add OPENCV_DIR variable Set a new environment variable named OPENCV_DIR with the value being the complete path to OpenCV s build\x64\vc15 directory. For example: 2) Edit the PATH environment variable. Append the path to the OPENCV_DIR\bin directory You may be able to use the environment variable above: %OPENCV_DIR%\bin Or just enter a full path: C:\opencv\build\x64\vc15\bin Using setx: setx path C:\opencv\build\x64\vc15\bin;%path% Press OK and to exit out of the Environment Variables window.

Test the Path and Environment Variables 1) Open a new command prompt. (Press the Windows Key and then type cmd). If a command prompt is already open, you will need to exit and open a new one to refresh the environment variables. 2) Type opencv_version a. If this outputs 3.4.3, the path is set properly. b. If this outputs an error message, your path variable is not properly set. 3) Type cd %OPENCV_DIR% a. You should current working directory should now be the location of the OpenCV s build\x64\vc15 directory. b. If you type dir, the directory listing should have a bin and lib subdirectories. Configure Visual Studio Start Visual Studio. If it was already open, you may need to exit and restart for the environment variables to take effect. Creating a New Project: Create a new project (File New Project ) Select Visual C++ Windows Console Application Type a name for the project (Default ConsoleApplication1 is ok for testing) Select a location this is where the project will be stored. Be careful on lab computers, the default location is on the C: drive Press OK. Configure the Project: 1) Select Build Configuration Manager 2) For each project, Under Platform, select x64 3) For Active Solution Platform, select x64

Configuring the Library There are two ways to configure the library: On a per-project basis. The settings would need to be configured for every project. To configure the project, make sure the current project is selected in the Solution Explorer (top-right sub-window) select: Project Properties Alternatively: right-click on the project and select Properties Make sure Configuration says Active(Debug) and Platform says Active(x64). On a per-user basis. [This seems to have changed in Visual Studio 2017. There s probably still a way to do this, but it s not clear how.] There are four settings that have to be made in either case: 1. Tell the compiler where the include (.hpp) files are located 2. Tell the linker where the library (.lib) files are located 3. Tell the linker what library (.lib) files to link 4. Tell the debugger the path to the bin folder (to find the.dll files)

1) Select C/C++ a. Set Additional Include Directories: %OPENCV_DIR%\..\..\include 2) Select Linker a. Set Additional Library Directories: %OPENCV_DIR%\lib

3) Select Linker Input a. Edit the Additional Dependencies to add opencv_world343d.lib Note: If you are using a different version of OpenCV than 3.4.3, check your lib directory for the appropriate name. The d at the end means debug version. 4) Select VC++ Directories a. Edit the Executable Directories to add %OPENCV_DIR%\bin

Your First OpenCV Program Edit the.cpp file, replacing the existing starter code with the following: #include "pch.h" // remove this if not using precompiled headers #include <opencv2/opencv.hpp> //Include file for every supported OpenCV function int main(int argc, char** argv) { cv::mat img = cv::imread(argv[1], -1); if (img.empty()) return -1; cv::namedwindow("example1", cv::window_autosize); cv::imshow("example1", img); cv::waitkey(0); cv::destroywindow("example1"); return 0; } This code reads an image and displays it. Then exits when a key is pressed. Find a small image on the internet or your computer. Copy the image into the project s directory (the same folder as your.cpp file). On my computer, this directory was projects\consoleapplication1\consoleapplication1\ Note that the first ConsoleApplication1 is the solution directory, and the second one is the project directory. That will be the current working directory when we run our programs. The main method accepts a command-line argument. To set this argument in the debugger, edit the Project Properties. Select Debugging o Add the file name to the Command Arguments option. Build and Test Select Build Build Solution If everything is configured correctly, it should compile and tell you that: ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

To run: Debug Start Debugging (or ) You should see a window pop-up with your image! Congratulations! You re ready to explore OpenCV!