SlideShare ist ein Scribd-Unternehmen logo
1 von 20
BUILDING OPENCV
3.0.0 YOURSELF
André Moreira
June, 2014
WHO I AM ...
# My name is André de Souza Moreira;
# Msc. Candidate at PUC-RIO;
# Researcher at Instituto Tecgraf in Computer Graphics;
# Before: Researcher at NCA in Medical Image Processing.
andredsm.com
WHAT IS OPENCV?
# It’s an open source library written in C++ for computer vision.
# It was originally designed by Intel.
# There are several bidings to others languagens like Python and Java.
# Runs on Windows, Android, Linux, OS X and others.
# Offers CUDA and OpenCL Interface.
# Its last release version is 2.4.9 but you can acquire 3.0.0 version (under development) on
github (June, 2014).
GOALS
# Making a simple building of OpenCV 3.0.0 with Visual Studio 2013;
# Running an OpenCV example;
# Linking the library against a new project in Visual Studio 2013.
BEFORE
YOU BUILD
Step :
Get the Source Code
# Available at https://github.com/Itseez/opencv
# Option 1: Download directly from the website
1
Step :
Get the Source COde
# Option 2: Clone the git repository:
# The advantage of this method consists of tracking changes from the original repository.
So, you can rebuild the library whenever there is a new feature...
1
$ git clone git@github.com:Itseez/opencv.git
Step :
Install dependencies
# There are a lot dependencies you can use in opencv building, such as: Qt, Python,
Opengl, pdflatex to generate the documentation, CUDA, OpenCL and others...
# For example, you can install the python 2.7.x and numpy in order to build python
wrapper.
2
# Install the Cmake Tool
• Available on http://www.cmake.org/
# Open cmake-gui, configure where the library’s source code is (1) and where the project’s
files will be generated (2). Finally, click in Configure button (3).
Step :
Preparing the Project
3
(1)
(2)
(3)
# Select the project that will be generated.
• In our case is Visual Studio 2013. (No, I did not choose the wrong option, the
generator for Visual Studio 2013 is really called Visual Studio 12!) ;P
Step :
Preparing the Project
3
# Cmake will show you some build options:
• BUILD: set what gonna be built.
• WITH: The library takes advantage of others technologies like CUDA.
• INSTALL: Which files will be put in the installation folder.
• CMAKE/CMAKE_INSTAL_PREFIX:
Set the default installation folder.
# After choosing, click Configure button
again. If everything is OK, all the red
background will disappear.
# Finally, click in the Generate button.
Step :
Preparing the Project
3
My Options:
BUILDING THE PROJECT
# Go to the build folder and open the Visual Studio Solution (Opencv.sln)
# Select the build mode (1) and then build the project ALL_BUILD (2). (This step will build all
the projects shown in the Solution Explorer Guide)
# If no errors occurs, build the INSTALL project (3). (Installs the artifacts)
Step :
Building the Project
4
(1)
(2)
(3)
# Copy all the .dll in {INSTALL_DIRECTORY} x64vc12bin to:
• C:WindowsSystem32 if the library was built in x64
• C:WindowsSysWOW64 if the library was built in x86
# At this point, you can run any sample and it should works without error.
# Copy all files in {INSTALL_DIRECTORY} x64vc12lib to
{VISUALSTUDIO_DIRECTORY}VClib (x86) or {VISUALSTUDIO_DIRECTORY}VClibamd64
(x64)
# Copy the two folders in {INSTALL_DIRECTORY} include to
{VISUALSTUDIO_DIRECTORY}VCinclude
Step :
Installing the library
5
RUN THE SAMPLES
# You can run the examples from {INSTALL_DIRECTORY} x64vc12samples* and check if
everything is OK.
• Running cppcpp-example-delaunay2.exe:
Link Against the Library
# Create a new project (CTRL+SHIFT+N).
# Go to DEBUG > {projectName} Properties (Alt + F7)
# List the modules’ name you need in Linker > Input > Additional Dependencies:
• Example:
Link Against the Library
# Create a cpp file (CTRL+SHIFT+A) and run it (CTRL+F5):
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <stdlib.h>
#include <stdio.h>
using namespace cv;
/** @function main */
int main(int argc, char** argv)
{
Mat src, src_gray, dst;
int kernel_size = 3;
int scale = 1;
int delta = 0;
int ddepth = CV_16S;
char* window_name = "Laplace Demo";
/// Load your image
src = imread("myImage.jpg");
if (!src.data)
{
return -1;
}
/// Remove noise by blurring with a Gaussian filter
GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT);
/// Convert the image to grayscale
cvtColor(src, src_gray, COLOR_RGB2GRAY);
/// Create window
namedWindow(window_name, WINDOW_AUTOSIZE);
/// Apply Laplace function
Mat abs_dst;
Laplacian(src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT);
convertScaleAbs(dst, abs_dst);
/// Show what you got
imshow(window_name, abs_dst);
waitKey(0);
return 0;
}
The Result
Ref: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.html
Need Help?
# The Official Documentation:
• http://www.teste.com
# The Stackoverflow Community:
• http://stackoverflow.com/questions/tagged/opencv
# OpenCV’s Install Guide:
• http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html
# This Great Book: ;)
OpenCV Computer Vision Application Programming Cookbook (2nd Edition),
Robert Laganiere.
ISBN-13: 9781782161486
Publisher: Packt Publishing
Publication date: 8/1/2014
Pages: 390

Weitere ähnliche Inhalte

Was ist angesagt?

Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++
Shuo Chen
 

Was ist angesagt? (20)

Instalación de Oracle Database 11g R2 sobre Oracle Linux X86_64
Instalación de Oracle Database 11g R2 sobre Oracle Linux X86_64Instalación de Oracle Database 11g R2 sobre Oracle Linux X86_64
Instalación de Oracle Database 11g R2 sobre Oracle Linux X86_64
 
Android Data Binding in action using MVVM pattern - droidconUK
Android Data Binding in action using MVVM pattern - droidconUKAndroid Data Binding in action using MVVM pattern - droidconUK
Android Data Binding in action using MVVM pattern - droidconUK
 
Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++
 
Windows Server and Docker - The Internals Behind Bringing Docker and Containe...
Windows Server and Docker - The Internals Behind Bringing Docker and Containe...Windows Server and Docker - The Internals Behind Bringing Docker and Containe...
Windows Server and Docker - The Internals Behind Bringing Docker and Containe...
 
Introduction to Flutter.pptx
Introduction to Flutter.pptxIntroduction to Flutter.pptx
Introduction to Flutter.pptx
 
mago3D 한국어 소개 자료
mago3D 한국어 소개 자료 mago3D 한국어 소개 자료
mago3D 한국어 소개 자료
 
Docker containers : introduction
Docker containers : introductionDocker containers : introduction
Docker containers : introduction
 
Building Instruqt, a scalable learning platform
Building Instruqt, a scalable learning platformBuilding Instruqt, a scalable learning platform
Building Instruqt, a scalable learning platform
 
[NEXT] Android Profiler 사용법
[NEXT] Android Profiler 사용법 [NEXT] Android Profiler 사용법
[NEXT] Android Profiler 사용법
 
Programming Game AI by Example. Ch7. Raven
Programming Game AI by Example. Ch7. RavenProgramming Game AI by Example. Ch7. Raven
Programming Game AI by Example. Ch7. Raven
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Introduction To Docker, Docker Compose, Docker Swarm
Introduction To Docker, Docker Compose, Docker SwarmIntroduction To Docker, Docker Compose, Docker Swarm
Introduction To Docker, Docker Compose, Docker Swarm
 
Instagram Hacker 2014 v3.7.2 - easy way to hack Instagram account !
Instagram Hacker 2014 v3.7.2 - easy way to hack Instagram account !Instagram Hacker 2014 v3.7.2 - easy way to hack Instagram account !
Instagram Hacker 2014 v3.7.2 - easy way to hack Instagram account !
 
Rancher kubernetes storages
Rancher kubernetes storagesRancher kubernetes storages
Rancher kubernetes storages
 
Docker Tours Meetup #1 - Introduction à Docker
Docker Tours Meetup #1 - Introduction à DockerDocker Tours Meetup #1 - Introduction à Docker
Docker Tours Meetup #1 - Introduction à Docker
 
Environment management in a continuous delivery world (3)
Environment management in a continuous delivery world (3)Environment management in a continuous delivery world (3)
Environment management in a continuous delivery world (3)
 
AstriCon 2017 - Docker Swarm & Asterisk
AstriCon 2017  - Docker Swarm & AsteriskAstriCon 2017  - Docker Swarm & Asterisk
AstriCon 2017 - Docker Swarm & Asterisk
 
Uncloaking IP Addresses on IRC
Uncloaking IP Addresses on IRCUncloaking IP Addresses on IRC
Uncloaking IP Addresses on IRC
 
오픈소스 기반의 Digital Twin Platform mago3D의 과거, 현재 그리고 미래
오픈소스 기반의 Digital Twin Platform mago3D의 과거, 현재 그리고 미래오픈소스 기반의 Digital Twin Platform mago3D의 과거, 현재 그리고 미래
오픈소스 기반의 Digital Twin Platform mago3D의 과거, 현재 그리고 미래
 
CI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and TutumCI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and Tutum
 

Andere mochten auch

PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel HordesPyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
kgrandis
 
OpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapOpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the Roadmap
Eugene Khvedchenya
 
Installing OpenCV 2.4.x with Qt
Installing OpenCV 2.4.x with QtInstalling OpenCV 2.4.x with Qt
Installing OpenCV 2.4.x with Qt
Luigi De Russis
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
Edge AI and Vision Alliance
 

Andere mochten auch (20)

Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
 
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel HordesPyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
 
OpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the RoadmapOpenCV 3.0 - Latest news and the Roadmap
OpenCV 3.0 - Latest news and the Roadmap
 
Using openCV 3.2.0 with CodeBlocks
Using openCV 3.2.0 with CodeBlocksUsing openCV 3.2.0 with CodeBlocks
Using openCV 3.2.0 with CodeBlocks
 
Computer Vision, Deep Learning, OpenCV
Computer Vision, Deep Learning, OpenCVComputer Vision, Deep Learning, OpenCV
Computer Vision, Deep Learning, OpenCV
 
Installing OpenCV 2.4.x with Qt
Installing OpenCV 2.4.x with QtInstalling OpenCV 2.4.x with Qt
Installing OpenCV 2.4.x with Qt
 
OpenCV Workshop
OpenCV WorkshopOpenCV Workshop
OpenCV Workshop
 
Object detection
Object detectionObject detection
Object detection
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
Raspberry jam bogota 2016 - Raspberry Pi en el movimiento maker y la educacion
Raspberry jam bogota 2016 - Raspberry Pi en el movimiento maker y la educacionRaspberry jam bogota 2016 - Raspberry Pi en el movimiento maker y la educacion
Raspberry jam bogota 2016 - Raspberry Pi en el movimiento maker y la educacion
 
Open Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 TutorialOpen Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 Tutorial
 
Lec2
Lec2Lec2
Lec2
 
Raspberry jam Bogota 2016 - Sistema de visión artificial aplicados a procesos...
Raspberry jam Bogota 2016 - Sistema de visión artificial aplicados a procesos...Raspberry jam Bogota 2016 - Sistema de visión artificial aplicados a procesos...
Raspberry jam Bogota 2016 - Sistema de visión artificial aplicados a procesos...
 
Visual Search
Visual SearchVisual Search
Visual Search
 
Using openCV 3.1.0 with vs2015
Using openCV 3.1.0 with vs2015Using openCV 3.1.0 with vs2015
Using openCV 3.1.0 with vs2015
 
Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++
 
Introduction to OpenCV
Introduction to OpenCVIntroduction to OpenCV
Introduction to OpenCV
 
Deep Learning
Deep LearningDeep Learning
Deep Learning
 
이기종 멀티코어 기반의 Open cv 응용 사례 및 효율적인 어플리케이션 디자인
이기종 멀티코어 기반의 Open cv 응용 사례 및 효율적인 어플리케이션 디자인이기종 멀티코어 기반의 Open cv 응용 사례 및 효율적인 어플리케이션 디자인
이기종 멀티코어 기반의 Open cv 응용 사례 및 효율적인 어플리케이션 디자인
 

Ähnlich wie Guide: How to Build OpenCV 3.0.0

A "Box" Full of Tools and Distros
A "Box" Full of Tools and DistrosA "Box" Full of Tools and Distros
A "Box" Full of Tools and Distros
Dario Faggioli
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guide
gilmsdn
 

Ähnlich wie Guide: How to Build OpenCV 3.0.0 (20)

How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocks
 
Smiley033
Smiley033Smiley033
Smiley033
 
Android studio
Android studioAndroid studio
Android studio
 
A "Box" Full of Tools and Distros
A "Box" Full of Tools and DistrosA "Box" Full of Tools and Distros
A "Box" Full of Tools and Distros
 
From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
 
Kinect Workshop Part 1/2
Kinect Workshop Part 1/2Kinect Workshop Part 1/2
Kinect Workshop Part 1/2
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Cpb2010
Cpb2010Cpb2010
Cpb2010
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and You
 
Machine learning in cybersecutiry
Machine learning in cybersecutiryMachine learning in cybersecutiry
Machine learning in cybersecutiry
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
openGl configuration_in visual studio 2019.pptx
openGl configuration_in visual studio 2019.pptxopenGl configuration_in visual studio 2019.pptx
openGl configuration_in visual studio 2019.pptx
 
Programming
ProgrammingProgramming
Programming
 
codeblocks-instructions.pdf
codeblocks-instructions.pdfcodeblocks-instructions.pdf
codeblocks-instructions.pdf
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guide
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Guide: How to Build OpenCV 3.0.0

  • 2. WHO I AM ... # My name is André de Souza Moreira; # Msc. Candidate at PUC-RIO; # Researcher at Instituto Tecgraf in Computer Graphics; # Before: Researcher at NCA in Medical Image Processing. andredsm.com
  • 3. WHAT IS OPENCV? # It’s an open source library written in C++ for computer vision. # It was originally designed by Intel. # There are several bidings to others languagens like Python and Java. # Runs on Windows, Android, Linux, OS X and others. # Offers CUDA and OpenCL Interface. # Its last release version is 2.4.9 but you can acquire 3.0.0 version (under development) on github (June, 2014).
  • 4. GOALS # Making a simple building of OpenCV 3.0.0 with Visual Studio 2013; # Running an OpenCV example; # Linking the library against a new project in Visual Studio 2013.
  • 6. Step : Get the Source Code # Available at https://github.com/Itseez/opencv # Option 1: Download directly from the website 1
  • 7. Step : Get the Source COde # Option 2: Clone the git repository: # The advantage of this method consists of tracking changes from the original repository. So, you can rebuild the library whenever there is a new feature... 1 $ git clone git@github.com:Itseez/opencv.git
  • 8. Step : Install dependencies # There are a lot dependencies you can use in opencv building, such as: Qt, Python, Opengl, pdflatex to generate the documentation, CUDA, OpenCL and others... # For example, you can install the python 2.7.x and numpy in order to build python wrapper. 2
  • 9. # Install the Cmake Tool • Available on http://www.cmake.org/ # Open cmake-gui, configure where the library’s source code is (1) and where the project’s files will be generated (2). Finally, click in Configure button (3). Step : Preparing the Project 3 (1) (2) (3)
  • 10. # Select the project that will be generated. • In our case is Visual Studio 2013. (No, I did not choose the wrong option, the generator for Visual Studio 2013 is really called Visual Studio 12!) ;P Step : Preparing the Project 3
  • 11. # Cmake will show you some build options: • BUILD: set what gonna be built. • WITH: The library takes advantage of others technologies like CUDA. • INSTALL: Which files will be put in the installation folder. • CMAKE/CMAKE_INSTAL_PREFIX: Set the default installation folder. # After choosing, click Configure button again. If everything is OK, all the red background will disappear. # Finally, click in the Generate button. Step : Preparing the Project 3
  • 14. # Go to the build folder and open the Visual Studio Solution (Opencv.sln) # Select the build mode (1) and then build the project ALL_BUILD (2). (This step will build all the projects shown in the Solution Explorer Guide) # If no errors occurs, build the INSTALL project (3). (Installs the artifacts) Step : Building the Project 4 (1) (2) (3)
  • 15. # Copy all the .dll in {INSTALL_DIRECTORY} x64vc12bin to: • C:WindowsSystem32 if the library was built in x64 • C:WindowsSysWOW64 if the library was built in x86 # At this point, you can run any sample and it should works without error. # Copy all files in {INSTALL_DIRECTORY} x64vc12lib to {VISUALSTUDIO_DIRECTORY}VClib (x86) or {VISUALSTUDIO_DIRECTORY}VClibamd64 (x64) # Copy the two folders in {INSTALL_DIRECTORY} include to {VISUALSTUDIO_DIRECTORY}VCinclude Step : Installing the library 5
  • 16. RUN THE SAMPLES # You can run the examples from {INSTALL_DIRECTORY} x64vc12samples* and check if everything is OK. • Running cppcpp-example-delaunay2.exe:
  • 17. Link Against the Library # Create a new project (CTRL+SHIFT+N). # Go to DEBUG > {projectName} Properties (Alt + F7) # List the modules’ name you need in Linker > Input > Additional Dependencies: • Example:
  • 18. Link Against the Library # Create a cpp file (CTRL+SHIFT+A) and run it (CTRL+F5): #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <stdlib.h> #include <stdio.h> using namespace cv; /** @function main */ int main(int argc, char** argv) { Mat src, src_gray, dst; int kernel_size = 3; int scale = 1; int delta = 0; int ddepth = CV_16S; char* window_name = "Laplace Demo"; /// Load your image src = imread("myImage.jpg"); if (!src.data) { return -1; } /// Remove noise by blurring with a Gaussian filter GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT); /// Convert the image to grayscale cvtColor(src, src_gray, COLOR_RGB2GRAY); /// Create window namedWindow(window_name, WINDOW_AUTOSIZE); /// Apply Laplace function Mat abs_dst; Laplacian(src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT); convertScaleAbs(dst, abs_dst); /// Show what you got imshow(window_name, abs_dst); waitKey(0); return 0; }
  • 20. Need Help? # The Official Documentation: • http://www.teste.com # The Stackoverflow Community: • http://stackoverflow.com/questions/tagged/opencv # OpenCV’s Install Guide: • http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html # This Great Book: ;) OpenCV Computer Vision Application Programming Cookbook (2nd Edition), Robert Laganiere. ISBN-13: 9781782161486 Publisher: Packt Publishing Publication date: 8/1/2014 Pages: 390