SlideShare a Scribd company logo
1 of 27
Download to read offline
Militarizing Your
 Backyard With Python:
Computer Vision and the Squirrel
            Hordes



                       Kurt Grandis
                       PyCon 2012
Overview
● Background & Goals
● OpenCV
  ○ Working with Python
● Detecting Squirrels
  ○ SVMs
  ○ Squirrely features
● Shooting Squirrels
● Wet Squirrels
● Next Steps
The Great Backyard Bird Count




http://www.birdsource.org/gbbc/
Squirrels...
Sentry Water Gun




                   http://wiki.teamfortress.com/wiki/Sentry_Gun
System


Sensor (Camera)   Blob Detection

                                          Targeting   Shoot the Squirrel


                     Squirrel Detection
OpenCV
Open Source Computer Vision
● Image Processing
● Video Analysis
● Feature Detectors
● Object Detection

C, C++, Python Interfaces

http://opencv.willowgarage.com/wiki/
http://code.opencv.org
Python & OpenCV
● Support for native Python structures
● Works with numpy
● Efficient data sharing
Sensor : Webcam
OpenCV
         import cv

         cv.NamedWindow("camera raw", 1)
         capture = cv.CreateCameraCapture(0)
         img = cv.QueryFrame(capture)
         cv.ShowImage("camera raw", img)




         # Convert to Gray Scale
         gray = cv.CreateImage(cv.GetSize(img),
                          cv.IPL_DEPTH_8U, 1)
         cv.CvtColor(img, gray, cv.CV_BGR2GRAY)


         # Canny Edge Filter
         cv.Canny(gray, edges, 50, 200, 3)
Blob Detection
How do I find regions of interest (i.e. Blobs)?
● Birds
● Squirrels
● Neighbor Children


cvBlobsLib http://opencv.willowgarage.com/wiki/cvBlobsLib
cvFindContours (OpenCV function)
Background Subtraction
Foreground Segmentation

Noisy Background

Codebook Approach
Squirrel Detection
Support Vector Machines (SVMs)
Supervised Learning                                from svm import *

                                                   ...

Classification                                     c = my_trained_model.predict(vector)




Features


libsvm http://www.csie.ntu.edu.tw/~cjlin/libsvm/
Squirrely Features




What is squirrel-ness?

● blob size
● histogram analysis of blob
● entropy of blob (texture)
Blob Size
Color Histogram
Entropy
          Measure of randomness

          Calculate entropy for regions of the blob

           ●   Overall Entropy
           ●   Stdev Entropy
           ●   Left Mean Entropy - Right Mean Entropy




          h_prob = [ h / histo_sum for h in histogram ]

          entropy =   -sum( [p * math.log(p)
                                 for p in h_prob
                                 if p != 0] )
SVM & Classifing Blobs
● blob size
● color histograms
● entropy of blob (texture)

                   Classify!
Shoot the Squirrel
The Gun
The Turret
Python and Arduino
Arduino Uno

pyserial                                     import serial

                                             arduino = serial.Serial(device, BAUD_RATE)


                                             arduino.write("a")




Project Sentry Gun
https://sites.google.com/site/projectsentrygun/

Python-On-A-Chip
http://code.google.com/p/python-on-a-chip/
Results
●   Squirrels get wet
●   False positives extremely low
●   More satisfying if it camps the feeder
●   Need stronger firepower
●   Need larger water reservoir
●   Squirrels are extremely persistent...no really
Next Steps
● Better Optics
● Stronger Firepower
  ○ Laminar water jet
  ○ Pressurized water pump
● Python-On-A-Chip

● Bird Classifier & Counter
Questions?
kgrandis@gmail.com
@kgrandis

http://kurtgrandis.com/


no animals were harmed in the development of
this project. Bird seed and other snacks were
provided to all participants free of charge.

More Related Content

What's hot

Flutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepFlutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepChandramouli Biyyala
 
VMware ESXi トラブルシューティング
VMware ESXi トラブルシューティングVMware ESXi トラブルシューティング
VMware ESXi トラブルシューティングKazuhito Ohkawa
 
Why Python?
Why Python?Why Python?
Why Python?Adam Pah
 
Deep Learning for Autonomous Driving
Deep Learning for Autonomous DrivingDeep Learning for Autonomous Driving
Deep Learning for Autonomous DrivingJan Wiegelmann
 
Software Engineering Patterns for Machine Learning Applications
Software Engineering Patterns for Machine Learning ApplicationsSoftware Engineering Patterns for Machine Learning Applications
Software Engineering Patterns for Machine Learning ApplicationsHironori Washizaki
 
State of NuPIC
State of NuPICState of NuPIC
State of NuPICNumenta
 
OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]Daffodil International University
 
Real Time Object Tracking
Real Time Object TrackingReal Time Object Tracking
Real Time Object TrackingVanya Valindria
 
Natural language processing
Natural language processingNatural language processing
Natural language processingHansi Thenuwara
 
Mobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google FlutterMobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google FlutterAhmed Abu Eldahab
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlpankit_ppt
 
Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Randal Schwartz
 
Deblurring of Digital Image PPT
Deblurring of Digital Image PPTDeblurring of Digital Image PPT
Deblurring of Digital Image PPTSyed Atif Naseem
 

What's hot (20)

Flutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepFlutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by Step
 
VMware ESXi トラブルシューティング
VMware ESXi トラブルシューティングVMware ESXi トラブルシューティング
VMware ESXi トラブルシューティング
 
Why Python?
Why Python?Why Python?
Why Python?
 
Deep Learning for Autonomous Driving
Deep Learning for Autonomous DrivingDeep Learning for Autonomous Driving
Deep Learning for Autonomous Driving
 
Software Engineering Patterns for Machine Learning Applications
Software Engineering Patterns for Machine Learning ApplicationsSoftware Engineering Patterns for Machine Learning Applications
Software Engineering Patterns for Machine Learning Applications
 
State of NuPIC
State of NuPICState of NuPIC
State of NuPIC
 
Image processing ppt
Image processing pptImage processing ppt
Image processing ppt
 
OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]
 
Region based segmentation
Region based segmentationRegion based segmentation
Region based segmentation
 
Deep C
Deep CDeep C
Deep C
 
Real Time Object Tracking
Real Time Object TrackingReal Time Object Tracking
Real Time Object Tracking
 
Jpeg and mpeg ppt
Jpeg and mpeg pptJpeg and mpeg ppt
Jpeg and mpeg ppt
 
Natural language processing
Natural language processingNatural language processing
Natural language processing
 
Mobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google FlutterMobile DevOps pipeline using Google Flutter
Mobile DevOps pipeline using Google Flutter
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
 
Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)
 
Introduction to python
 Introduction to python Introduction to python
Introduction to python
 
Image processing
Image processingImage processing
Image processing
 
Introduction of sdlc
Introduction of sdlcIntroduction of sdlc
Introduction of sdlc
 
Deblurring of Digital Image PPT
Deblurring of Digital Image PPTDeblurring of Digital Image PPT
Deblurring of Digital Image PPT
 

Viewers also liked

Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic WebLuigi De Russis
 
Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)Luigi De Russis
 
Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)Luigi De Russis
 
Semantic Web - Ontology 101
Semantic Web - Ontology 101Semantic Web - Ontology 101
Semantic Web - Ontology 101Luigi De Russis
 
Face Recognition using OpenCV
Face Recognition using OpenCVFace Recognition using OpenCV
Face Recognition using OpenCVVasile Chelban
 
Face Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learnFace Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learnShiqiao Du
 

Viewers also liked (8)

Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic Web
 
Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)Introduction to OpenCV (with Java)
Introduction to OpenCV (with Java)
 
Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)
 
Semantic Web - Ontology 101
Semantic Web - Ontology 101Semantic Web - Ontology 101
Semantic Web - Ontology 101
 
Face Recognition using OpenCV
Face Recognition using OpenCVFace Recognition using OpenCV
Face Recognition using OpenCV
 
Face Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learnFace Recognition with OpenCV and scikit-learn
Face Recognition with OpenCV and scikit-learn
 
Java and OWL
Java and OWLJava and OWL
Java and OWL
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 

Similar to PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes

Simple APIs and innovative documentation
Simple APIs and innovative documentationSimple APIs and innovative documentation
Simple APIs and innovative documentationPyDataParis
 
Using Android Things to Detect & Exterminate Reptilians
Using Android Things to Detect & Exterminate ReptiliansUsing Android Things to Detect & Exterminate Reptilians
Using Android Things to Detect & Exterminate ReptiliansNilhcem
 
People detection in a video
People detection in a videoPeople detection in a video
People detection in a videoYonatan Katz
 
Seven waystouseturtle pycon2009
Seven waystouseturtle pycon2009Seven waystouseturtle pycon2009
Seven waystouseturtle pycon2009A Jorge Garcia
 
Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruzrpmcruz
 
Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015Boey Pak Cheong
 
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...Lviv Startup Club
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...Edge AI and Vision Alliance
 
COSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer ToolsCOSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer ToolsMark Billinghurst
 
Jvm profiling under the hood
Jvm profiling under the hoodJvm profiling under the hood
Jvm profiling under the hoodRichardWarburton
 
20110220 computer vision_eruhimov_lecture02
20110220 computer vision_eruhimov_lecture0220110220 computer vision_eruhimov_lecture02
20110220 computer vision_eruhimov_lecture02Computer Science Club
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyTravis Oliphant
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CSteffen Wenz
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetupsource{d}
 
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
4Developers 2015: Gamedev-grade debugging - Leszek GodlewskiPROIDEA
 
Anil Thomas - Object recognition
Anil Thomas - Object recognitionAnil Thomas - Object recognition
Anil Thomas - Object recognitionIntel Nervana
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009tudorprodan
 

Similar to PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes (20)

Simple APIs and innovative documentation
Simple APIs and innovative documentationSimple APIs and innovative documentation
Simple APIs and innovative documentation
 
Using Android Things to Detect & Exterminate Reptilians
Using Android Things to Detect & Exterminate ReptiliansUsing Android Things to Detect & Exterminate Reptilians
Using Android Things to Detect & Exterminate Reptilians
 
People detection in a video
People detection in a videoPeople detection in a video
People detection in a video
 
Seven waystouseturtle pycon2009
Seven waystouseturtle pycon2009Seven waystouseturtle pycon2009
Seven waystouseturtle pycon2009
 
Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruz
 
Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015
 
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
COSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer ToolsCOSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer Tools
 
Jvm profiling under the hood
Jvm profiling under the hoodJvm profiling under the hood
Jvm profiling under the hood
 
20110220 computer vision_eruhimov_lecture02
20110220 computer vision_eruhimov_lecture0220110220 computer vision_eruhimov_lecture02
20110220 computer vision_eruhimov_lecture02
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPy
 
肉体言語 Tython
肉体言語 Tython肉体言語 Tython
肉体言語 Tython
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetup
 
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
4Developers 2015: Gamedev-grade debugging - Leszek Godlewski
 
Anil Thomas - Object recognition
Anil Thomas - Object recognitionAnil Thomas - Object recognition
Anil Thomas - Object recognition
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009
 
Intro
IntroIntro
Intro
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 

Recently uploaded

( Sports training) All topic (MCQs).pptx
( Sports training) All topic (MCQs).pptx( Sports training) All topic (MCQs).pptx
( Sports training) All topic (MCQs).pptxParshotamGupta1
 
Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...
Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...
Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...gurkirankumar98700
 
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfJORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfArturo Pacheco Alvarez
 
08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking Men08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking MenDelhi Call girls
 
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics TradeTechnical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics TradeOptics-Trade
 
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docxSlovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docxWorld Wide Tickets And Hospitality
 
08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking Men08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking MenDelhi Call girls
 
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣anilsa9823
 
Who Is Emmanuel Katto Uganda? His Career, personal life etc.
Who Is Emmanuel Katto Uganda? His Career, personal life etc.Who Is Emmanuel Katto Uganda? His Career, personal life etc.
Who Is Emmanuel Katto Uganda? His Career, personal life etc.Marina Costa
 
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...Eticketing.co
 
Albania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docx
Albania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docxAlbania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docx
Albania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docxWorld Wide Tickets And Hospitality
 
Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024HechemLaameri
 
08448380779 Call Girls In IIT Women Seeking Men
08448380779 Call Girls In IIT Women Seeking Men08448380779 Call Girls In IIT Women Seeking Men
08448380779 Call Girls In IIT Women Seeking MenDelhi Call girls
 
ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024Brian Slack
 
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...Neil Horowitz
 

Recently uploaded (20)

( Sports training) All topic (MCQs).pptx
( Sports training) All topic (MCQs).pptx( Sports training) All topic (MCQs).pptx
( Sports training) All topic (MCQs).pptx
 
Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...
Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...
Jankipuram / Call Girls Lucknow | Whatsapp No 🫗 8923113531 🎳 VIP Escorts Serv...
 
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdfJORNADA 5 LIGA MURO 2024INSUGURACION.pdf
JORNADA 5 LIGA MURO 2024INSUGURACION.pdf
 
08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking Men08448380779 Call Girls In Karol Bagh Women Seeking Men
08448380779 Call Girls In Karol Bagh Women Seeking Men
 
Call Girls In Vasundhara 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Vasundhara 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Vasundhara 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Vasundhara 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics TradeTechnical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
Technical Data | Sig Sauer Easy6 BDX 1-6x24 | Optics Trade
 
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docxSlovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
Slovenia Vs Serbia UEFA Euro 2024 Fixture Guide Every Fixture Detailed.docx
 
08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking Men08448380779 Call Girls In Lajpat Nagar Women Seeking Men
08448380779 Call Girls In Lajpat Nagar Women Seeking Men
 
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Anna Nagar Phone 🍆 8250192130 👅 celebrity escorts service
 
Call Girls 🫤 Malviya Nagar ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
Call Girls 🫤 Malviya Nagar ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOYCall Girls 🫤 Malviya Nagar ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOY
Call Girls 🫤 Malviya Nagar ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
 
Call Girls 🫤 Paharganj ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
Call Girls 🫤 Paharganj ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOYCall Girls 🫤 Paharganj ➡️ 9999965857  ➡️ Delhi 🫦  Russian Escorts FULL ENJOY
Call Girls 🫤 Paharganj ➡️ 9999965857 ➡️ Delhi 🫦 Russian Escorts FULL ENJOY
 
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service  🧣
CALL ON ➥8923113531 🔝Call Girls Telibagh Lucknow best Night Fun service 🧣
 
Who Is Emmanuel Katto Uganda? His Career, personal life etc.
Who Is Emmanuel Katto Uganda? His Career, personal life etc.Who Is Emmanuel Katto Uganda? His Career, personal life etc.
Who Is Emmanuel Katto Uganda? His Career, personal life etc.
 
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
Croatia vs Italy Euro Cup 2024 Three pitfalls for Spalletti’s Italy in Group ...
 
Albania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docx
Albania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docxAlbania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docx
Albania Vs Spain Albania is Loaded with Defensive Talent on their Roster.docx
 
Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024
 
Call Girls In RK Puram 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In RK Puram 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In RK Puram 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In RK Puram 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
08448380779 Call Girls In IIT Women Seeking Men
08448380779 Call Girls In IIT Women Seeking Men08448380779 Call Girls In IIT Women Seeking Men
08448380779 Call Girls In IIT Women Seeking Men
 
ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024ALL NFL NETWORK CONTACTS- April 29, 2024
ALL NFL NETWORK CONTACTS- April 29, 2024
 
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
 

PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes

  • 1. Militarizing Your Backyard With Python: Computer Vision and the Squirrel Hordes Kurt Grandis PyCon 2012
  • 2. Overview ● Background & Goals ● OpenCV ○ Working with Python ● Detecting Squirrels ○ SVMs ○ Squirrely features ● Shooting Squirrels ● Wet Squirrels ● Next Steps
  • 3. The Great Backyard Bird Count http://www.birdsource.org/gbbc/
  • 5. Sentry Water Gun http://wiki.teamfortress.com/wiki/Sentry_Gun
  • 6. System Sensor (Camera) Blob Detection Targeting Shoot the Squirrel Squirrel Detection
  • 7. OpenCV Open Source Computer Vision ● Image Processing ● Video Analysis ● Feature Detectors ● Object Detection C, C++, Python Interfaces http://opencv.willowgarage.com/wiki/ http://code.opencv.org
  • 8. Python & OpenCV ● Support for native Python structures ● Works with numpy ● Efficient data sharing
  • 10. OpenCV import cv cv.NamedWindow("camera raw", 1) capture = cv.CreateCameraCapture(0) img = cv.QueryFrame(capture) cv.ShowImage("camera raw", img) # Convert to Gray Scale gray = cv.CreateImage(cv.GetSize(img), cv.IPL_DEPTH_8U, 1) cv.CvtColor(img, gray, cv.CV_BGR2GRAY) # Canny Edge Filter cv.Canny(gray, edges, 50, 200, 3)
  • 11. Blob Detection How do I find regions of interest (i.e. Blobs)? ● Birds ● Squirrels ● Neighbor Children cvBlobsLib http://opencv.willowgarage.com/wiki/cvBlobsLib cvFindContours (OpenCV function)
  • 14. Support Vector Machines (SVMs) Supervised Learning from svm import * ... Classification c = my_trained_model.predict(vector) Features libsvm http://www.csie.ntu.edu.tw/~cjlin/libsvm/
  • 15. Squirrely Features What is squirrel-ness? ● blob size ● histogram analysis of blob ● entropy of blob (texture)
  • 18. Entropy Measure of randomness Calculate entropy for regions of the blob ● Overall Entropy ● Stdev Entropy ● Left Mean Entropy - Right Mean Entropy h_prob = [ h / histo_sum for h in histogram ] entropy = -sum( [p * math.log(p) for p in h_prob if p != 0] )
  • 19. SVM & Classifing Blobs ● blob size ● color histograms ● entropy of blob (texture) Classify!
  • 23. Python and Arduino Arduino Uno pyserial import serial arduino = serial.Serial(device, BAUD_RATE) arduino.write("a") Project Sentry Gun https://sites.google.com/site/projectsentrygun/ Python-On-A-Chip http://code.google.com/p/python-on-a-chip/
  • 24. Results ● Squirrels get wet ● False positives extremely low ● More satisfying if it camps the feeder ● Need stronger firepower ● Need larger water reservoir ● Squirrels are extremely persistent...no really
  • 25.
  • 26. Next Steps ● Better Optics ● Stronger Firepower ○ Laminar water jet ○ Pressurized water pump ● Python-On-A-Chip ● Bird Classifier & Counter
  • 27. Questions? kgrandis@gmail.com @kgrandis http://kurtgrandis.com/ no animals were harmed in the development of this project. Bird seed and other snacks were provided to all participants free of charge.