opencv pres

Upload: mustafa-arif

Post on 09-Apr-2018

255 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 OpenCV Pres

    1/29

  • 8/7/2019 OpenCV Pres

    2/29

    OpenCV stands for Open Source ComputerVision Library

    Includes over 500 functions implementingcomputer vision, image processing andgeneral purpose numeric algorithms.

    Portable and very efficient (implemented in

    C/C++) Absolutely free for academic and commercial

    use Available at http://sourceforge.net/projects/opencvlibrary

    What is OpenCV

  • 8/7/2019 OpenCV Pres

    3/29

    Computer Vision Market is large and continues to grow.There is no standard API (like OpenGL and DirectX ingraphics, or OpenSSL in cryptography), most of CV

    software is of 3 kinds:

    1. Research code (slow, unstable,independent/incompatible data types)

    2. Very expensive commercial toolkits (like Halcon,

    MATLAB+Simulink, )3. Specialized solutions bundled with hardware (Video

    surveillance, Manufacturing control systems, Medicalequipment )

    Why OpenCV?

  • 8/7/2019 OpenCV Pres

    4/29

    To develop a universal toolbox for research and

    development in the field of Computer Vision.

    Standard library would simplify development of

    new applications and solutions much easier.

    Special optimization for Intel Architectures.

    Why OpenCV?

  • 8/7/2019 OpenCV Pres

    5/29

    Configuring MSVS .NET 2005

  • 8/7/2019 OpenCV Pres

    6/29

  • 8/7/2019 OpenCV Pres

    7/29

  • 8/7/2019 OpenCV Pres

    8/29

  • 8/7/2019 OpenCV Pres

    9/29

  • 8/7/2019 OpenCV Pres

    10/29

  • 8/7/2019 OpenCV Pres

    11/29

    The First Program using OpenCV

  • 8/7/2019 OpenCV Pres

    12/29

    1-23: The code is clear, short and cross-platform, no need to use with

    MFC/GTK/QT/, cross-platform1-2. Include OpenCV headers first7. IplImageis OpenCV image type7, 19. Use cvLoadImageand cvSaveImagetoload/save an image in multiple formats:JPEG, JPEG2000, BMP, PNG, TIFF, PPM.

    9. Use cvPointand otherconstructorfunctions to initialize simplestructures on fly.15. Use CV_IMAGE_ELEM macro toaccess image pixels16-18. Use cvRoundfor very fast

    float->int conversion.20. Use cvNamedWindowt o create self-updating highgui window21. Use cvShowImageto display image inwindow22. Use cvWaitKeyt o get input from user

    The Program Analysis Line by Line

  • 8/7/2019 OpenCV Pres

    13/29

    Library Architecture

  • 8/7/2019 OpenCV Pres

    14/29

    Reading/Writing images in several formats

    (BMP, JPEG, TIFF, PxM, Sun Raster).

    Creating windows and displaying images in it.

    HighGUI windows remember their content

    (no need to implement repainting callbacks).

    Simple interaction facilities: trackbars, getting

    input from keyboard and mouse.

    Highgui Library

  • 8/7/2019 OpenCV Pres

    15/29

    #include "highgui.h"

    #include "cv.h

    //main programIplImage * image;

    cvNamedWindow("exam", 1);

    CvCapture * cap = cvCaptureFromCAM(0);

    while(1)

    {

    image = cvQueryFrame(cap);CvScalar s;

    for(int i=100;i

  • 8/7/2019 OpenCV Pres

    16/29

    Matrix and Image Arithmetical and

    Logical Operations

    Linear algebra, DFT/DCT, vector math

    Dynamic structures

    Drawing functions

    XML I/O

    Cxcore Library

  • 8/7/2019 OpenCV Pres

    17/29

    It is possible to draw different shapes in

    an image (IplImage/CvMat):

    Lines, Circles, Ellipses, Elliptic Arcs

    Filled polygons or polygonal

    contours

    Text (using one of embedded fonts)

    Everything can be drawn with different

    colors, different line width.

    Using CXCORE + HighGUI you can visualize everything

  • 8/7/2019 OpenCV Pres

    18/29

    Cv and Cvaux Libraries

  • 8/7/2019 OpenCV Pres

    19/29

    Image filters,

    Morphology

    Pyramids

    Color space conversions

    Geometrical transformations Histograms.

    Basic Image Processing:

  • 8/7/2019 OpenCV Pres

    20/29

    Primitive operations:

    cvErode(A,C,B); cvDilate(A,C,B);

    Erosion:C(x,y)=minB(x,y)=1A(x+x,y+y)

    Dilation:

    C(x,y)=maxB(x,y)=1A(x+x,y+y)

    Erode/Dilate Example

  • 8/7/2019 OpenCV Pres

    21/29

    Corner detection

    Canny edge detector

    Hough transform

    Distance transform

    Watershed

    Inpainting

    etc.

    Advanced Image Processing and

    Feature extraction

  • 8/7/2019 OpenCV Pres

    22/29

    Feature Extraction: Canny Edge Detector

    Computing binary edge map from grayscale image: cvCanny(A,B,t1,t2);

    Assisting object segmentation Accelerating face detection

  • 8/7/2019 OpenCV Pres

    23/29

    Image moments

    Contours

    Delaunay triangulation

    Voronoi Diagram

    Shape analysis and Computational geometry

    Delaunay Triangulation

  • 8/7/2019 OpenCV Pres

    24/29

    Contours

    In OpenCV contours are extracted from black-n-whiteimages. Outer or internal boundaries of white areasare stored as polygons:cvFindContours(bw, storage, &contours);contours=cvApproxPoly (contours, params);

  • 8/7/2019 OpenCV Pres

    25/29

    Optical flow

    Object tracking (Meanshift& CAMSHIFT)

    Motion templates

    Kalman filters

    Motion Analysis

  • 8/7/2019 OpenCV Pres

    26/29

    Motion Analysis and Object Tracking

    Feature tracking: cvCalcOpticalFlowPyrLK

    Color object tracking: cvCamShift

    Motion templates: cvUpdateMotionHistory, cvCalcMotionGradient,

    cvCalcGlobalOrientation, cvSegmentMotion

  • 8/7/2019 OpenCV Pres

    27/29

    Statistical classification

    Regression

    ClusteringAlgorithms: SVM, kNN, Normal

    Bayesian classifier, Neural Nets

    (MLP), Decision Trees, Random

    Trees, Boosting, EM.

    ML Library

  • 8/7/2019 OpenCV Pres

    28/29

    Thank you

  • 8/7/2019 OpenCV Pres

    29/29