<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>App Delegate Inc</title><link href="http://blog.appdelegateinc.com" rel="alternate"></link><link href="http://blog.appdelegateinc.com/feeds/all.atom.xml" rel="self"></link><id>http://blog.appdelegateinc.com</id><updated>2011-08-28T00:00:00Z</updated><entry><title>App Engine ClientLoginError</title><link href="http://blog.appdelegateinc.com/app-engine-clientloginerror.html" rel="alternate"></link><updated>2011-08-28T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2011-08-28:/app-engine-clientloginerror.html/</id><summary type="html">&lt;p&gt;I’m using a pretty specific set of tools and I’ve come across an error that I couldn’t find a solution to, so I hacked my way out of it. I’m using &lt;a href="http://www.allbuttonspressed.com/projects/django-nonrel"&gt;django-nonrel&lt;/a&gt; to run Django on App Engine, while preserving some important features, like the admin app. I’m also using a Google Apps account (xxxx@appdelegateinc.com) as my App Engine account and I do my development on a Mac. When I try to run &lt;code&gt;python manage.py remote createsuperuser&lt;/code&gt; to create a new user on the App Engine hosted app, I get the following error:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="go"&gt;google.appengine.tools.appengine_rpc.ClientLoginError: HTTP Error 403: Forbidden&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a href="https://gist.github.com/1177179"&gt;Full Traceback&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I followed the traceback down to an App Engine SDK file which seems to not set a variable correctly. So I opened it up and hacked and got it working correctly.&lt;/p&gt;
&lt;p&gt;edit&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appengine_rpc.py
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And change the line:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;account_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;GOOGLE&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;account_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;HOSTED_OR_GOOGLE&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Here's the diff&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;/google/appengine/tools/appengine_rpc.py
206c206
&amp;lt;         account_type = &amp;quot;GOOGLE&amp;quot;
&lt;span class="gd"&gt;---&lt;/span&gt;
&amp;gt;         account_type = &amp;quot;HOSTED_OR_GOOGLE&amp;quot;
&lt;/pre&gt;&lt;/div&gt;</summary><category term="app engine"></category><category term="bug"></category></entry><entry><title>Where the heck is me??</title><link href="http://blog.appdelegateinc.com/where-the-heck-is-me.html" rel="alternate"></link><updated>2011-07-17T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2011-07-17:/where-the-heck-is-me.html/</id><summary type="html">&lt;p&gt;I was trying to figure out what the coordinates of my home were, but I couldn’t find anything online to look it up. I was hoping for something like &lt;a href="http://www.whattimeisit.com/"&gt;whattimeisit.com&lt;/a&gt; or &lt;a href="http://www.whatismyip.com/"&gt;whatismyip.com&lt;/a&gt; but for my location. Since it’s nowhere to be found, I decided to write up something for myself. It’ll show a map of where you are using your browser’s location information (if supported) and display your coordinates along with your best guessed address. Try it out over at &lt;a href="http://wheretheheckis.me/"&gt;wheretheheckis.me&lt;/a&gt;. I hope someone finds it useful. Maybe to help test out my &lt;a href="/google-maps-circle-overlay.html"&gt;Google Maps Circle Overlay library&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;&lt;a href="http://wheretheheckis.me/"&gt;wheretheheckis.me&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;img alt="Where the heck is me" src="/photos/where_the_heck_is_me.png" /&gt;&lt;/p&gt;</summary><category term="gis"></category><category term="google maps"></category></entry><entry><title>Pocket Sentry Caught Some Lightning</title><link href="http://blog.appdelegateinc.com/pocket-sentry-caught-some-lightning.html" rel="alternate"></link><updated>2011-06-15T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2011-06-15:/pocket-sentry-caught-some-lightning.html/</id><summary type="html">&lt;p&gt;I snapped a couple nice photos using my &lt;a href="/pocket-sentry-motion-cam.html"&gt;Pocket Sentry&lt;/a&gt; app last Thursday during a storm. Here they are:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Pocket Sentry Lightning 1" src="photos/pocket_sentry_lightning_1.jpeg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Pocket Sentry Lightning 2" src="photos/pocket_sentry_lightning_2.jpeg" /&gt;&lt;/p&gt;</summary><category term="iphone"></category><category term="photography"></category></entry><entry><title>Pocket Sentry Motion Cam</title><link href="http://blog.appdelegateinc.com/pocket-sentry-motion-cam.html" rel="alternate"></link><updated>2011-04-13T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2011-04-13:/pocket-sentry-motion-cam.html/</id><summary type="html">&lt;p&gt;I just released &lt;a href="http://goo.gl/OEJiY"&gt;Pocket Sentry&lt;/a&gt;, a motion activated camera for the iPhone and all other Apple devices equipped with a camera. The key features are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Play a configurable sound when motion is detected&lt;/li&gt;
&lt;li&gt;Snap a photo when motion is detected&lt;/li&gt;
&lt;li&gt;Email a photo (in batches) when motion is detected&lt;/li&gt;
&lt;li&gt;Request a webpage (HTTP Callback) when motion is detected&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is great if you have trouble with your neighbors, like I have, where they walk their dog on your lawn. It’s also good to catch the weirdo digging through your garbage. I originally wrote it as a prototype to keep the cat out of the stroller when we were getting ready for our baby to be born and it worked fantastically as you can see from this early prototype:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Cat Caught" src="photos/cat.jpeg" /&gt;&lt;/p&gt;
&lt;p&gt;The quality is much better than that now though, here’s a snip from an email in the current version:&lt;/p&gt;
&lt;div&gt;
    &lt;img src="photos/pocket_sentry.png" alt="Pocket Sentry Email" /&gt;
&lt;/div&gt;

&lt;p&gt;If you want to implement the callback, here’s a sample in PHP:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="nv"&gt;$device_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;udid&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$lat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;lat&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$lng&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;lng&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;array_key_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;photo&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$_FILES&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_FILES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;photo&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;error&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;size&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// Bytes&lt;/span&gt;
        &lt;span class="nv"&gt;$type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// image/jpeg&lt;/span&gt;
        &lt;span class="nb"&gt;move_uploaded_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;tmp_name&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/path/to/new/location&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// There was an error&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Update that code to post the image captured to twitter and then update the callback URL in Pocket Sentry’s settings to that URL and you now have a twitter feed of all the wildlife in your back yard. Have fun!&lt;/p&gt;
&lt;div align="center"&gt;
    &lt;a href="http://goo.gl/OEJiY"&gt;
        &lt;div&gt;Download Pocket Sentry Now:&lt;/div&gt;
        &lt;div&gt;&lt;img src="/photos/pocket_sentry_logo.png" alt="Pocket Sentry Logo" /&gt;&lt;/div&gt;
        &lt;div&gt;&lt;img src="/photos/app_store.png" alt="Available on App Store" /&gt;&lt;/div&gt;
    &lt;/a&gt;
&lt;/div&gt;</summary><category term="iphone"></category></entry><entry><title>RFID with Arduino and Python!</title><link href="http://blog.appdelegateinc.com/rfid-with-arduino-and-python.html" rel="alternate"></link><updated>2010-10-06T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2010-10-06:/rfid-with-arduino-and-python.html/</id><summary type="html">&lt;p&gt;This is a follow up to my initial post about using the Parallax RFID reader with the Arduino microcontroller. We’re going to spice things up by making your computer yell at intruders! With Python! I’ve opened the whole project up on GitHub at &lt;a href="http://github.com/mattwilliamson/Arduino-RFID"&gt;http://github.com/mattwilliamson/Arduino-RFID&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is an RFID authentication system. It allows a person to place an RFID tag within proximity of the reader device (usually 5-6 inches with this reader) and it will look up the tag in an SQLite database to check if it should grant access. If authorization is granted, the hardware device will turn a servo motor into a second position. The primary application of this being the unlocking of a door. This implementation also speaks aloud “Access Granted” or “Access Denied” if you are running the server on OS X. You can modify the source to use something like flite on other OSes. This project is very easily modified to do any sort of task. Some ideas are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Door locking (default implementation)&lt;/li&gt;
&lt;li&gt;An employee punch-in/punch-out system&lt;/li&gt;
&lt;li&gt;Real world item identification (affix a tag to every day items, such as your wallet; when scanned, open a web banking web page. attach one to your phone to initiate a Google Voice call, etc.)&lt;/li&gt;
&lt;li&gt;Russian roulette with RFID tags instead of guns&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Here's a Demo:&lt;/h2&gt;
&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/mws0nqkqvGg" frameborder="0" allowfullscreen class="video"&gt;&lt;/iframe&gt;

&lt;h2&gt;Hardware&lt;/h2&gt;
&lt;p&gt;To make this RFID system, you’ll need the following hardware:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 &lt;a href="http://www.amazon.com/gp/product/B001N1EOT8?ie=UTF8&amp;amp;tag=appdelinc-20&amp;amp;linkCode=xm2&amp;amp;camp=1789&amp;amp;creativeASIN=B001N1EOT8"&gt;Arduino&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;1 Servo (I like Hobby Partz because they are cheap) you don’t need this if you are not unlocking a door&lt;/li&gt;
&lt;li&gt;1 RFID Reader module (buy from your local &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2906723"&gt;Radio Shack&lt;/a&gt; or &lt;a href="http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/RFID/List/0/SortField/4/ProductID/114/Default.aspx"&gt;Parallax&lt;/a&gt;) $8 if you get lucky and find one at Radio Shack&lt;/li&gt;
&lt;li&gt;Some jumper wires to wire the whole thing together&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Software&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Python (2.6 tested, should work on 2.7)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://pyserial.sourceforge.net/"&gt;pySerial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.arduino.cc/en/Main/Software"&gt;Arduino IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://arduiniana.org/libraries/newsoftserial/"&gt;NewSoftSerial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The Arduino sketch and the rfid.py file included with this README file&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Wire it Up&lt;/h3&gt;
&lt;p&gt;You can use the image schematic/reader_breadboard.png to reference the wiring diagram. Basically you just need to wire the pins as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Arduino pin 8 -&amp;gt; RFID pin SOUT&lt;/li&gt;
&lt;li&gt;Arduino pin 9 -&amp;gt; RFID pin /ENABLE&lt;/li&gt;
&lt;li&gt;Arduino pin GND -&amp;gt; RFID pin GND&lt;/li&gt;
&lt;li&gt;Arduino pin 5V -&amp;gt; RFID pin VCC&lt;/li&gt;
&lt;li&gt;Arduino pin GND -&amp;gt; Servo wire BLACK&lt;/li&gt;
&lt;li&gt;Arduino pin Vin (9v) -&amp;gt; Servo wire RED&lt;/li&gt;
&lt;li&gt;Arduino pin 3 -&amp;gt; Servo wire YELLOW&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Schematic 1" src="/photos/rfid_bb.png" /&gt;&lt;/p&gt;
&lt;p&gt;You should end up with something like this.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Overview" src="/photos/overview.jpeg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Close Up" src="/photos/close_up.jpeg" /&gt;&lt;/p&gt;
&lt;h2&gt;Program the Arduino&lt;/h2&gt;
&lt;p&gt;Download the project here: http://github.com/mattwilliamson/Arduino-RFID&lt;/p&gt;
&lt;p&gt;First you need to install the &lt;a href="http://arduiniana.org/libraries/newsoftserial/"&gt;NewSoftSerial&lt;/a&gt; library for Arduino. Read the &lt;a href="http://www.arduino.cc/en/Reference/Libraries"&gt;Arduino docs&lt;/a&gt; on how to install a library.&lt;/p&gt;
&lt;p&gt;Plug the Arduino into your computer and open the sketch &lt;em&gt;sketch/rfid_sketch.pde&lt;/em&gt; with the Arduino IDE. Select which serial port to use for the Arduino (Tools-&amp;gt;Serial Port on OS X). Click the upload button to write the sketch to your Arduino. You may need to try a few different ports before it works. Write down the port name, we’ll need it later. It should look something like &lt;em&gt;/dev/tty.usbserial-A70064Mh&lt;/em&gt; or &lt;em&gt;COM3&lt;/em&gt;. It will probably be different for your machine.&lt;/p&gt;
&lt;h2&gt;Set Up the Server&lt;/h2&gt;
&lt;p&gt;Install the &lt;a href="http://pyserial.sourceforge.net/"&gt;pySerial&lt;/a&gt; serial library for python. If you have &lt;em&gt;setuptools&lt;/em&gt; installed, you can just run &lt;code&gt;easy_install pyserial&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Open &lt;em&gt;rfid.py&lt;/em&gt; with a text editor and look for this line: &lt;code&gt;serial_port = '/dev/tty.usbserial-A70064Mh'&lt;/code&gt;. Change the &lt;code&gt;/dev/tty.usbserial-A70064Mh&lt;/code&gt; to the serial port you wrote down in the previous step.&lt;/p&gt;
&lt;h2&gt;Usage&lt;/h2&gt;
&lt;p&gt;First, we’ll run the server to watch for the RFID tags we want to allow. Open a terminal and cd to the project directory. Then run &lt;code&gt;python rfid.py serve&lt;/code&gt;. This tells the python server to listen to the serial device for RFID tags. It will print debug information into the console.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="gp"&gt;wraith:rfid mwilliamson$&lt;/span&gt; python rfid.py serve
&lt;span class="go"&gt;Starting serial server...&lt;/span&gt;
&lt;span class="go"&gt;Connected to arduino. Awaiting RFID scans.&lt;/span&gt;
&lt;span class="go"&gt;Checking tag: 0F03042E80&lt;/span&gt;
&lt;span class="go"&gt;Tag access denied.&lt;/span&gt;
&lt;span class="go"&gt;^C&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Hit ctrl-c to kill the program. Now we have a tag we can enable: 0F03042E80. We’ll use the enable command to enable it.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="gp"&gt;wraith:rfid mwilliamson$&lt;/span&gt; python rfid.py &lt;span class="nb"&gt;enable &lt;/span&gt;0F03042E80
&lt;span class="go"&gt;Added tag with access ENABLED&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now that we’ve added the tag, we can scan it successfully. You should see the servo spin, or a least the built in LED on pin 13 of the arduino will light up.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="gp"&gt;wraith:rfid mwilliamson$&lt;/span&gt; python rfid.py serve
&lt;span class="go"&gt;Starting serial server...&lt;/span&gt;
&lt;span class="go"&gt;Connected to arduino. Awaiting RFID scans.&lt;/span&gt;
&lt;span class="go"&gt;Checking tag: 0F03042E80&lt;/span&gt;
&lt;span class="go"&gt;Tag access granted.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You can revoke access to a particular tag by running the &lt;code&gt;disable&lt;/code&gt; command&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="gp"&gt;wraith:rfid mwilliamson$&lt;/span&gt; python rfid.py disable 0F03042E80
&lt;span class="go"&gt;disabled access for tag&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h2&gt;Errors&lt;/h2&gt;
&lt;p&gt;If you see the following, make sure your Arduino is plugged into your computer and you correctly set up the serial port in &lt;em&gt;rfid.py&lt;/em&gt;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="gp"&gt;wraith:rfid mwilliamson$&lt;/span&gt; python rfid.py serve
&lt;span class="go"&gt;Starting serial server...&lt;/span&gt;
&lt;span class="go"&gt;*ERROR*&lt;/span&gt;
&lt;span class="go"&gt;Could not open serial port.&lt;/span&gt;
&lt;span class="go"&gt;Edit rfid.py and make sure you define serial_port properly.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Download or view code at: &lt;a href="http://github.com/mattwilliamson/Arduino-RFID"&gt;http://github.com/mattwilliamson/Arduino-RFID&lt;/a&gt;&lt;/p&gt;</summary><category term="arduino"></category><category term="rfid"></category><category term="python"></category></entry><entry><title>Motion Tracking with a Webcam</title><link href="http://blog.appdelegateinc.com/motion-tracking-with-a-webcam.html" rel="alternate"></link><updated>2010-08-02T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2010-08-02:/motion-tracking-with-a-webcam.html/</id><summary type="html">&lt;p&gt;I used Python and OpenCV to get a simple app together that tracks movement using a webcam. It currently averages all of the movements’ locations to determine a single point for targeting. This will not work for multiple targets, with a little modification.&lt;/p&gt;
&lt;iframe src="http://player.vimeo.com/video/13815290?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="400" height="340" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen class="sampleMap rounded"&gt;&lt;/iframe&gt;

&lt;iframe src="http://player.vimeo.com/video/13840327?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="400" height="340" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen class="sampleMap rounded"&gt;&lt;/iframe&gt;

&lt;p&gt;Here's the code from &lt;a href="http://github.com/mattwilliamson/Motion-Tracker/blob/master/track.py"&gt;http://github.com/mattwilliamson/Motion-Tracker/blob/master/track.py&lt;/a&gt;:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c"&gt;# Derived from http://sundararajana.blogspot.com/2007/05/motion-detection-using-opencv.html&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;cv&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;capture&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CaptureFromCAM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NamedWindow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Target&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c"&gt;# Capture first frame to get size&lt;/span&gt;
        &lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueryFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;capture&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;frame_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;grey_image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IPL_DEPTH_8U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;moving_average&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IPL_DEPTH_32F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;difference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c"&gt;# Capture frame from webcam&lt;/span&gt;
            &lt;span class="n"&gt;color_image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueryFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;capture&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Smooth to get rid of false positives&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Smooth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_GAUSSIAN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;difference&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="c"&gt;# Initialize&lt;/span&gt;
                &lt;span class="n"&gt;difference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CloneImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CloneImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConvertScale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;moving_average&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RunningAvg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;moving_average&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.020&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Convert the scale of the moving average.&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConvertScale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;moving_average&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Minus the current frame from the moving average.&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AbsDiff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;difference&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Convert the image to grayscale.&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CvtColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;difference&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RGB2GRAY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Convert the image to black and white.&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Threshold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_THRESH_BINARY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Dilate and erode to get object blobs&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Dilate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Erode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Calculate movements&lt;/span&gt;
            &lt;span class="n"&gt;storage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateMemStorage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;contour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FindContours&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grey_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RETR_CCOMP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_CHAIN_APPROX_SIMPLE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

            &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;contour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="c"&gt;# Draw rectangles&lt;/span&gt;
                &lt;span class="n"&gt;bound_rect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BoundingRect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contour&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="n"&gt;contour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;contour&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;h_next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

                &lt;span class="n"&gt;pt1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bound_rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;bound_rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                &lt;span class="n"&gt;pt2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bound_rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;bound_rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;bound_rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;bound_rect&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                &lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pt1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pt2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Rectangle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pt1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pt2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RGB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;num_points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;num_points&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="c"&gt;# Draw bullseye in midpoint of all movements&lt;/span&gt;
                &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;point&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                    &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;/=&lt;/span&gt; &lt;span class="n"&gt;num_points&lt;/span&gt;
                &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;/=&lt;/span&gt; &lt;span class="n"&gt;num_points&lt;/span&gt;
                &lt;span class="n"&gt;center_point&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;center_point&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RGB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;center_point&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RGB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;center_point&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RGB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;center_point&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CV_RGB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Display frame to user&lt;/span&gt;
            &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ShowImage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Target&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color_image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Listen for ESC or ENTER key&lt;/span&gt;
            &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WaitKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mh"&gt;0x100&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;27&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Target&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</summary><category term="opencv"></category><category term="python"></category><category term="webcam"></category></entry><entry><title>Arduino Sonar</title><link href="http://blog.appdelegateinc.com/arduino-sonar.html" rel="alternate"></link><updated>2010-07-27T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2010-07-27:/arduino-sonar.html/</id><summary type="html">&lt;p&gt;I’ve been waiting 3 weeks for my ultrasonic rangefinder to come in and now it has arrived. It’s going to be used in an obstacle avoiding tank-tread robot. Here’s a quick little test.&lt;/p&gt;
&lt;iframe src="http://player.vimeo.com/video/13691626?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen class="video"&gt;&lt;/iframe&gt;</summary><category term="arduino"></category><category term="sonar"></category><category term="lcd"></category></entry><entry><title>Browser Based Map Reduce</title><link href="http://blog.appdelegateinc.com/browser-based-map-reduce.html" rel="alternate"></link><updated>2010-05-18T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2010-05-18:/browser-based-map-reduce.html/</id><summary type="html">&lt;p&gt;What if you could offload some of your computational work onto the visitors of your site? We thought it would be pretty cool to make a quick little app to test the theory out using &lt;a href="http://code.google.com/appengine/"&gt;Google App Engine&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We opted to use the MapReduce paradigm as made famous by Google. The workflow is like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Admin (you) create a new job&lt;/li&gt;
&lt;li&gt;Admin adds data set, a line break delimited string&lt;/li&gt;
&lt;li&gt;Admin adds a map function, written in pure javascript&lt;/li&gt;
&lt;li&gt;Admin adds a reduce function&lt;/li&gt;
&lt;li&gt;Client visits web page with javascript embedded&lt;/li&gt;
&lt;li&gt;Javascript library prompts the user to contribute CPU cycles and writes to a cookie to remember&lt;/li&gt;
&lt;li&gt;If user accepts, request a random function and data set item from all jobs that is not complete&lt;/li&gt;
&lt;li&gt;Execute job and submit result&lt;/li&gt;
&lt;li&gt;Request another job, if there is none, wait a while and check again, if there is, don’t delay and start step 8 again&lt;/li&gt;
&lt;li&gt;It works like a charm! Try it out at &lt;a href="http://bbmapreduce.appspot.com/"&gt;http://bbmapreduce.appspot.com/&lt;/a&gt;. You can find the sources on &lt;a href="https://github.com/mattwilliamson/Browser-Based-Map-Reduce"&gt;my GitHub project page&lt;/a&gt;. To allow your visitors to contribute CPU cycles, simply include the script tag at &lt;a href="http://bbmapreduce.appspot.com/client/sample"&gt;http://bbmapreduce.appspot.com/client/sample&lt;/a&gt; in your website.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Sample:&lt;/h2&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://bbmapreduce.appspot.com/client/wrapper/&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;It should be noted that was not written with security in mind and you can never trust the data that gets sent back from your visitors, but there are ways to make it more reliable, such as executing one function on multiple clients and checking the data returned against the rest which is not currently implemented. The other issue is that the jobs being submitted on this test site is completely open and thus prone to spam alert calls.&lt;/p&gt;
&lt;h2&gt;DISCLAIMER&lt;/h2&gt;
&lt;p&gt;I am not responsible for any harm this causes you, your computer, or anyone who visits the URLs provided. This is simply for educational purposes.&lt;/p&gt;</summary><category term="app engine"></category><category term="mapreduce"></category><category term="python"></category></entry><entry><title>Google Maps Circle Overlay</title><link href="http://blog.appdelegateinc.com/google-maps-circle-overlay.html" rel="alternate"></link><updated>2010-05-17T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2010-05-17:/google-maps-circle-overlay.html/</id><summary type="html">&lt;p&gt;&lt;strong&gt;UPDATE: By popular request, I’ve ported this to Google Maps v3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another feature missing from Google Maps is the ability to draw a circle overlay. Displaying radii around a location is a very common use of maps. If your website has store searching and you want to show which stores are within X miles of some zip code, you’ll want to show your users the radius on the map. This can also be used in conjunction with our &lt;a href="/point-in-polygon-checking-with-google-maps.html"&gt;point in polygon library&lt;/a&gt; to easily display which points are inside the circle.&lt;/p&gt;
&lt;h2&gt;Sample:&lt;/h2&gt;
&lt;iframe src="samples/circle_overlay.html" frameborder="0" class="sampleMap rounded"&gt;&lt;/iframe&gt;

&lt;p&gt;I made this library in the most logical way. I used a &lt;code&gt;GPolygon&lt;/code&gt; and drew a fixed number of points in a circular fashion using standard geometry. In testing, I found that the optimal number of points drawn in the circle for general purposes is 40. You can easily override this using the last parameter of the constructor. Use a higher number for a smoother circle or a lower number for a higher performance circle.&lt;/p&gt;
&lt;p&gt;Usage (default resolution):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;circle2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;CircleOverlay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getCenter&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;&amp;quot;#0000FF&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;#0000FF&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Usage (custom resolution):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;circle1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;CircleOverlay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getCenter&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;&amp;quot;#000000&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;#009900&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Per usual, you can &lt;a href="samples/circle_overlay.html"&gt;view a sample in use&lt;/a&gt; or &lt;a href="samples/circle_overlay.html"&gt;view and download the code&lt;/a&gt;. Use freely.&lt;/p&gt;</summary><category term="js"></category><category term="google maps"></category></entry><entry><title>Point in Polygon Checking With Google Maps</title><link href="http://blog.appdelegateinc.com/point-in-polygon-checking-with-google-maps.html" rel="alternate"></link><updated>2010-05-16T00:00:00Z</updated><author><name>Matt Williamson</name></author><id>tag:blog.appdelegateinc.com,2010-05-16:/point-in-polygon-checking-with-google-maps.html/</id><summary type="html">&lt;p&gt;The Google Maps API is missing some things. One thing it is missing is the ability to detect whether or not a point lies within a polygon. One use case for this is selecting friends in a social network using a polygon the shape of a state or county.&lt;/p&gt;
&lt;h2&gt;Sample:&lt;/h2&gt;
&lt;iframe src="samples/point_in_polygon.html" frameborder="0" class="sampleMap rounded"&gt;&lt;/iframe&gt;

&lt;p&gt;To add this ability, I extended the &lt;code&gt;GPolygon&lt;/code&gt; class with a new method called &lt;code&gt;containsLatLng&lt;/code&gt;, just like the &lt;code&gt;GLatLngBounds&lt;/code&gt; class. The difference is that the method in the &lt;code&gt;GLatLngBounds&lt;/code&gt; class will only get the 4 coordinates of the bounding box, which are the farthest points in the polygon, and see if the coordinate lies within that box. My method, however, does true collision detection to see if the point lies within any shape polygon with as many sides as you want. It worked out perfectly using the &lt;a href="http://en.wikipedia.org/wiki/Point_in_polygon#Ray_casting_algorithm"&gt;Ray Cast Algorithm&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The simplest usage of this library looks like this (omitting including the GMaps API and this library):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;coordinate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;GLatLng&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;polygon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;GPolygon&lt;/span&gt;&lt;span class="p"&gt;([],&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;#000000&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;#336699&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;isWithinPolygon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;polygon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;containsLatLng&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;coordinate&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You can &lt;a href="samples/point_in_polygon.html"&gt;view a sample in action&lt;/a&gt; or &lt;a href="http://github.com/mattwilliamson/Google-Maps-Point-in-Polygon"&gt;download/view the source&lt;/a&gt;. Use freely.&lt;/p&gt;
&lt;p&gt;Update: Tim Parkin kindly updated this library to work with Google Maps v3, check it out at &lt;a href="http://github.com/tparkin/Google-Maps-Point-in-Polygon"&gt;http://github.com/tparkin/Google-Maps-Point-in-Polygon&lt;/a&gt;&lt;/p&gt;</summary><category term="js"></category><category term="google maps"></category></entry></feed>
