View  Edit  Attributes  History  Attach  Print  Search

OpenCV, librairie C/C++ opensource de traitement d'image.

Introduction

  • Cette librairie permet de réaliser du traitement d'image avancé et dispose de plusieurs milliers de fonctions dédiées. Les utilisations typiques possibles :
    • traitements d'image de base (flou, seuillage, filtre Guaussien, Sobel)
    • algorithmes d'analyse d'image (reconnaissance de lignes, de cercle)
    • détection de contour
    • reconnaissance et suivi d'objet
    • ...
  • Je présente cette librairie ici, car elle est utilisable sous Processing, soit à l'aide de la librairie OpenCV Processing, soit via javacv, une librairie qui implémente les fonctions openCV en java et est donc utilisable sous Processing.

Liens essentiels

Installation

  • Compilation/Installation d'OpenCV 2.3.1 sous Ubuntu 10.04
  • Installation de javacv dans Processing

Structure de la librairie

La librairie OpenCV (2.3.1) est organisée en plusieurs modules dédiés chacun à une fonction particulière :

  • core. Le coeur de la librairie
  • imgproc. Traitement d'image
  • highgui. Interface Utilisateur Graphique et gestion des E/S (fichiers)
  • video. Analyse vidéo
  • calib3d. Calibration de caméra et reconnaissance 3D
  • features2d. Outils 2D
  • objdetect. Détection d'objet
  • ml. Algorithmes d'apprentissage
  • flann. Recherche dans des espaces à dimensions multiples
  • gpu. Vision par ordinateur accélérée

Dans le cadre d'une approche basique, et pour un objectif de robotique amateur, l'utilisation des fonctions des modules "core" et "imgproc" constitue une bonne base.

Vue d'ensemble des fonctions de la librairie

Fonctions du module core

    * Basic Structures
          o DataType
          o Point_
          o Point3_
          o Size_
          o Rect_
          o RotatedRect
          o TermCriteria
          o Matx
          o Vec
          o Scalar_
          o Range
          o Ptr
          o Mat
          o Matrix Expressions
          o Mat::Mat
          o Mat::~Mat
          o Mat::operator =
          o Mat::operator MatExpr
          o Mat::row
          o Mat::col
          o Mat::rowRange
          o Mat::colRange
          o Mat::diag
          o Mat::clone
          o Mat::copyTo
          o Mat::convertTo
          o Mat::assignTo
          o Mat::setTo
          o Mat::reshape
          o Mat::t
          o Mat::inv
          o Mat::mul
          o Mat::cross
          o Mat::dot
          o Mat::zeros
          o Mat::ones
          o Mat::eye
          o Mat::create
          o Mat::addref
          o Mat::release
          o Mat::resize
          o Mat::reserve
          o Mat::push_back
          o Mat::pop_back
          o Mat::locateROI
          o Mat::adjustROI
          o Mat::operator()
          o Mat::operator CvMat
          o Mat::operator IplImage
          o Mat::total
          o Mat::isContinuous
          o Mat::elemSize
          o Mat::elemSize1
          o Mat::type
          o Mat::depth
          o Mat::channels
          o Mat::step1
          o Mat::size
          o Mat::empty
          o Mat::ptr
          o Mat::at
          o Mat::begin
          o Mat::end
          o Mat_
          o NAryMatIterator
          o SparseMat
          o SparseMat_
    * Basic C Structures and Operations
          o CvPoint
          o CvPoint2D32f
          o CvPoint3D32f
          o CvPoint2D64f
          o CvPoint3D64f
          o CvSize
          o CvSize2D32f
          o CvRect
          o CvScalar
          o CvTermCriteria
          o CvMat
          o CvMatND
          o CvSparseMat
          o IplImage
          o CvArr
          o ClearND
          o CloneImage
          o CloneMat
          o CloneMatND
          o CloneSparseMat
          o ConvertScale
          o Copy
          o CreateData
          o CreateImage
          o CreateImageHeader
          o CreateMat
          o CreateMatHeader
          o CreateMatND
          o CreateMatNDHeader
          o CreateSparseMat
          o CrossProduct
          o DotProduct
          o Get?D
          o GetCol(s)
          o GetDiag
          o GetDims
          o GetDimSize
          o GetElemType
          o GetImage
          o GetImageCOI
          o GetImageROI
          o GetMat
          o GetNextSparseNode
          o GetRawData
          o GetReal?D
          o GetRow(s)
          o GetSize
          o GetSubRect
          o DecRefData
          o IncRefData
          o InitImageHeader
          o InitMatHeader
          o InitMatNDHeader
          o InitSparseMatIterator
          o Mat
          o Ptr?D
          o ReleaseData
          o ReleaseImage
          o ReleaseImageHeader
          o ReleaseMat
          o ReleaseMatND
          o ReleaseSparseMat
          o ResetImageROI
          o Reshape
          o ReshapeMatND
          o Set
          o Set?D
          o SetData
          o SetImageCOI
          o SetImageROI
          o SetReal?D
          o SetZero
          o mGet
          o mSet
          o SetIPLAllocators
          o RNG
          o RandArr
          o RandInt
          o RandReal
          o fromarray
    * Dynamic Structures
          o CvMemStorage
          o CvMemBlock
          o CvMemStoragePos
          o CvSeq
          o CvSlice
          o CvSet
          o CvGraph
          o CvGraphScanner
          o CvTreeNodeIterator
          o ClearGraph
          o ClearMemStorage
          o ClearSeq
          o ClearSet
          o CloneGraph
          o CloneSeq
          o CreateChildMemStorage
          o CreateGraph
          o CreateGraphScanner
          o CreateMemStorage
          o CreateSeq
          o CreateSet
          o CvtSeqToArray
          o EndWriteSeq
          o FindGraphEdge
          o FindGraphEdgeByPtr
          o FlushSeqWriter
          o GetGraphVtx
          o GetSeqElem
          o GetSeqReaderPos
          o GetSetElem
          o GraphAddEdge
          o GraphAddEdgeByPtr
          o GraphAddVtx
          o GraphEdgeIdx
          o GraphRemoveEdge
          o GraphRemoveEdgeByPtr
          o GraphRemoveVtx
          o GraphRemoveVtxByPtr
          o GraphVtxDegree
          o GraphVtxDegreeByPtr
          o GraphVtxIdx
          o InitTreeNodeIterator
          o InsertNodeIntoTree
          o MakeSeqHeaderForArray
          o MemStorageAlloc
          o MemStorageAllocString
          o NextGraphItem
          o NextTreeNode
          o PrevTreeNode
          o ReleaseGraphScanner
          o ReleaseMemStorage
          o RestoreMemStoragePos
          o SaveMemStoragePos
          o SeqElemIdx
          o SeqInsert
          o SeqInsertSlice
          o SeqInvert
          o SeqPop
          o SeqPopFront
          o SeqPopMulti
          o SeqPush
          o SeqPushFront
          o SeqPushMulti
          o SeqRemove
          o SeqRemoveSlice
          o SeqSearch
          o SeqSlice
          o SeqSort
          o SetAdd
          o SetNew
          o SetRemove
          o SetRemoveByPtr
          o SetSeqBlockSize
          o SetSeqReaderPos
          o StartAppendToSeq
          o StartReadSeq
          o StartWriteSeq
          o TreeToNodeSeq
    * Operations on Arrays
          o abs
          o absdiff
          o add
          o addWeighted
          o bitwise_and
          o bitwise_not
          o bitwise_or
          o bitwise_xor
          o calcCovarMatrix
          o cartToPolar
          o checkRange
          o compare
          o completeSymm
          o convertScaleAbs
          o countNonZero
          o cvarrToMat
          o dct
          o dft
          o divide
          o determinant
          o eigen
          o exp
          o extractImageCOI
          o flip
          o gemm
          o getConvertElem
          o getOptimalDFTSize
          o idct
          o idft
          o inRange
          o invert
          o log
          o LUT
          o magnitude
          o Mahalanobis
          o max
          o mean
          o meanStdDev
          o merge
          o min
          o minMaxLoc
          o mixChannels
          o mulSpectrums
          o multiply
          o mulTransposed
          o norm
          o normalize
          o PCA
          o PCA::PCA
          o PCA::operator ()
          o PCA::project
          o PCA::backProject
          o perspectiveTransform
          o phase
          o polarToCart
          o pow
          o RNG
          o RNG::RNG
          o RNG::next
          o RNG::operator T
          o RNG::operator ()
          o RNG::uniform
          o RNG::gaussian
          o RNG::fill
          o randu
          o randn
          o randShuffle
          o reduce
          o repeat
          o scaleAdd
          o setIdentity
          o solve
          o solveCubic
          o solvePoly
          o sort
          o sortIdx
          o split
          o sqrt
          o subtract
          o SVD
          o SVD::SVD
          o SVD::operator ()
          o SVD::compute
          o SVD::solveZ
          o SVD::backSubst
          o sum
          o theRNG
          o trace
          o transform
          o transpose
    * Drawing Functions
          o circle
          o clipLine
          o ellipse
          o ellipse2Poly
          o fillConvexPoly
          o fillPoly
          o getTextSize
          o InitFont
          o line
          o LineIterator
          o rectangle
          o polylines
          o putText
    * XML/YAML Persistence
          o XML/YAML file storages. Writing to a file storage.
          o Reading data from a file storage.
          o FileStorage
          o FileNode
          o FileNodeIterator
    * XML/YAML Persistence (C API)
          o CvFileStorage
          o CvFileNode
          o CvAttrList
          o CvTypeInfo
          o Clone
          o EndWriteStruct
          o FindType
          o FirstType
          o GetFileNode
          o GetFileNodeByName
          o GetFileNodeName
          o GetHashedKey
          o GetRootFileNode
          o Load
          o OpenFileStorage
          o Read
          o ReadByName
          o ReadInt
          o ReadIntByName
          o ReadRawData
          o ReadRawDataSlice
          o ReadReal
          o ReadRealByName
          o ReadString
          o ReadStringByName
          o RegisterType
          o Release
          o ReleaseFileStorage
          o Save
          o StartNextStream
          o StartReadRawData
          o StartWriteStruct
          o TypeOf
          o UnregisterType
          o Write
          o WriteComment
          o WriteFileNode
          o WriteInt
          o WriteRawData
          o WriteReal
          o WriteString
    * Clustering
          o kmeans
          o partition
    * Utility and System Functions and Macros
          o alignPtr
          o alignSize
          o allocate
          o deallocate
          o fastAtan2
          o cubeRoot
          o Ceil
          o Floor
          o Round
          o IsInf
          o IsNaN
          o CV_Assert
          o error
          o Exception
          o fastMalloc
          o fastFree
          o format
          o checkHardwareSupport
          o getNumThreads
          o getThreadNum
          o getTickCount
          o getTickFrequency
          o getCPUTickCount
          o saturate_cast
          o setNumThreads
          o setUseOptimized
          o useOptimized

Fonctions du module improc

    * Image Filtering
          o BaseColumnFilter
          o BaseFilter
          o BaseRowFilter
          o FilterEngine
          o bilateralFilter
          o blur
          o borderInterpolate
          o boxFilter
          o buildPyramid
          o copyMakeBorder
          o createBoxFilter
          o createDerivFilter
          o createGaussianFilter
          o createLinearFilter
          o createMorphologyFilter
          o createSeparableLinearFilter
          o dilate
          o erode
          o filter2D
          o GaussianBlur
          o getDerivKernels
          o getGaussianKernel
          o getKernelType
          o getStructuringElement
          o medianBlur
          o morphologyEx
          o Laplacian
          o pyrDown
          o pyrUp
          o pyrMeanShiftFiltering
          o sepFilter2D
          o Smooth
          o Sobel
          o Scharr
    * Geometric Image Transformations
          o convertMaps
          o getAffineTransform
          o getPerspectiveTransform
          o getRectSubPix
          o getRotationMatrix2D
          o invertAffineTransform
          o LogPolar
          o remap
          o resize
          o warpAffine
          o warpPerspective
          o initUndistortRectifyMap
          o getDefaultNewCameraMatrix
          o undistort
          o undistortPoints
    * Miscellaneous Image Transformations
          o adaptiveThreshold
          o cvtColor
          o distanceTransform
          o floodFill
          o inpaint
          o integral
          o threshold
          o watershed
          o grabCut
    * Histograms
          o calcHist
          o calcBackProject
          o compareHist
          o EMD
          o equalizeHist
          o Extra Histogram Functions (C API)
          o CalcBackProjectPatch
          o CalcProbDensity
          o ClearHist
          o CopyHist
          o CreateHist
          o GetHistValue*D
          o GetMinMaxHistValue
          o MakeHistHeaderForArray
          o NormalizeHist
          o QueryHistValue*D
          o ReleaseHist
          o SetHistBinRanges
          o ThreshHist
          o CalcPGH
    * Structural Analysis and Shape Descriptors
          o moments
          o HuMoments
          o findContours
          o drawContours
          o approxPolyDP
          o ApproxChains
          o arcLength
          o boundingRect
          o contourArea
          o convexHull
          o ConvexityDefects
          o fitEllipse
          o fitLine
          o isContourConvex
          o minAreaRect
          o minEnclosingCircle
          o matchShapes
          o pointPolygonTest
    * Planar Subdivisions (C API)
          o CvSubdiv2D
          o CvQuadEdge2D
          o CvSubdiv2DPoint
          o CalcSubdivVoronoi2D
          o ClearSubdivVoronoi2D
          o CreateSubdivDelaunay2D
          o FindNearestPoint2D
          o Subdiv2DEdgeDst
          o Subdiv2DGetEdge
          o Subdiv2DNextEdge
          o Subdiv2DLocate
          o Subdiv2DRotateEdge
          o SubdivDelaunay2DInsert
    * Motion Analysis and Object Tracking
          o accumulate
          o accumulateSquare
          o accumulateProduct
          o accumulateWeighted
    * Feature Detection
          o Canny
          o cornerEigenValsAndVecs
          o cornerHarris
          o cornerMinEigenVal
          o cornerSubPix
          o goodFeaturesToTrack
          o HoughCircles
          o HoughLines
          o HoughLinesP
          o preCornerDetect
    * Object Detection
          o matchTemplate

Fonctions du module

    * User Interface
          o createTrackbar
          o getTrackbarPos
          o imshow
          o namedWindow
          o destroyWindow
          o destroyAllWindows
          o MoveWindow
          o ResizeWindow
          o SetMouseCallback
          o setTrackbarPos
          o waitKey
    * Reading and Writing Images and Video
          o imdecode
          o imencode
          o imread
          o imwrite
          o VideoCapture
          o VideoCapture::VideoCapture
          o VideoCapture::open
          o VideoCapture::isOpened
          o VideoCapture::release
          o VideoCapture::grab
          o VideoCapture::retrieve
          o VideoCapture::read
          o VideoCapture::get
          o VideoCapture::set
          o VideoWriter
          o VideoWriter::VideoWriter
          o ReleaseVideoWriter
          o VideoWriter::open
          o VideoWriter::isOpened
          o VideoWriter::write
    * Qt New Functions
          o setWindowProperty
          o getWindowProperty
          o fontQt
          o addText
          o displayOverlay
          o displayStatusBar
          o createOpenGLCallback
          o saveWindowParameters
          o loadWindowParameters
          o createButton

Fonctions du module