introduction to opencv 2.3.1
DESCRIPTION
A brief introduction to OpenCV 2.3.1 for the Computer Vision Course at Politecnico di Torino (academic year 2011/2012).TRANSCRIPT
Computer Vision
OpenCV
Luigi De Russis
Politecnico di Torino Dipartimento di Automatica e Informatica (DAUIN)
Torino - Italy
This work is licensed under the Creative Commons (CC BY-SA)
License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/3.0/
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 2
What is OpenCV?
Open source Computer Vision library
Cross-platform
C/C++ API
Originally developed by Intel
Optimized and intended for real-time applications
More than 500 functions available
Current release version: 2.3.1 (August 2011)
Website: http://opencv.willowgarage.com/
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 3
Uses
Human-Computer Interaction (HCI)
Object Identification
Object Recognition
Face Recognition
Gesture Recognition
Motion Tracking
Image Processing
Mobile Robotics
… and so on.
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 4
OpenCV modules (I)
core
basic structures and algorithms
imgproc
Image Processing algorithms (such as image filtering,
geometrical image transformations, histograms, etc.)
highgui
built-in simple UI
video
video analysis (such as motion estimation and object
tracking)
we will use Qt, in
addition to it
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 5
OpenCV modules (II)
calib3d
camera calibration and 3D reconstruction
features2d
2D features framework (feature detectors, descriptors,
and descriptor matchers)
objdetect
detection of objects and other items (e.g., faces, eyes,
mugs, people, …)
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 6
OpenCV modules (III)
ml
machine learning classes used for statistical
classification, regression and clustering of data
gpu
GPU-accelerated algorithms
11/09/2011
Luigi De Russis - Computer Vision - OpenCV 7
cv::Mat
cv
all the OpenCV classes and functions are placed into the cv namespace
Mat
the basic image structure in OpenCV
overcomes the “old” IplImage problems
automatic memory management (more or less)
two data parts:
matrix header (contains information about the matrix)
a pointer to the matrix containing the pixel values
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 8
Demo Hour (I): Hello CV
Goal: to load an image and show it
Project available on the course page
Two files:
helloCV.pro
main.cpp
11/09/2011
Luigi De Russis - Computer Vision - OpenCV 9
Demo Hour (II)
helloCV.pro, the Qt project file (the one to open!)
to modify/copy on each new OpenCV+Qt project
two important variables has to be defined:
INCLUDEPATH += path/to/opencv/include \
LIBS += -Lpath/to/opencv/library \
-lopencv_core231d \
-lopencv_highgui231d \
-lopencv_imgproc231d \
… \
-lopencv_video231d
11/09/2011
Luigi De Russis - Computer Vision - OpenCV 10
Demo Hour (III)
main.cpp, the code that loads and shows an image
…
//read an image
cv::Mat image = cv::imread("image.jpg");
//create an image window named "Hello CV“ cv::namedWindow("Hello CV");
//now, show the image on window
cv::imshow("Hello CV", image);
…
11/09/2011
Luigi De Russis - Computer Vision - OpenCV 11
Demo Hour (IV)
Now, press “Run”…
11/09/2011 Luigi De Russis - Computer Vision - OpenCV 12
Resources
OpenCV (Full) Wiki http://opencv.willowgarage.com/wiki/FullOpenCVWiki
OpenCV 2.3 Documentation http://opencv.itseez.com/
[Book] Robert Laganière, OpenCV 2 Computer Vision Application Programming Cookbook, Packt Publishing
OpenCV User Group http://groups.yahoo.com/group/OpenCV/
OpenCV 2.3 Tutorials https://code.ros.org/trac/opencv/export/5642/trunk/opencv/doc/opencv_tutorials.pdf