SlideShare una empresa de Scribd logo
1 de 40
Using openCV 3.2.0
with CodeBlocks
David Hsu
Download the installers
• openCV 3.2.0 (opencv-3.2.0-vc14.exe)
http://opencv.org/downloads.html
• tdm-gcc (tdm64-gcc-5.1.0-2.exe)
http://tdm-gcc.tdragon.net/download
• CodeBlocks (codeblocks-16.01-setup.exe)
http://www.codeblocks.org/downloads/26
• CMake (cmake-3.7.1-win64-x64.msi)
https://cmake.org/download/
Get openCV
• http://opencv.org/downloads.html
• opencv-3.2.0-vc14.exe
Extract opencv320 under C:
• Extract to C:
• Extracting…
Create a new folder under
C:opencv
• New a folder “build_codeblocks” under C:opencv
Get tdm-gcc
• http://tdm-gcc.tdragon.net/download
• tdm64-gcc-5.1.0-2.exe
Install tdm-gcc
• Create a new TDM-GCC installation
• Create a MinGW-w64-based installation
• Next> ….
Get CodeBlocks
• http://www.codeblocks.org/downloads/26
• codeblocks-16.01-setup.exe (go without mingw)
Open CodeBlocks
• Settings -> Compiler-… :
In CodeBlocks
• Select “Toolchain executables”
• Check Compiler’s installation directory : C:TDM-GCC-64
If can’t find compiler executable
• Click “Reset defaults”
• Click OK for the Message of “Auto-detected to C:TDM-GCC-64”
Get CMake
• https://cmake.org/download/
• cmake-3.7.1-win64-x64.msi or cmake-3.7.1-win32-x86.msi
Install CMake
• Next …
Open CMake (cmake-gui)
• Browse Source to “C:/opencv/sources”
• Browse Build to “C:/opencv/build_codeblocks”
• Click “Configure”
Specify the generator
• Choose the generator : CodeBlocks-MinGW Makefiles
• Check “Use default native compilers”
• Click “Finish”
BUILD_opencv_world
• Once configuring done, scroll down and search for
BUILD_opencv_world. Make the option checked.
• Configure again
Generate
• Configuring done  Generate  Generating done
OpenCV.cbp
• Go to “C:opencvbuild_codeblocks” and open “OpenCV.cbp”
Build
• Build the OpenCV project
Build
• Build finished without any error (It may take a while)
Retarget the build to install
• Build  Select target  install
Build again
•
Build again
• Build without errors
Select opencv and opencv2
• Copy from “C:opencvbuild_codeblocksinstallinclude”
• Paste to “C:TDM-GCC-64x86_64-w64-mingw32include”
Select libopencv_world320.dll.a
• Copy from “C:opencvbuild_codeblocksinstallx64mingwlib”
• Paste to “C:TDM-GCC-64x86_64-w64-mingw32lib’’
Select all
• Copy from “C:opencvbuild_codeblocksinstallx64mingwbin”
• Paste to “C:TDM-GCC-64bin”
Create a new project in CodeBlocks
• File  new  Project…
• Choose “Console application”
Project – C++
• Choose “C++”
Project – name and save to…
• Name the project
• Determine the directory where the project will be saved to
Project – GNU GCC Compiler
• Check the compiler
Codes in main.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat image1, image2;
image1 = imread("lena.bmp", CV_LOAD_IMAGE_COLOR); // Read the file
if (!image1.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
image2 = imread("lena.bmp", CV_LOAD_IMAGE_GRAYSCALE); // Read the file
if (!image2.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
cout<<"opencv test"<<endl;
namedWindow("Color Image", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Color Image", image1); // Show our image inside it.
namedWindow("Gray Scale Image", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Gray Scale Image", image2); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
destroyAllWindows();
return 0;
}
main.cpp
Build options
• Right click the project and choose “Build options…”
Linker settings
• Linker settings
• Add
opencv_world320
• Add library : opencv_world320
opencv_world320
• Make sure opencv_world320 has been added to Link libraries
lena.bmp
• Put the resource file “lena.bmp” under the same directory of
main.cpp
Build and run
• Build and run the cvTest project
Image show
• Congrats and enjoy
programming with openCV

Más contenido relacionado

La actualidad más candente

Introduction to CMake
Introduction to CMakeIntroduction to CMake
Introduction to CMake
Dimitrios Platis
 

La actualidad más candente (20)

Implementing a Database and API for your Cloud Service
Implementing a Database and API for your Cloud ServiceImplementing a Database and API for your Cloud Service
Implementing a Database and API for your Cloud Service
 
Getting started with Octopus Deploy
Getting started with Octopus DeployGetting started with Octopus Deploy
Getting started with Octopus Deploy
 
Security as Code: A DevSecOps Approach
Security as Code: A DevSecOps ApproachSecurity as Code: A DevSecOps Approach
Security as Code: A DevSecOps Approach
 
DevSecOps
DevSecOpsDevSecOps
DevSecOps
 
What is Docker?
What is Docker?What is Docker?
What is Docker?
 
Jenkins
JenkinsJenkins
Jenkins
 
Programming in Java: Arrays
Programming in Java: ArraysProgramming in Java: Arrays
Programming in Java: Arrays
 
Jenkins
JenkinsJenkins
Jenkins
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
What's in a Jailbreak? - BSides 2019 keynote
What's in a Jailbreak? - BSides 2019 keynoteWhat's in a Jailbreak? - BSides 2019 keynote
What's in a Jailbreak? - BSides 2019 keynote
 
CI, CD, CT, Deploy, IaaS, DevOps, Stage
CI, CD, CT, Deploy, IaaS, DevOps, StageCI, CD, CT, Deploy, IaaS, DevOps, Stage
CI, CD, CT, Deploy, IaaS, DevOps, Stage
 
Introduction to CMake
Introduction to CMakeIntroduction to CMake
Introduction to CMake
 
Smarter deployments with octopus deploy
Smarter deployments with octopus deploySmarter deployments with octopus deploy
Smarter deployments with octopus deploy
 
ICB Learner Portal User Guide: How to register as a new learner in 10 easy steps
ICB Learner Portal User Guide: How to register as a new learner in 10 easy stepsICB Learner Portal User Guide: How to register as a new learner in 10 easy steps
ICB Learner Portal User Guide: How to register as a new learner in 10 easy steps
 
File upload using multer in node.js and express.js [2021 tutorial]
File upload using multer in node.js and express.js [2021 tutorial]File upload using multer in node.js and express.js [2021 tutorial]
File upload using multer in node.js and express.js [2021 tutorial]
 
OOP java
OOP javaOOP java
OOP java
 
DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019DevSecOps: What Why and How : Blackhat 2019
DevSecOps: What Why and How : Blackhat 2019
 
What is Docker
What is DockerWhat is Docker
What is Docker
 
C# Global Assembly Cache
C# Global Assembly CacheC# Global Assembly Cache
C# Global Assembly Cache
 
Union FileSystem - A Building Blocks Of a Container
Union FileSystem - A Building Blocks Of a ContainerUnion FileSystem - A Building Blocks Of a Container
Union FileSystem - A Building Blocks Of a Container
 

Similar a Using openCV 3.2.0 with CodeBlocks

MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptx
gopikahari7
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Adil Khan
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
Yoss Cohen
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-sem
Sagun Baijal
 

Similar a Using openCV 3.2.0 with CodeBlocks (20)

Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2
 
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
 
Reflections on Trusting Trust
Reflections on Trusting TrustReflections on Trusting Trust
Reflections on Trusting Trust
 
Android build on windows
Android build on windowsAndroid build on windows
Android build on windows
 
ICT1002-W8-LEC-Introduction-to-C.pdf
ICT1002-W8-LEC-Introduction-to-C.pdfICT1002-W8-LEC-Introduction-to-C.pdf
ICT1002-W8-LEC-Introduction-to-C.pdf
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptx
 
Lesson 02 - React Native Development Environment Setup
Lesson 02 - React Native Development Environment SetupLesson 02 - React Native Development Environment Setup
Lesson 02 - React Native Development Environment Setup
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 
C installation guide
C installation guideC installation guide
C installation guide
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JIT
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web Developers
 
How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocks
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-sem
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-sem
 

Más de Wei-Wen Hsu (10)

openCV with python
openCV with pythonopenCV with python
openCV with python
 
Python for data science
Python for data sciencePython for data science
Python for data science
 
Running openCV project on Mac OS
Running openCV project on Mac OSRunning openCV project on Mac OS
Running openCV project on Mac OS
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on Mac
 
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 open cv 249 with vs2012
Using open cv 249 with vs2012Using open cv 249 with vs2012
Using open cv 249 with vs2012
 
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++
 
Basic openCV Functions Using CPP
Basic openCV Functions Using CPPBasic openCV Functions Using CPP
Basic openCV Functions Using CPP
 
Concise Notes on Python
Concise Notes on PythonConcise Notes on Python
Concise Notes on Python
 
Installing Python on Windows OS
Installing Python on Windows OSInstalling Python on Windows OS
Installing Python on Windows OS
 

Último

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

Using openCV 3.2.0 with CodeBlocks