SlideShare a Scribd company logo
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

More Related Content

PDF
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
PDF
CI CD Jenkins for Swift Deployment
PPTX
DevOps: Age Of CI/CD
PPT
Vim Vi Improved
PDF
Jenkins Pipelines
PPTX
Introduction To Power Shell
PDF
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
PDF
Git hooks
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
CI CD Jenkins for Swift Deployment
DevOps: Age Of CI/CD
Vim Vi Improved
Jenkins Pipelines
Introduction To Power Shell
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Git hooks

What's hot (20)

PPTX
Unit Testing (C#)
PDF
왕초보를 위한 도커 사용법
PDF
Introduction to Docker Compose
PDF
Starting with Git & GitHub
PDF
Gradle - the Enterprise Automation Tool
PDF
Gitlab ci-cd
PPTX
Version control
PPTX
Write microservice in golang
PDF
Gradle Introduction
PPTX
GitHub Actions (Nakov at RuseConf, Sept 2022)
PDF
Introduction to DevOps
PPTX
Automation - web testing with selenium
PPTX
Docker Basic to Advance
PPTX
PDF
基于 FRIDA 的全平台逆向分析
 
PDF
Gitlab CI : Integration et Déploiement Continue
PDF
Embedded Linux BSP Training (Intro)
PDF
Dealing with Merge Conflicts in Git
PPTX
Docker 基礎介紹與實戰
PPTX
Unix Introduction
Unit Testing (C#)
왕초보를 위한 도커 사용법
Introduction to Docker Compose
Starting with Git & GitHub
Gradle - the Enterprise Automation Tool
Gitlab ci-cd
Version control
Write microservice in golang
Gradle Introduction
GitHub Actions (Nakov at RuseConf, Sept 2022)
Introduction to DevOps
Automation - web testing with selenium
Docker Basic to Advance
基于 FRIDA 的全平台逆向分析
 
Gitlab CI : Integration et Déploiement Continue
Embedded Linux BSP Training (Intro)
Dealing with Merge Conflicts in Git
Docker 基礎介紹與實戰
Unix Introduction
Ad

Similar to Using openCV 3.2.0 with CodeBlocks (20)

PPTX
Guide: How to Build OpenCV 3.0.0
PPSX
OpenCV installation in windows visual studio
PDF
OpenCV Workshop
PPTX
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
PDF
Using openCV 2.0 with Dev C++
PDF
Introduction to OpenCV (with Java)
PDF
Introduction to OpenCV 3.x (with Java)
PPTX
Getting started with open cv in raspberry pi
PDF
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
PDF
OpenCV Introduction
PDF
MM-4097, OpenCV-CL, by Harris Gasparakis, Vadim Pisarevsky and Andrey Pavlenko
PPTX
OpenCV+Android.pptx
PDF
Installing OpenCV 2.4.x with Qt
PDF
OpenCV 3.0 - Latest news and the Roadmap
PDF
Using openCV 3.1.0 with vs2015
PPTX
Image Processing In Open Computer Vision
PDF
Installing OpenCV 2.3.1 with Qt
PPT
Intro_OpenCV.ppt
PDF
Getting started with_graphics
PPTX
Open Standards for ADAS: Andrew Richards, Codeplay, at AutoSens 2016
Guide: How to Build OpenCV 3.0.0
OpenCV installation in windows visual studio
OpenCV Workshop
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Using openCV 2.0 with Dev C++
Introduction to OpenCV (with Java)
Introduction to OpenCV 3.x (with Java)
Getting started with open cv in raspberry pi
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
OpenCV Introduction
MM-4097, OpenCV-CL, by Harris Gasparakis, Vadim Pisarevsky and Andrey Pavlenko
OpenCV+Android.pptx
Installing OpenCV 2.4.x with Qt
OpenCV 3.0 - Latest news and the Roadmap
Using openCV 3.1.0 with vs2015
Image Processing In Open Computer Vision
Installing OpenCV 2.3.1 with Qt
Intro_OpenCV.ppt
Getting started with_graphics
Open Standards for ADAS: Andrew Richards, Codeplay, at AutoSens 2016
Ad

More from Wei-Wen Hsu (8)

PDF
openCV with python
PDF
Python for data science
PDF
Running openCV project on Mac OS
PDF
Installing Python on Mac
PDF
Using open cv 249 with vs2012
PDF
Basic openCV Functions Using CPP
PDF
Concise Notes on Python
PDF
Installing Python on Windows OS
openCV with python
Python for data science
Running openCV project on Mac OS
Installing Python on Mac
Using open cv 249 with vs2012
Basic openCV Functions Using CPP
Concise Notes on Python
Installing Python on Windows OS

Recently uploaded (20)

PDF
Understanding Forklifts - TECH EHS Solution
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Introduction to Artificial Intelligence
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
top salesforce developer skills in 2025.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Transform Your Business with a Software ERP System
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPT
Introduction Database Management System for Course Database
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
medical staffing services at VALiNTRY
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Understanding Forklifts - TECH EHS Solution
Navsoft: AI-Powered Business Solutions & Custom Software Development
Introduction to Artificial Intelligence
Wondershare Filmora 15 Crack With Activation Key [2025
top salesforce developer skills in 2025.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Upgrade and Innovation Strategies for SAP ERP Customers
Transform Your Business with a Software ERP System
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Which alternative to Crystal Reports is best for small or large businesses.pdf
Nekopoi APK 2025 free lastest update
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Introduction Database Management System for Course Database
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
2025 Textile ERP Trends: SAP, Odoo & Oracle
medical staffing services at VALiNTRY
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
VVF-Customer-Presentation2025-Ver1.9.pptx
Digital Strategies for Manufacturing Companies
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025

Using openCV 3.2.0 with CodeBlocks