A Quick Introduction to the C Interface By David Johnston

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

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)
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
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.
Quark QuarkXPress 4 Foundation Level Course. What is QuarkXPress? This courseware teaches the fundamentals of QuarkXPress 4.1. It is a page layout application.
© 2010 IBM Corporation IBM Experience Modeler - Theme Editor Installing Python Image Library Presenter’s Name - Presenter’s Title DD Month Year.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
OpenCV Open source C omputer V ision library By: Bahare Torkaman Fall 2010.
Tulsa SharePoint User Group TulsaSPUG. Agenda Introductions (5 Minutes) Branding Review (25 Minutes) Site Overview (5 Minutes) Office 365 Provisioning.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Computing IV Visual C Introduction with OpenCV Example Xinwen Fu.
Detect Candle.  Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories  Choose "Show directories for: Include.
CSC 215 : Procedural Programming with C C Compilers.
Introduction Use of makefiles to manage the build process Declarative, imperative and relational rules Environment variables, phony targets, automatic.
Lecture Set 2 Part B – Configuring Visual Studio; Configuration Options and The Help System (scan quickly for future reference)
The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Engineering Computing I Chapter 1 – Part A A Tutorial Introduction.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Installation and Testing.
The Joy of Programming (also known as) Introduction to Object-Oriented Programming.
Image Processing 主講人:虞台文. Content Smoothing Image Morphology Some Applications of Image Morphology Flood Fill Resize Image Pyramids Threshold.
CS 390 Unix Programming Summer Unix Programming - CS 3902 Course Details Online Information Please check.
Lecture 6: Computer Languages. Programming Environments (IDE) COS120 Software Development Using C++ AUBG, COS dept.
CERN - IT Department CH-1211 Genève 23 Switzerland t DB Development Tools Benthic SQL Developer Application Express WLCG Service Reliability.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
HOW TO INSTALL & USE OPENCV. I - CHOOSE YOUR FAVORITE IDE Microsoft Visual Studio Express 2013 for Window Desktop (Free) can be downloaded from
1 Splint: A Static Memory Leakage tool Presented By: Krishna Balasubramanian.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Creating a Java Application and Applet
IE Developer Tools Jonathan Seitel Program Manager.
Overview Using Plugins Developing Plugins Basic Examples / Demo Outlook Overview Using Plugins Developing Plugins Basic Examples / Demo Outlook Plugin.
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)
Optical Flow walk through Aidean Sharghi Spring 14.
 CSC 215 : Procedural Programming with C C Compilers.
QML and JavaScript for Native App Development Michael Tims Jen Trieu.
CMake - Cross-Platform Make R. Douglas Barbieri Made to Order Software Corporation.
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 4.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
ECS – Storyboarding and Introduction to Web Design
Lesson 11 Exploring Microsoft Office 2007
CSC 215 : Procedural Programming with C
Build and Test system for FairRoot
Simone Campanoni LLVM Simone Campanoni
Working in the Forms Developer Environment
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Tutorial 2 Programming Editors Recommendation & Cordova Plugin Installation and Management Li Xu Department of Systems Engineering.
OpenCV Tutorial Part I Using OpenCV with Microsoft Visual Studio .net November 2005 Gavin S Page
Introduction to Computer CC111
Visual Info Processing Programming Guide (More Details)
Auburn University COMP 2710 Software Construction xCode Development Environment for C++ Programming in Mac OS Dr. Xiao.
Creating a Brochure In Microsoft Word.
Introduction to the Visual C# 2005 Express Edition IDE
Computer Systems and Networks
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Chapter 2 Adding Web Pages, Links, and Images
.NET Debugging for the Production Environment
Chapter 2 – Introduction to the Visual Studio .NET IDE
SEEM4570 Tutorial 1 Android SDK + XCode SDK +
Cordova & Cordova Plugin Installation and Management
3.00 Understanding the Adobe Dreamweaver interface. (12%)
Eagle: Maturation and Evolution
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2017
Review of Previous Lesson
Web Application Development Using PHP
MS Confidential : SharePoint 2010 Developer Workshop (Beta1)
Presentation transcript:

A Quick Introduction to the C Interface By David Johnston OpenCV API A Quick Introduction to the C Interface By David Johnston

Warning: API Version 1.x

Primary OpenCV Interfaces The 1.x API is based on C. The 2.x API is based on C++.

Goals Very briefly outline the OpenCV installation process on Windows, OS X, and Linux. Walk through 4 example programs which should relevant to solving homework 2. Point out some common API patterns and idioms.

Installing OpenCV

Windows 7 64-bit and Visual C++ 2010 Express Install Visual C++ 2010 Express Edition (or some other modern Visual Studio product). Download prebuilt binaries and extract them to some desired location. Set the OPENCV_DIR environment variable: > setx -m OPENCV_DIR C:\opencv\build\x64\vc10

Windows 7 64-bit and Visual C++ 10.0 Express Add %OPENCV_DIR%\bin to your system path. Modify Visual Studio properties to find necessary files. The following describes this process in great detail: docs.opencv.org/doc/tutorials/introduction/windows_visual_ studio_Opencv/windows_visual_studio_Opencv.html

Install on Mac OS X Install XCode or the Apple Command Line Tools. Both are available with a (free) Apple ID. Install a package manager such as macports or homebrew. Install OpenCV.

Install on Linux Install via native package manager (ie. apt-get, yum, etc.)

Build on UNIX-Like System cc `pkg-config --cflags --libs\ opencv` -o foo foo.c

Four Code Demos

Some Constructors for Important Data Structures CvMat cvMat(...) CvMat* cvCreateMat(...) CvMat* cvCreateMatHeader(...) IplImage* cvCreateImage(...) CvSeq* cvCreateSeq(...) primary data structures

Ex 1: Image Workflow Loading, modifying, saving, and closing an image file. See filter.c.

Macros OpenCV defines a lot of macros. Most are prefixed with CV_* Many are function-specific The online documentation is usually pretty clear

In-Place Matrix Operations cvNot(img, img);

Manual Memory Management IplImage* img = cvLoadImage(...); /* do something worthwhile */ cvReleaseImage(&img);

Ex 2: Basic Morphology and Color Creating basic structuring elements and calling cvErode() and cvDilate(). Using binary images (bit masks) and cvSet() to color regions of an image. See noteSeg.c.

Constructors of Helper Data Structures Simple ideas wrapped inside a data type: CvPoint cvPoint(int x, int y) CvSize cvSize(int width, int height) CvScalar cvScalar(double d0, double d1, double d2, double d3) CvScalar cvScalarAll(double d) CvScalar cvRealScalar(double d) CvRect cvRect(int x, int y, int width, int height) Helper data structures

Ex 3: Horizontal and Vertical Projections Use cvGetRow(), cvGetCol(), and cvSum() to perform very simple projections.

Sort of Object Oriented The most important data structure is arguably IplImage. - Page 33 of Learning OpenCV by Bradski and Kaehler

Sort of Object Oriented The IplImage and CvMat data structures are just metadata which provide interfaces to the underlying image data. See projections.c.

Ex 4: Custom Morphology Creating custom structuring elements using cvCreateStructuringElementEx() and an int[].

Warning: Pointer Arithmetic is Imminent! Examples and discussion can be found in the text (highly recommended reading): cvMat and IplImage: pp. 31 - 47 cvSeq: pp. 222 - 234 See customStructElem.c.

Questions?

Example CvSize size = cvSize(600, 400); IplImage* img = cvCreateImage( size, IPL_DEPTH_8U, 3 ); cvSet(img, cvScalarAll(0), NULL);

Why isn't every call to these helper functions a memory leak?

Esoteric C99 Feature of the Day: Inline Functions "The keyword inline is a request to the compiler to insert a function's machine code wherever the function is called in the program." - Page 106 of C in a Nutshell, by Prinz and Crawford Automatic variables declared in an inline function become automatic variables in the calling function.