Getting Started with OpenCV provides an overview of OpenCV and demonstrates a basic OpenCV program. It discusses OpenCV's structure, loading and saving images, creating windows and trackbars, and using OpenCV with Intel's Integrated Performance Primitives for accelerated computer vision functions. The document contains code samples and explains how to compile, build, and run OpenCV programs on Windows and Linux.
6. OpenCV structure CXCORE basic structures and algoritms, XML support, drawing functions CV Image processing and vision algorithms HighGUI GUI, Image and Video I/O We will mostly focus on these two in this presentation
20. Using OpenCV in User Apps (III) Case 3. Visualization inside some test program (hypothetical example,yet quite real too). // was … /* some image processing code containing bug */ … // has been converted to … … /* at this point we have the results */ #if VISUALIZE #include <highgui.h> #pragma comment(“lib”,”cxcore.lib”) #pragma comment(“lib”,”highgui.lib”) CvMat hdr; cvInitMatHeader (&hdr,200/*height*/,320/*width*/,CV_8UC3, data_ptr); CvMat* vis_copy=cvCloneMat(&hdr); cvNamedWindow(“test”,1); cvCircle (vis_copy, cvCenter(bug_x,bug_y), 30, CV_RGB(255,0,0), 3, CV_AA ); // mark the suspicious area cvShowImage(“test”,vis_copy); cvWaitKey (0 /* or use some delay, e.g. 1000 */); // cvSaveImage( “buggy.png”, vis_copy ); // if need, save for post-mortem analysis // cvDestroyWindow (“test”); // if need #endif
21.
22. Using OpenCV with IPP #include <cv.h> #include <highgui.h> #include <ipp.h> #include <stdio.h> int main(int,char**){ const int M=3; IppiSize msz={M,M}; IppiPoint ma={M/2,M/2}; IplImage* img=cvLoadImage(“lena.jpg”,1); IplImage* med1= cvCreateImage (cvGetSize(img),8,3); IplImage* med2= cvCloneImage (med1); int64 t0 = cvGetTickCount() ,t1,t2; IppiSize sz = {img->width-M+1,img->height-M+1}; double isz=1./(img->width*img->height); cvSmooth (img,med1,CV_MEDIAN,M); // use IPP via OpenCV t0= cvGetTickCount ()-t0; cvUseOptimized (0); // unload IPP t1 = cvGetTickCount (); cvSmooth (img,med1,CV_MEDIAN,M); // use C code t1= cvGetTickCount ()-t1; t2= cvGetTickCount (); ippiMedianFilter_8u_C3R ( // use IPP directly & CV_IMAGE_ELEM (img,uchar,M/2,M/2*3), img->widthStep, & CV_IMAGE_ELEM (med1,uchar,M/2,M/2*3), med1->widthStep, sz, msz, ma ); t2= cvGetTickCount ()-t2; printf(“t0=%.2f, t1=%.2f, t2=%.2f”, (double)t0*isz,(double)t1*isz,(double)t2*isz); return 0; } Triple 3x3 median filter