Myro and OpenCV
-
Upload
2xrobert -
Category
Technology
-
view
2.082 -
download
1
Transcript of Myro and OpenCV
![Page 2: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/4.jpg)
...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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/5.jpg)
The Scribbler and the Fluke
![Page 6: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/6.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/7.jpg)
Goals
Provide advanced image processing Discover working calibration Abstract into easy to use functions
![Page 8: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/8.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/9.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/10.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/11.jpg)
Bad result
![Page 12: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/12.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/13.jpg)
Pseudo code
Increment X from 0 to 500
Increment Y from 0 to 500HoughCircle with X & Y
![Page 14: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/14.jpg)
Detecting circles (result)
![Page 15: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/15.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/16.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/17.jpg)
Corner detection
Initial run (with default values) went rather smoothly
Algorithm was a bit overzealous
![Page 18: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/18.jpg)
Refinement
If the horizon could be found, superfluous results could be removed
Found the lowest, center bisecting horizontal line
![Page 19: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/19.jpg)
Process
![Page 20: Myro and OpenCV](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/20.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052117/5a66d84c7f8b9a21208b4b2b/html5/thumbnails/21.jpg)
Thank you!
For a copy of these slides go tohttp://www.slideshare.net/2xrobert