Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
OpenCV By Example

You're reading from  OpenCV By Example

Product type Book
Published in Jan 2016
Publisher Packt
ISBN-13 9781785280948
Pages 296 pages
Edition 1st Edition
Languages
Authors (3):
Prateek Joshi Prateek Joshi
Profile icon Prateek Joshi
David Millán Escrivá David Millán Escrivá
Profile icon David Millán Escrivá
Vinícius G. Mendonça Vinícius G. Mendonça
Profile icon Vinícius G. Mendonça
View More author details

Table of Contents (18) Chapters

OpenCV By Example
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Getting Started with OpenCV An Introduction to the Basics of OpenCV Learning the Graphical User Interface and Basic Filtering Delving into Histograms and Filters Automated Optical Inspection, Object Segmentation, and Detection Learning Object Classification Detecting Face Parts and Overlaying Masks Video Surveillance, Background Modeling, and Morphological Operations Learning Object Tracking Developing Segmentation Algorithms for Text Recognition Text Recognition with Tesseract Index

Generating a CMake script file


Before we start creating our source file, we will generate the CMakeLists.txt file that will allow us to compile our project, structure, and executable. The following cmake script is simple and basic but enough to compile and generate the executable:

cmake_minimum_required (VERSION 2.6)

cmake_policy(SET CMP0012 NEW)

PROJECT(Chapter4_Phototool)

# Requires OpenCV
FIND_PACKAGE( OpenCV 3.0.0 REQUIRED )

include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIB_DIR})

ADD_EXECUTABLE( ${PROJECT_NAME} main.cpp )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} )

Let's try to understand the script file.

The first line indicates the minimum cmake version required to generate our project, and the second line sets the CMP0012 policy variable to allow you to identify numbers and Boolean constants and remove the CMake warning if it is not set:

cmake_minimum_required (VERSION 2.6)
cmake_policy(SET CMP0012 NEW)

After these two lines, we define the project...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}