OpenCV Open source C omputer V ision library By: Bahare Torkaman Fall 2010.

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

1 C++Tutorial Rob Jagnow This tutorial will be best for students who have at least had some exposure to Java or another comparable programming language.
Compilation and Debugging 101. Compilation in C/C++ hello.c Preprocessor Compiler stdio.h tmpXQ.i (C code) hello.o (object file)
Tutorial on Matlab and OpenCV Rui Ma TA of CMPT 414 May 14, 2013 Office hours: Fridays 11:00-12:00, CSIL TA Office 1 (ASB 9838)
C Language.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Chapter 7 Process Environment Chien-Chung Shen CIS, UD
Objectives Define photo editing software
Gavin S Page OpenCV Tutorial Part II Loading Images and Using Histograms 29 November 2005.
Introduction to OpenCV Dr. Chung-Hao Chen Haole Guo Sep 2011.
OpenCV Training course
1 Pointers A pointer variable holds an address We may add or subtract an integer to get a different address. Adding an integer k to a pointer p with base.
Strings and Dynamic Memory Allocation CS-2301, B-Term Programming Assignment #6 Strings and Dynamic Memory Allocation CS-2301, System Programming.
Gavin S Page OpenCV Tutorial Part I Using OpenCV with Microsoft Visual Studio.net November 2005.
Gavin S Page OpenCV Tutorial Part IV A Brief Guide to Memory Management (and other Miscellaneous Functions) 02 December 2005.
*Third party marks and brands are the property of their respective owners Getting Started with OpenCV Yue Gao CS 4758/6758 Robot Learning
Fortran 9x HTML version. New F90 features Free source form Modules User-defined data types and operators Generic user-defined procedures Interface blocks.
C++ for Engineers and Scientists Third Edition
Guide To UNIX Using Linux Third Edition
COMP1170 Midterm Preparation (March 17 th 2009) Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education.
C Programming. C vs C++ C syntax and C++ syntax are the same but... C is not object oriented * There is no string class * There are no stream objects.
Chapter 12 Pointers and linked structures. 2 Introduction  The data structures that expand or contract as required during the program execution is called.
C++ Tutorial Rob Jagnow. Overview Pointers Arrays and strings Parameter passing Class basics Constructors & destructors Class Hierarchy Virtual Functions.
L.
Filtering (I) Dr. Chang Shu COMP 4900C Winter 2008.
OPENCV TUTORIAL OpenCV Windows 7 Microsoft Visual C++ Express 2010.
1 INF160 IS Development Environments AUBG, COS dept Lecture 06 Title: Dev Env: Code::Blocks (Extract from Syllabus) Reference:
Computing IV Visual C Introduction with OpenCV Example Xinwen Fu.
Software Resources Multimodal Interaction Dr. Mike Spann
chap13 Chapter 13 Programming in the Large.
Detect Candle.  Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories  Choose "Show directories for: Include.
Multimedia Programming 02: Play with Images Departments of Digital Contents Sang Il Park.
Variables, Functions & Parameter Passing CSci 588 Fall 2013 All material not from online sources copyright © Travis Desell, 2011.
Multimedia Programming 03: Point Processing Departments of Digital Contents Sang Il Park.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
L. Akshay Masare Piyush Awasthi IMAGE PROCESSING AND OPENCV.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
Web Design (7) Images (1). Images and the Image Element Images can be placed in the flow of text..jpg,.png and.gif image files work in web pages The img.
Multimedia Programming 13: Review and term project Departments of Digital Contents Sang Il Park.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 26: Exam 2 Preview.
File ▪ File – Unit of logical storage – Aid in manipulating exact sector of file data ▪ Abstract view of secondary physical storage devices ▪ Without files.
Introduction of OpenCV Alireza Shirani Researcher of Medical Image and Signal Processing M. S Electrical Engineering yahoo. com Spring.
C++ language first designed or implemented In 1980 by Bjarne Stroustrup, from Bell labs. that would receive formally this name at the end of 1983.
APS105 Strings. C String storage We have used strings in printf format strings –Ex: printf(“Hello world\n”); “Hello world\n” is a string (of characters)
1 Chapter 12 GUI C/C++ Language Programming Wanxiang Che.
Copyright 2005, The Ohio State University 1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation.
Adobe Photoshop CS5 – Illustrated Unit A: Getting Started with Photoshop CS5.
CSE 232: C++ memory management Overview of Arrays Arrays are the simplest kind of data structure –One item right after another in memory (“contiguous range”
Getting to Know OpenCV 主講人:虞台文. Content Basic Structures Arrays, Matrices, and Images Matrix and Image Operators Drawing Things Drawing Text Data Persistence.
CS415 C++ Programming Takamitsu Kawai x4212 G11 CERC building WV Virtual Environments Lab West Virginia University.
Lecture 10: 2/17/2003CS148 Spring CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Adobe Photoshop CS4 – Illustrated Unit A: Getting Started with Photoshop CS4.
How to install JavaCV in Eclipse. Make sure to download and install all these before you proceed Eclipse for Java EE developers (current is Juno)
Arrays Chap. 9 Storing Collections of Values 1. Introductory Example Problem: Teachers need to be able to compute a variety of grading statistics for.
1 Network Access to Charm Programs: CCS Orion Sky Lawlor 2003/10/20.
Optical Flow walk through Aidean Sharghi Spring 14.
Chapter 7 Process Environment Chien-Chung Shen CIS/UD
Hank Childs, University of Oregon April 13 th, 2016 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / / /
OpenCV C++ Image Processing
Development Environment Setup
CSC391/691 Intro to OpenCV Dr. Rongzhong Li Fall 2016
OpenCV Tutorial Part I Using OpenCV with Microsoft Visual Studio .net November 2005 Gavin S Page
5.13 Recursion Recursive functions Functions that call themselves
Command line arguments
A Quick Introduction to the C Interface By David Johnston
Pointers.
Pointers.
Pointers.
FISH IDENTIFICATION SYSTEM
Presentation transcript:

OpenCV Open source C omputer V ision library By: Bahare Torkaman Fall 2010

General description  Open source computer vision library in C/C++  High level functions for computer vision and image processing  Both low and high level API  Optimized and intended for real-time applications OpenCV modules:  cv - Main OpenCV functions.  cvaux - Auxiliary (experimental) OpenCV functions.  cxcore - Data structures and linear algebra support.  highgui - GUI functions.

Resources Official webpage:  Software download:  Books: Learning OpenCV by Gary R. Bradski and Adrian Pisarevsky, O’Reilly (September 2008: First Edition)

Other webpages:

Installation OpenCV win32-vs2008

Installation

Configuration

New project

Add library

cv210.lib cvaux210.lib cxcore210.lib cxts210.lib highgui210d.lib ml210d.lib opencv_ffmpeg210d.lib cv210d.lib cvaux210d.lib cxcore210d.lib highgui210.lib ml210.lib opencv_ffmpeg210.lib Add library

 Tools  options  project and solutions  vc++ directories   executable files  C:\OpenCV2.1\bin  Include files  C:\OpenCV2.1\include\opencv  Library files  C:\OpenCV2.1\lib  File  new project  win32  win32 console application  application settings  empty project … project  add new item  c++ file(.cpp)  Project  properties  configuration properties  linker  input  additional dependencies  cv210.lib cvaux210.lib cxcore210.lib cxts210.lib highgui210d.lib ml210d.lib opencv_ffmpeg210d.lib cv210d.lib cvaux210d.lib cxcore210d.lib highgui210.lib ml210.lib opencv_ffmpeg210.lib

#include int main() { IplImage* img = cvLoadImage("C:\\orangeman.jpg"); cvNamedWindow("Original"); cvShowImage("Original", img); // We add processing code here cvWaitKey(0); cvReleaseImage(&img); return 0; } Load a picture Load video Load camera cut a piece of image

#include IplImage *frame = 0,*flip=0; int main() { CvCapture* capture = 0; capture = cvCaptureFromFile("C:\\cap2.avi"); if(!capture) { printf("Could not initialize capturing...\n"); return -1; } while(true) {IplImage* frame = 0; frame = cvQueryFrame(capture); if(!frame) break; cvShowImage("video", frame); //cvFlip(frame,flip,0); cvShowImage("flip", frame); int c = cvWaitKey(20); if((char)c==27 ) break; } cvReleaseCapture(&capture); return 0; } Load a picture Load video Load camera cut a piece of image

#include #include "cv.h" #include "highgui.h" IplImage *frame = 0,*capture= 0; int main( int argc, char **argv ) { CvCapture *capture =cvCreateCameraCapture(-1); IplImage *img; while(1) { img=cvQueryFrame(capture); if(!img)break; cvShowImage("Original", img); char c=cvWaitKey(33); if(c==27) break; } cvReleaseCapture(&capture); cvDestroyWindow("Original"); return 0; } Load a picture Load video Load camera cut a piece of image

#include int main() { CvCapture* capture = 0; capture = cvCaptureFromCAM(0); while(true) { IplImage* frame = 0; frame = cvQueryFrame(capture); if(!frame) break; cvShowImage("video", frame); cvSetImageROI( frame, cvRect( 10,60, 100,200 ) ); IplImage *img2 = cvCreateImage (cvGetSize(frame),frame->depth,frame->nChannels); cvCopy( frame, img2 ); cvShowImage("video2", img2); cvResetImageROI( frame ); int c = cvWaitKey(20); if((char)c==27 ) break; } cvReleaseCapture(&capture); return 0; } Load a picture Load video Load camera cut a piece of image

 This structure, called IplImage  OpenCV uses this structure to handle all kinds of images: single-channel, multichannel, integer-valued, floating-point- valued, et cetera. IplImage  is a high-level routine  determines the file format to be loaded based on the file name  automatically allocates the memory needed for the image data structure  can read a wide variety of image formats: BMP,DIB,JPEG, JPE,PNG,PBM,PGM,PPM,SR,RAS, and TIFF cvLoadImage()

 Opens a window on the screen that can contain and display an image  provided by the HighGUI library  Assigns a name to the window  The second argument to cvNamedWindow() defines window properties →0 (the default value) : size of the window ↔ image size image will be scaled to fit within the window →CV_WINDOW_AUTOSIZE : the window will expand or contract automatically when an image is loaded so as to accommodate the image’s true size image in the form of an IplImage* pointer cvNamedWindow()

 The cvShowImage() function requires that a named window already exist (created by cvNamedWindow()) cvShowImage()  asks the program to stop and wait for a keystroke  argument:  positive : the program will wait for that number of milliseconds and then continue even if nothing is pressed  Zero or negative: the program will wait indefinitely for a keypress cvWaitKey(0)

 OpenCV expects a pointer to the IplImage* pointer for this operation  After the call is completed, the pointer img will be set to NULL  free the allocated memory cvReleaseImage( &img )  close the window  de-allocate any associated memory usage cvDestroyWindow()  free the memory associated with the CvCapture structure  close any open file handles to the AVI file cvReleaseCapture(&capture)

 cvQueryFrame() takes as its argument a pointer to a CvCapture structure  grabs the next video frame into memory (memory that is actually part of the CvCapture structure) cvQueryFrame()  index:  If there is only one camera or it does not matter what camera to use -1 may be passed  this is important only when multiple cameras are available cvCreateCameraCapture ( int index )

 Flip an array about a selected axis, around the x-axis, the y-axis, or both  the argument flip_mode is set to:  0: image will be flipped around the x-axis  positive: image will be flipped around the y-axis  negative: image will be flipped around both axis  cvSetImageROI(src1, cvRect(x,y,width,height));  Given a rectangular subregion of interest  “turn off ” by cvResetImageROI() cvSetImageROI cvFlip

(int x, int y) Int width Int height cvSetImageROI

 void cvCopy(const CvArr* src,CvArr* dst,const CvArr* mask = NULL);  Copy elements of one array to another  The cvCopy() function expects both arrays to have the same type, the same size, and the same number of dimensions  cvGetSize (const CvArr* arr )  Get size of a two-dimensional array and return as CvSize cvGetSize cvCopy

?????????

OpenCV Open source C omputer V ision library By: Bahare Torkaman Fall 2010