OPENCV 小引 - jdl.ac.cn 引.pdf · PDF file• OPENCV的编译 • OPENCV的使用. 2.2 OPENCV的使用 • 从windows visual studio

  • Upload
    dominh

  • View
    338

  • Download
    56

Embed Size (px)

Citation preview

  • OPENCV

    2006-06-02

  • OPENCV OPENCV OPENCV

  • 1 OPENCV

    OPENCV OPENCV OPENCV

  • OPENCV

    OPENCV= Intel (c) Open source computer vision library

    OpenCV Intel

  • OpenCV300c/c++,3D

    2000505000

  • 1 OPENCV

    OPENCV OPENCV OPENCV

  • 1.2 OPENCV

    INTEl

  • 1.2 OPENCV

    / Matlab visDSK IPL openCV IPP

  • 1.2 OPENCV

    Matlab

    MATCOM

  • 1.2 OPENCV

    Matlab visDSK MICROSOFT

    openCVVISDSK

    OPENCopenCVintel

  • 1.2 OPENCV

    IPL---INTEL openCVINTEL IPP--INTEL

  • OPENCVIPL

    IPL

    Intel IPL image library

    PCIntelCPU

  • IPLImage creation and access Image arithmetic and logic

    operations.Image filtering.Linear image transformation.Image morphology.

    Color space conversion. Image histogram and

    thresholding. Geometric transformation

    (zoom-decimate, rotate, mirror, shear, warp, perspective transform, affine transform).

    Image moments.

  • OPENCV

    OpenCV OpenCV API

  • OPENCV

    IPL INTEL OpenCV IplImage

  • IPP

    IPP

  • Intel Integrated Performance Primitives (Intel IPP)

    is a library of thousands of multi-core-ready, highly optimized software functions for multimedia and data processingapplications, including:

  • IPP

    OpenCV Intel Integrated Performance Primitives (IPP) IPP IPP http://www.intel.com/software/products/ipp/index.htm

  • IPP Video Decode/Encode

    Image ProcessingAudio Decode/Encode

    JPEG Decode/EncodeImage Color Conversion

    Speech Recognition Computer Vision

    Speech Decode/EncodeData Compression

    Vector MathematicsString Processing

    Matrix MathematicsSignal Processing

    Cryptography

  • IPL

    OPENCV IPP

  • IPL/OPENCV/IPP

    IPLOPENCV IPLIPP OPENCVIPPIPL

  • OPENCV

    BUG?

  • OpenCV

    INTEL

    OpencvIPL

  • 1 OPENCV

    OPENCV OPENCV OPENCV

  • 1.3

    windows/linux

  • 1.3

    Opencv, windows

  • OPENCV OPENCV OPENCV

  • 2 OPENCV

    OPENCV OPENCV OPENCV

  • 2.1 OPENCV

  • 2 OPENCV

    OPENCV OPENCV OPENCV

  • 2.2 OPENCV

  • Win32 Debug

    libdll

  • 2 OPENCV

    OPENCV OPENCV OPENCV

  • 2.2 OPENCV

    windows visual studioOPENCV

    OPENCV

    libdll

  • Opencv dir\cxcore\include

    Opencv dir\cv\include

    Opencv dir\otherlibs\highgui

    Opencv dir\cvaux\include

  • OpenCV dir\lib,

    Opencv dir\otherlibs\highgui

    OpenCV dir\bin

  • debug

  • General

    cvd.libhighguid.libcvauxd.libcxcored.lib

  • Release Link tab -> Generalcategory -> Object/library modules

    cv.lib highgui.lib cvaux.lib cxcore.lib

  • OpenCV dir\binPATH

  • opencv

  • OPENCV OPENCV OPENCV

  • OPENCV

    / //size/

  • //size/

    typedef struct CvPoint { int x; /* x-coordinate, usually zero-based */ int y;/* y-coordinate, usually zero-based */ } CvPoint; /* the constructor function */ inline CvPoint cvPoint( int x, int y );

    2/3/

  • typedef struct tagPOINT { LONG x; LONG y; } POINT, *PPOINT; CPoint( int initX, int initY ) throw( );

  • opencvwindows

    CvSizeCvRectCvScalar windows

  • OPENCV

    //size/

  • Iplimage

  • I/O

  • Iplimage

    CvvImage IplImage* m_img; Create( int width, int height, int bits_per_pixel, int

    image_origin = 0 ); Load( const char* filename, int desired_color = 1 ); Save( const char* filename ); CopyOf( CvvImage& image, int desired_color = -

    1 );

  • CvvImage

    IplImage* GetImage() { return m_img; }; Width() Height() Show( const char* window ); Show( HDC dc, int x, int y, int width, int height, int from_x = 0, int from_y = 0 ); DrawToHDC( HDC hDCDst, RECT* pDstRect );

  • Iplimage *srcimg;

    for(int y = 0; y < srcimg->height; y++ ){for(int x = 0; x < srcimg->width; x++ ) {

    B = ((uchar*) (srcimg->imageData + y * srcimg- >widthStep))[x*3];

    G =((uchar*) (srcimg->imageData + y * srcimg->widthStep))[x*3+1];

    R = ((uchar*) (srcimg->imageData + y * srcimg->widthStep))[x*3+2];}

    }

  • opencv Show( const char* window ); Show( HDC dc, int x, int y, int width, int height, int

    from_x = 0, int from_y = 0 ); DrawToHDC( HDC hDCDst, RECT* pDstRect );

  • windows LPBITMAPINFO lpbminfo; lpbminfo=(LPBITMAPINFO) new char[sizeof(BITMAPINFOHEADER)

    +256 * sizeof(RGBQUAD)]; lpbminfo->bmiHeader.biSize = 40; lpbminfo->bmiHeader.biWidth = m_nImageWidth; lpbminfo->bmiHeader.biHeight = m_nImageHeight; StretchDIBits(hDC, 0, 0, m_nImageWidth,m_nImageHeight, 0, 0, m_nImageWidth, m_nImageHeight, iplShowImage->imageData, lpbminfo,

    DIB_RGB_COLORS, SRCCOPY);

  • ROI

    ROIregion of interest IplmageROIROI

  • I/O

    Video I/O functions CvCapture typedef struct CvCapture { CvCaptureVTable* vtable; } CvCapture;

  • typedef struct CvCaptureVTable { int count; CvCaptureCloseFunc close; CvCaptureGrabFrameFunc grab_frame; CvCaptureRetrieveFrameFunc retrieve_frame; CvCaptureGetPropertyFunc get_property; CvCaptureSetPropertyFunc set_property; CvCaptureGetDescriptionFunc get_description; } CvCaptureVTable;

  • I/O

  • I/O

  • SDKOPENCV

    BYTE *lpstream = (BYTE *) AVIStreamGetFrame(pGetFrame, i); pBufImage = cvCreateImage(cvSize(m_nImageWidth,

    m_nImageHeight), IPL_DEPTH_8U, 3); long

    m_nImageSize=linewidth*m_nImageHeight; memcpy(pBufImage->imageData, lpstream, m_nImageSize);

  • OPENCV

    //size/

  • CvMat

  • 32-bit floating point real matrix M (CvMat* mat): M(i,j) ((float*)(mat->data.ptr + mat->step*i))[j]

  • to to

  • to Iplimage * srcimgCvMat srcstub, *srcarr = (CvMat*)srcimg;srcarr = cvGetMat( srcarr, &srcstub);src_step=srcarr->step; src_cols=srcarr-

    >cols;src_rows=srcarr->rows;uchar * src, * srcrow;for(int y = 0; y < src_rows; y++ ) {

    srcrow=(uchar*) (srcarr->data.ptr + y * src_step);for(int x = 0; x < src_cols; x++ ) {

    src=(uchar*) (srcrow+3*x);B = (*src);G= (*(src+1));R= (*(src+2));}

    }

  • to IplImage* cvGetImage ( const CvArr* arr, IplImage* image_header );

  • OPENCV

    //size/

  • OPENCV highgui

  • highguistring windows

  • OPENCV

    //size/

  • Contour Processing Geometryconvex hull

    Features: 1/2Canny,Hough

    Image StatisticsIn region of interest: Count, Mean, STD, Min, Max, Norm, Moments, Hu Moments

  • Image Pyramids MorphologyErode, dilate, open, close.

    Gradient, top-hat, black-hat Background Differencing

  • Distance Transform Thresholding Flood Fill4 and 8 connected View Morphing

  • Motion Templates CAMSHIFT Active Contours snake Optical Flow Estimators POSIT Histogram (recognition)

  • Gesture Recognition Stereo based: Finding hand, hand mask. Image homography, bounding box.

    Matrix Matrix Math: SVD, inverse, cross-product, Mahalanobis, eigen values and vectors. Perspective projection.

  • Eigen Objects Calc Cov Matrix, Calc Eigen objects, decomp. coeffs. Decomposition and projection.

    embedded HMMs Drawing Primatives Line, rectangle,

    circle, ellipse, polygon. Text on images.

  • OPENCV

    //size/

  • http://sourceforge.net/projects/opencvlibrary/ OpenCV

  • YAHOO OPENCV http://www.yahoogroups.com/group/Open

    CVOpenCV

  • INTELOPENCV http://www.intel.com/research/mrl/research/o

    pencv/ CMU

    http://www-2.cs.cmu.edu/afs/cs/project/cil/ftp/html/vision.html

  • OPENCV http://www.assuredigit.com//incoming/sour

    cecode/opencv/chinese_docs/index.htm OPENCV http://www.assuredigit.com//incoming/sour

    cecode/opencv/chinese_docs/faq.htm

  • IPl?