21
OpenCV for Image Processing with Myro Bob Roberts Kutztown University [email protected]

Myro and OpenCV

Embed Size (px)

Citation preview

Page 1: Myro and OpenCV

OpenCV for Image Processing with Myro

Bob RobertsKutztown University

[email protected]

Page 2: Myro and OpenCV

What is Myro? Work of Georgia Tech and Bryn Mawr College

with assistance and a grant from Microsoft Collection of Python libraries for easy robotics

programming Used in conjunction with Scribbler and Fluke

Page 3: Myro and OpenCV

What is the Scribbler...

A small robot made by Paralax Built in BASIC stamp Two motors and a number of input sensors Serial port on top for programming

Page 4: Myro and OpenCV

...and the Fluke

Expansion board made by Georgia Tech Adds Bluetooth, a camera and a few more

sensors Plugs into the Scribbler's serial port

Page 5: Myro and OpenCV

The Scribbler and the Fluke

Page 6: Myro and OpenCV

The problem

Initial test to seek out a ball The robot succeeded but gave no

information about the shape The function simply determined the number

of pixels in the “blob”

Page 7: Myro and OpenCV

Goals

Provide advanced image processing Discover working calibration Abstract into easy to use functions

Page 8: Myro and OpenCV

Proposed solution

OpenCV, a powerful image processing tool Native to C but has Python bindings Can provide edge, circle and corner

detection among other things

Page 9: Myro and OpenCV

Setup

A netbook running Windows XP Myro uses Python 2.4, OpenCV uses 2.6

− OpenCV and Pyhton 2.4 didn't work together

− Myro and Python 2.6 worked well enough

Page 10: Myro and OpenCV

From Myro to OpenCV

Convert from Myro's image format to OpenCV's image format

Information got scrambled in conversion Work around was to convert to gray scale

Page 11: Myro and OpenCV

Bad result

Page 12: Myro and OpenCV

Detecting circles

Initial attempt produced unexpected results Prompted a controlled test that would vary

the detection variables Attempt to find the common values that

work for circle detection

Page 13: Myro and OpenCV

Pseudo code

Increment X from 0 to 500

Increment Y from 0 to 500HoughCircle with X & Y

Page 14: Myro and OpenCV

Detecting circles (result)

Page 15: Myro and OpenCV

An accidental discovery

Previous test was run once more Caused the script (and Python) to fail Only notable difference between working

and non working was the dimensions Resizing worked

Page 16: Myro and OpenCV

Wrap up for circle detection

Modified the Original ball detecting code to use the OpenCV

Variables from test did not carry into real world

Resulted in the scribbler missing the real ball and chasing ghosts

Page 17: Myro and OpenCV

Corner detection

Initial run (with default values) went rather smoothly

Algorithm was a bit overzealous

Page 18: Myro and OpenCV

Refinement

If the horizon could be found, superfluous results could be removed

Found the lowest, center bisecting horizontal line

Page 19: Myro and OpenCV

Process

Page 20: Myro and OpenCV

Looking ahead

Revisit color Implement and calibrate for the real world Create alternative to finding the horizon Add shape detection Devise a visual mapping

Page 21: Myro and OpenCV

Thank you!

For a copy of these slides go tohttp://www.slideshare.net/2xrobert