SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
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.

Más contenido relacionado

La actualidad más candente

Algorithme & structures de données Chap I
Algorithme & structures de données Chap IAlgorithme & structures de données Chap I
Algorithme & structures de données Chap IInes Ouaz
 
Cours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corbaCours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corbaMariem ZAOUALI
 
Chapitre 5 classes abstraites et interfaces
Chapitre 5  classes abstraites et interfacesChapitre 5  classes abstraites et interfaces
Chapitre 5 classes abstraites et interfacesAmir Souissi
 
Virtualisation de Machines avec Windows Hyper V
Virtualisation de Machines avec Windows Hyper VVirtualisation de Machines avec Windows Hyper V
Virtualisation de Machines avec Windows Hyper Vfabricemeillon
 
Le pattern adaptateur
Le pattern adaptateurLe pattern adaptateur
Le pattern adaptateurKhaled AMIRAT
 
Mise en place d’un serveur proxy : Cas du CCProxy
Mise en place d’un serveur proxy : Cas du CCProxyMise en place d’un serveur proxy : Cas du CCProxy
Mise en place d’un serveur proxy : Cas du CCProxyJeff Hermann Ela Aba
 
Fiche3 ex-sous-programme
Fiche3 ex-sous-programmeFiche3 ex-sous-programme
Fiche3 ex-sous-programmeBaghdadi Wajih
 
Chapitre 11: Expression Lambda et Référence de méthode en Java
Chapitre 11: Expression Lambda et Référence de méthode en JavaChapitre 11: Expression Lambda et Référence de méthode en Java
Chapitre 11: Expression Lambda et Référence de méthode en JavaAziz Darouichi
 
Chap1V2019: Cours en C++
Chap1V2019: Cours en C++Chap1V2019: Cours en C++
Chap1V2019: Cours en C++Aziz Darouichi
 
Docker networking Tutorial 101
Docker networking Tutorial 101Docker networking Tutorial 101
Docker networking Tutorial 101LorisPack Project
 
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...Tom Limoncelli
 
Getting Started With Docker | Docker Tutorial | Docker Training | Edureka
Getting Started With Docker | Docker Tutorial | Docker Training | EdurekaGetting Started With Docker | Docker Tutorial | Docker Training | Edureka
Getting Started With Docker | Docker Tutorial | Docker Training | EdurekaEdureka!
 
[JDLL 2016] OpenID Connect et FranceConnect
[JDLL 2016] OpenID Connect et FranceConnect[JDLL 2016] OpenID Connect et FranceConnect
[JDLL 2016] OpenID Connect et FranceConnectClément OUDOT
 

La actualidad más candente (20)

Algorithme & structures de données Chap I
Algorithme & structures de données Chap IAlgorithme & structures de données Chap I
Algorithme & structures de données Chap I
 
Présentation Docker
Présentation DockerPrésentation Docker
Présentation Docker
 
Cours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corbaCours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corba
 
Chapitre 5 classes abstraites et interfaces
Chapitre 5  classes abstraites et interfacesChapitre 5  classes abstraites et interfaces
Chapitre 5 classes abstraites et interfaces
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
 
Virtualisation de Machines avec Windows Hyper V
Virtualisation de Machines avec Windows Hyper VVirtualisation de Machines avec Windows Hyper V
Virtualisation de Machines avec Windows Hyper V
 
Chap2fonctionscpp
Chap2fonctionscppChap2fonctionscpp
Chap2fonctionscpp
 
Chapitre05 : Les tableaux
Chapitre05 : Les tableauxChapitre05 : Les tableaux
Chapitre05 : Les tableaux
 
Le pattern adaptateur
Le pattern adaptateurLe pattern adaptateur
Le pattern adaptateur
 
Patron observer
Patron observerPatron observer
Patron observer
 
Mise en place d’un serveur proxy : Cas du CCProxy
Mise en place d’un serveur proxy : Cas du CCProxyMise en place d’un serveur proxy : Cas du CCProxy
Mise en place d’un serveur proxy : Cas du CCProxy
 
Fiche3 ex-sous-programme
Fiche3 ex-sous-programmeFiche3 ex-sous-programme
Fiche3 ex-sous-programme
 
Chapitre 11: Expression Lambda et Référence de méthode en Java
Chapitre 11: Expression Lambda et Référence de méthode en JavaChapitre 11: Expression Lambda et Référence de méthode en Java
Chapitre 11: Expression Lambda et Référence de méthode en Java
 
Chap1V2019: Cours en C++
Chap1V2019: Cours en C++Chap1V2019: Cours en C++
Chap1V2019: Cours en C++
 
Docker networking Tutorial 101
Docker networking Tutorial 101Docker networking Tutorial 101
Docker networking Tutorial 101
 
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
 
Polymorphisme
PolymorphismePolymorphisme
Polymorphisme
 
kubernetes, pourquoi et comment
kubernetes, pourquoi et commentkubernetes, pourquoi et comment
kubernetes, pourquoi et comment
 
Getting Started With Docker | Docker Tutorial | Docker Training | Edureka
Getting Started With Docker | Docker Tutorial | Docker Training | EdurekaGetting Started With Docker | Docker Tutorial | Docker Training | Edureka
Getting Started With Docker | Docker Tutorial | Docker Training | Edureka
 
[JDLL 2016] OpenID Connect et FranceConnect
[JDLL 2016] OpenID Connect et FranceConnect[JDLL 2016] OpenID Connect et FranceConnect
[JDLL 2016] OpenID Connect et FranceConnect
 

Destacado

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
 

Destacado (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 a 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 a 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
 

Último

Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...baharayali
 
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docxTrossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docxEuro Cup 2024 Tickets
 
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docx
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docxNetherlands Players expected to miss UEFA Euro 2024 due to injury.docx
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docxEuro Cup 2024 Tickets
 
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdfTAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdfSocial Samosa
 
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls AgencyHire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls AgencyNitya salvi
 
Sports Writing (Rules,Tips, Examples, etc)
Sports Writing (Rules,Tips, Examples, etc)Sports Writing (Rules,Tips, Examples, etc)
Sports Writing (Rules,Tips, Examples, etc)CMBustamante
 
Personal Brand Exploration - By Bradley Dennis
Personal Brand Exploration - By Bradley DennisPersonal Brand Exploration - By Bradley Dennis
Personal Brand Exploration - By Bradley Dennisjocksofalltradespodc
 
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
 
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...World Wide Tickets And Hospitality
 
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
 
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...World Wide Tickets And Hospitality
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WhatsApp Chat: 📞 8617697112 Birbhum Call Girl available for hotel room package
WhatsApp Chat: 📞 8617697112 Birbhum  Call Girl available for hotel room packageWhatsApp Chat: 📞 8617697112 Birbhum  Call Girl available for hotel room package
WhatsApp Chat: 📞 8617697112 Birbhum Call Girl available for hotel room packageNitya salvi
 
Ramban Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts In...
Ramban  Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts In...Ramban  Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts In...
Ramban Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts In...Nitya salvi
 
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
 
Unveiling the Mystery of Main Bazar Chart
Unveiling the Mystery of Main Bazar ChartUnveiling the Mystery of Main Bazar Chart
Unveiling the Mystery of Main Bazar ChartChart Kalyan
 
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...Diya Sharma
 
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docxUEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docxEuro Cup 2024 Tickets
 
Spain Vs Italy Spain to be banned from participating in Euro 2024.docx
Spain Vs Italy Spain to be banned from participating in Euro 2024.docxSpain Vs Italy Spain to be banned from participating in Euro 2024.docx
Spain Vs Italy Spain to be banned from participating in Euro 2024.docxWorld Wide Tickets And Hospitality
 

Último (20)

Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
Asli Kala jadu, Black magic specialist in Pakistan Or Kala jadu expert in Egy...
 
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docxTrossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
Trossard's Message Bridging Celebrities and Sports in Euro Cup 2024.docx
 
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docx
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docxNetherlands Players expected to miss UEFA Euro 2024 due to injury.docx
Netherlands Players expected to miss UEFA Euro 2024 due to injury.docx
 
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdfTAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
TAM Sports_IPL 17 Till Match 37_Celebrity Endorsement _Report.pdf
 
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls AgencyHire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
Hire 💕 8617697112 Kasauli Call Girls Service Call Girls Agency
 
Sports Writing (Rules,Tips, Examples, etc)
Sports Writing (Rules,Tips, Examples, etc)Sports Writing (Rules,Tips, Examples, etc)
Sports Writing (Rules,Tips, Examples, etc)
 
Personal Brand Exploration - By Bradley Dennis
Personal Brand Exploration - By Bradley DennisPersonal Brand Exploration - By Bradley Dennis
Personal Brand Exploration - By Bradley Dennis
 
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 ...
 
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
Spain Vs Italy 20 players confirmed for Spain's Euro 2024 squad, and three po...
 
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
 
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
Spain Vs Albania- Spain at risk of being thrown out of Euro 2024 with Tournam...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WhatsApp Chat: 📞 8617697112 Birbhum Call Girl available for hotel room package
WhatsApp Chat: 📞 8617697112 Birbhum  Call Girl available for hotel room packageWhatsApp Chat: 📞 8617697112 Birbhum  Call Girl available for hotel room package
WhatsApp Chat: 📞 8617697112 Birbhum Call Girl available for hotel room package
 
Ramban Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts In...
Ramban  Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts In...Ramban  Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts In...
Ramban Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts In...
 
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
 
Unveiling the Mystery of Main Bazar Chart
Unveiling the Mystery of Main Bazar ChartUnveiling the Mystery of Main Bazar Chart
Unveiling the Mystery of Main Bazar Chart
 
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...🔝|97111༒99012🔝 Call Girls In  {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
🔝|97111༒99012🔝 Call Girls In {Delhi} Cr Park ₹5.5k Cash Payment With Room De...
 
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docxUEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
UEFA Euro 2024 Squad Check-in Who is Most Favorite.docx
 
Spain Vs Italy Spain to be banned from participating in Euro 2024.docx
Spain Vs Italy Spain to be banned from participating in Euro 2024.docxSpain Vs Italy Spain to be banned from participating in Euro 2024.docx
Spain Vs Italy Spain to be banned from participating in Euro 2024.docx
 

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.