interactive space – an application of opencv sam siciliano

19
Interactive Space – An application of OpenCV Sam Siciliano

Upload: chase-mcnulty

Post on 26-Mar-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Interactive Space – An application of OpenCV Sam Siciliano

Interactive Space – An application of OpenCV

Sam Siciliano

Page 2: Interactive Space – An application of OpenCV Sam Siciliano

Overview

• Who I am and the project background.• The System

– Components– Communication

• The Software– APIs– Custom Code– User Interface

• Ideas, Expansions and Surprises• Demonstration and Videos

Page 3: Interactive Space – An application of OpenCV Sam Siciliano

Who I am

• Graduated summer before last from PSU with a degree in computer engineering

• Embedded Systems Engineer for Logic Product Development

• OMSI Employee at the time of the project

Page 4: Interactive Space – An application of OpenCV Sam Siciliano

The Project

• Portland State University Senior Capstone Project done in conjunction with OMSI

• Team of 6

• Was in OMSI 3-4 months, currently lives on my laptop.

Page 5: Interactive Space – An application of OpenCV Sam Siciliano

The System – Block Diagram

Page 6: Interactive Space – An application of OpenCV Sam Siciliano

The System - Components• “Technobeam” intelligent light fixture

– DMX-512 Lighting Protocol– 180 degrees pan, 90 degrees tilt– Adjustable colors, patterns via “litho wheel” and “gobos”– Iris and adjustable focus

Page 7: Interactive Space – An application of OpenCV Sam Siciliano

The System - Components

• The DMX-512 transceiver– Shifts from RS-232 to RS-485– Increases baud rate, from 1152 to 2500

Page 8: Interactive Space – An application of OpenCV Sam Siciliano

The System – Components

• The Server– Dell, p4 2GHz Machine.– Windows XP Professional– Generic Video Capture Card

Page 9: Interactive Space – An application of OpenCV Sam Siciliano

Software Components

Input Video Stream

via DirectX 9 and

Direct Show

ComputerVision

CalibrationBased

Mapping

TB/PTSerial

ControlClasses

Frame Xvid, Yvid XTB, YTB

Page 10: Interactive Space – An application of OpenCV Sam Siciliano

Video Capture Via DirectX

• Direct Show and Filter Graphs

Example of Simple Video Capture:

Graph Used for the Project:

Page 11: Interactive Space – An application of OpenCV Sam Siciliano

Video Capture Via DirectX

• Install DirectX 9.0 SDK (note – DirectShow is not included with latest version!!)

• Use the DirectShow API to Create a Filter Graph– Insert ProxyTrans Filter that comes with

OpenCV

• Define a callback function and start playback

Page 12: Interactive Space – An application of OpenCV Sam Siciliano

Computer Vision

• Initial Conditions– “cvgoodfeaturestotrack”– Region and Trigger

Selection

• Tracking– Optical Flow– Point Removal Rules– Centroid Calculation

Page 13: Interactive Space – An application of OpenCV Sam Siciliano

AlgorithimGet Trackable

Features in ROI(points P[] – 1)

Save Frame (Frame N – 1)

Get Next Frame(Frame N)

Pass in all to OpticalFlow

FunctionTo get updated

points (P[])

> 0 points in P[]?

Calculate Centroid ofP[]

Send centroid to remapping

functions

Save Current Frame(now N – 1)

Save Current Points(now P – 1)

Object LostNo

Yes

Throw out invalid points in P[]

Page 14: Interactive Space – An application of OpenCV Sam Siciliano

Calibration and Mapping

• UI setup to gather calibration data points a set of 2 inputs, 2 outputs

• Points are collected once per given setup

• Accounts for “fish-eye” lens distortion

Page 15: Interactive Space – An application of OpenCV Sam Siciliano

Calibration and Mapping - 2

• Our problem context:

• First Solution: get to calibration points (lower left, upper right) to obtain thresholds, linearly scale and shift:

???

Xvid(from 0 to 320)

Yvid(from 0 to 240)

Pan (from 0 to 216)

Tilt (from 0 to 216)

aba

ba PanXPanPan

XXPan input

aba

ba TiltYTiltTilt

YYTilt input

Page 16: Interactive Space – An application of OpenCV Sam Siciliano

Calibration and Mapping - 3

• Worked fine with initial camera we were using.

• When switching though to a camera with a wide angle lens, system wasn’t adequate due to “fisheye” distortion.

• New Scheme: 9 point calibration and piece-wise linear interpolation.

Page 17: Interactive Space – An application of OpenCV Sam Siciliano

Calibration and Mapping - 4

2113

243

34

34

13

24

34

34

Panyyy

PanPanx

xx

PanPanc

cyyy

PanPanx

xx

PanPanPan vidvid

x1,y1, pan1 x2,y2, pan2

x3,y3, pan3

Page 18: Interactive Space – An application of OpenCV Sam Siciliano

Ideas and Surprises

• Feedback enabled “throwing” of the light

• Hypersonics and Music

• Use fuzzy logic with camera on pan/tilt unit

Page 19: Interactive Space – An application of OpenCV Sam Siciliano

Questions?