opencv - unict

28
OpenCV Giovanni Maria Farinella Giovanni Maria Farinella

Upload: others

Post on 09-Jul-2022

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OpenCV - Unict

OpenCV

Giovanni Maria FarinellaGiovanni Maria Farinella

Page 2: OpenCV - Unict

What is Vision?What is Vision?

“What does it mean to see? The plain man's answer (andWhat does it mean, to see? The plain man s answer (andAristotle's, too) would be, to knowwhat is where by looking.”

David Marr, Vision (1982)

Giovanni Maria Farinella

, ( )

Page 3: OpenCV - Unict

Computer Visionp

Giovanni Maria Farinella

Computer vision is the science (some say art) of programming acomputer to process, and ultimately understand, images andvideo.

Page 4: OpenCV - Unict

The Computer Vision IndustrySee: http://people cs ubc ca/~lowe/vision htmlSee: http://people.cs.ubc.ca/ lowe/vision.html

Giovanni Maria Farinella

Page 5: OpenCV - Unict

Computer VisionP

Pedestrian

Process

Alert DriverAlert Driver

Giovanni Maria Farinella

Page 6: OpenCV - Unict

OpenCVOpenCV

• Insieme di librerie Open Source cheimplementano algoritmi noti di Imagep g gProcessing, Computer Vision e MachineLearningLearning.

Giovanni Maria Farinella

Page 7: OpenCV - Unict

OpenCv BookOpenCv Book

• Gary Bradski Adrian Kaehler Learning OpenCV: ComputerGary Bradski, Adrian Kaehler, Learning OpenCV: Computer Vision with the OpenCV Library, O'Reilly, 2008

• Preview del Libro su Google Books:h //b k l i /b k ?id A iOf 2EIC

Giovanni Maria Farinella

– http://books.google.it/books?id=seAgiOfu2EIC

Page 8: OpenCV - Unict

Risorse onlineRisorse onlineM i O CV it• Main OpenCV site:– http://sourceforge.net/projects/opencvlibrary/

• OpenCv Wiki page:– http://opencv.willowgarage.com/wiki/

• OpenCV Library:– http://sourceforge.net/projects/opencvlibrary/files/opencv‐p // g /p j / p y/ / p

win/1.1pre1/OpenCV_1.1pre1a.exe/download

• Visual Studio (Microsoft MSDN Academic Alliance):• Visual Studio (Microsoft MSDN Academic Alliance):– http://web.dmi.unict.it/Pagina/It/Centro_di_calcolo/Servizi/Microsoft

_MSDN_AA.aspx

Giovanni Maria Farinella

Page 9: OpenCV - Unict

IstallazioneIstallazione

• Dopo aver istallato Visual Studio e OpenCV, basta seguire i passi al seguente link:g p ghttp://opencv.willowgarage.com/wiki/VisualC%2B%2B

Giovanni Maria Farinella

Page 10: OpenCV - Unict

DocumentazioneDocumentazione

• “…\OpenCV\docs”

Giovanni Maria Farinella

Page 11: OpenCV - Unict

CVImage Processing

MLStatistical Classifiers HighGUIImage Processing 

and Vision Algorithms

Statistical Classifiersand 

Clustering Tools

GUI, Image and Video I/O

CXCORECXCOREbasic structures and algorithms,XML support, drawing functions

CVAUX

Giovanni Maria Farinella

Page 12: OpenCV - Unict

CXCORECXCORE• Basic Structures• Operations on Arrays

Initialization, Accessing Elements and sub‐Arrays, Copying and Filling, Transforms and Permutations,Arithmetic, Logic and Filling, Transforms and Permutations,Arithmetic, ogic andComparison, Statistics, Linear Algebra, Math Functions, RandomNumber Generation, Discrete Transforms

• Dynamic StructuresDynamic StructuresMemory Storages, Sequences, Sets, Graphs, Trees

• Drawing FunctionsCurves and Shapes, Text, Point Sets and Contours

• Data Persistence and RTTIFile Storage Writing Data Reading Data RTTI and GenericFile Storage, Writing Data, Reading Data, RTTI and GenericFunctions

• Miscellaneous Functions

Giovanni Maria Farinella

Error Handling and System Functions: Error Handling, System Functions

Page 13: OpenCV - Unict

CVCV• Image Processing 

Gradients, Edges, Corners and Features, Sampling, Interpolationand Geometrical Transforms, Morphological Operations, Filtersand Color Conversion, Pyramids and the Applications, ImageSegmentation, Connected Components and Contour Retrieval, Image and Contour Moments, Special Image Transforms, Histograms, Matching

• Structural AnalysisContour Processing , Computational Geometry, Planar Subdivisions

• Motion Analysis and Object Tracking• Motion Analysis and Object TrackingAccumulation of Background Statistics, Motion Templates, Object Tracking, Optical Flow, Feature Matching, Estimators

• Pattern RecognitionObject Detection 

• Camera Calibration and 3D Reconstruction

Giovanni Maria Farinella

• Camera Calibration and 3D ReconstructionSingle and Stereo Camera Calibration, Pose Estimation, EpipolarGeometry, Stereo Correspondence

Page 14: OpenCV - Unict

MLML

l ifi• Bayes Classifier • K Nearest Neighbors g• Support Vector Machine • Decision Trees• Decision Trees • Boosting • Random Trees • Expectation‐MaximizationExpectation Maximization • Neural Networks 

Giovanni Maria Farinella

Page 15: OpenCV - Unict

HIGHGUIHIGHGUI

• Simple GUI • Loading and Saving ImagesLoading and Saving Images • Video I/O • Utility and System Functions 

Giovanni Maria Farinella

Page 16: OpenCV - Unict

CVAUXCVAUX

• Stereo Correspondence Functions• View Morphing FunctionsView Morphing Functions• 3D Tracking Functions• Eigen Objects (PCA) Functions• Embedded Hidden Markov Models FunctionsEmbedded Hidden Markov Models Functions

Giovanni Maria Farinella

Page 17: OpenCV - Unict

EsempiEsempi

“ \ \ l \ ”• “…\OpenCV\samples\c”• Alcuni Esempi:p

DFTEDGE DETECTIONEDGE DETECTIONMORPHOLOGYKMEANSKMEANSINPAINTINGFACE DETECTIONFACE DETECTIONTRACKING

Giovanni Maria Farinella

Page 18: OpenCV - Unict

Imparare dagli esempiImparare dagli esempi

• I codici degli esempi presenti nel libro di testo si trovano al seguente link:g– http://examples.oreilly.com/9780596516130/

Giovanni Maria Farinella

Page 19: OpenCV - Unict

InterfacceInterfacce

• Visual Studio permette di creare delle interfacce in maniera semplice.p

T l i i l li k• Trovate alcuni esempi al seguente link:– http://www.site.uottawa.ca/~laganier/tutorial/opencv+directshow/cvision.htm

Giovanni Maria Farinella

Page 20: OpenCV - Unict

Homework Esempio 1Homework ‐ Esempio 1

ili il l di O C f di• Utilizzare il manuale di OpenCV per approfondire la conoscenza delle seguenti strutture/funzioni:

– IplImage– cvLoadImage– cvNamedWindow– cvShowImage– cvWaitKey– cvReleaseImage– cvDestroyWindow

Giovanni Maria Farinella

Page 21: OpenCV - Unict

Homework Esempio 2Homework ‐ Esempio 2• Utilizzare il manuale di OpenCV per approfondire la conoscenza delle• Utilizzare il manuale di OpenCV per approfondire la conoscenza delle

seguenti strutture/funzioni:– CvSize– cvCvtColor S b/ Add/ M l/ Di– cvCvtColor– cvCreateImage– cvThreshold– CvRect

cvSub/cvAdd/cvMul/cvDivcvMax/cvMaxS/cvMinScvMatcvDet/cvTranspose/cvSolve/cvSVD/cvEigenCvRect

– cvSetImageROI– cvSetImageROI– cvCopyImage

cvDet/cvTranspose/cvSolve/cvSVD/cvEigencvDFTcvShiftDFTcvPowpy g

– cvCvtPixToPlane– CvScalar– cvGet2D

cvPowcvLogcvLine/cvRectangle/cvCircle/cvEllipsecvPutText

– cvSet– cvOr/cvAnd/cvXor/cvNot

cvPutText

Giovanni Maria Farinella

Page 22: OpenCV - Unict

Homework Esempio 3Homework ‐ Esempio 3

• Utilizzare il manuale di OpenCV perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– CvCapture– CvCapture– cvCreateFileCapture– cvQueryFrame– cvReleaseCapture

Giovanni Maria Farinella

Page 23: OpenCV - Unict

Homework Esempio 4Homework ‐ Esempio 4

• Utilizzare il manuale di OpenCV perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– cvGetCaptureProperty– cvGetCaptureProperty– cvCreateTrackbar– cvSetTrackbarPos– cvSetCaptureProperty

Giovanni Maria Farinella

Page 24: OpenCV - Unict

Homework Esempio 5Homework ‐ Esempio 5

• Utilizzare il manuale di OpenCV perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– cvGetSize– cvGetSize– cvSmooth– cvFilter2D

Giovanni Maria Farinella

Page 25: OpenCV - Unict

Homework Esempio 6Homework ‐ Esempio 6

• Utilizzare il manuale di OpenCV perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– cvPyrDown– cvPyrDown– cvPyrUp

Giovanni Maria Farinella

Page 26: OpenCV - Unict

Homework Esempio 7Homework ‐ Esempio 7

• Utilizzare il manuale di OpenCV perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– cvCanny– cvCanny

Giovanni Maria Farinella

Page 27: OpenCV - Unict

Homework Esempio 10Homework ‐ Esempio 10

• Utilizzare il manuale di OpenCV perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– CvCapture– CvCapture– cvCreateCameraCapture– cvQueryFrame– cvReleaseCapture

Giovanni Maria Farinella

Page 28: OpenCV - Unict

Homework Esempio Dialog BoxHomework ‐ Esempio Dialog Box

• Utilizzare il manuale di OpenCV/MSDN perapprofondire la conoscenza delle seguentipp gstrutture/funzioni:– CFileDialog– CFileDialog– cvErode– cvLoadImage– cvSaveImage

Giovanni Maria Farinella