# Alex Beutel's Blog

## Image Aliasing of Plane Propellers in Photos and Video

#### July 23rd, 2009 · 14 Comments

Recently, while flying between Durham and New York, I decided to take a picture of the propeller during take off.  I don’t know what prompted to me to do this, but when I pointed my iPhone camera at the propeller out my window I noticed very odd pattens.  I took multiple pictures throughout the flight with my iPhone, and in some cases at the same time took pictures/video with my Canon camera.  To clarify the specs of the two cameras: I have an iPhone 3G (8 GB) and a Canon SD700 IS.  As you will see in the pictures below, the iPhone’s picture simply makes no sense with the blades appearing to be disconnected vertical lines.  The photo from the Canon seems reasonable, but as you will see in the video the propeller appears to be going fairly slowly, when in real life all I could see was a blur because of how fast it was moving.

Plane Propeller Photo from iPhone 3G

Canon SD700 IS Plane Propeller Photo

Update: here is a video taken from my iPhone 3G of the propeller.
This got me thinking about why the images looked the way they did. I assumed they were related to frame rate and as a result wondered if I could work backwards to find the speed of the propeller. When I got back to Duke, I talked it over with some of my friends. We discussed one theory that explained the slow spinning in the video from my Canon. I later found out is similar to the Wagon-wheel effect, and will go into more detail on this later. We also discussed possible distortions and other possible causes but couldn’t figure out exactly what was causing the odd pattern in the iPhone photo. Eventually, I decided to search around the internet and found that I was not the only one to notice this oddity. I also stumbled upon this great post explaining clearly and graphically why the iPhone photo looks the way it does. In short, most cameras save pixels from all parts of the lens at once, while the iPhone camera goes through the lens saving pixels linearly over time, similar to watching a scanner save the page of a book. (If anyone has an iPhone 3GS and can snap a picture and/or video of a propeller, please let me know. I’m very intrested to see if Apple’s upgraded camera still behaves this way. Please let me know if you find out.) The writer of the post also demonstrated this in a cool video made from a Matlab script:
Personally, I think this is really cool so I decided to play around with it some more. As I mentioned earlier, my friends and I had discussed the wagon-wheel effect or the stroboscopic effect, so I thought I’d modify his script to demonstrate it more clearly since the Wikipedia pages on the two topics both seemed a bit lacking. First, it is necessary to explain the general concept. The stroboscopic effect explains if you only see flashes or quick individual frames of a moving object at regular intervals you can get a distorted view of the motion, especially if the motion of the object that is being watched is cyclic or has a frequency. The relationship between the frequency of the flashes or frames and the frequency of the motion is what determines the perceived motion. The most common case of this is seeing a wheel which you know to be rolling forward, but it looks to be spinning backwards slowly. I modified the previous Matlab code to create a basic example of this with the propeller (download the code here). As you will see, the propeller on the left will spin counterclockwise at a moderate speed and every 8 frames the image on the right will update with a copy of the image on the left. This out of sync updating will make the propeller on the right appear to rotate clockwise.

Click the image to view the video

I also decided to show this more mathematically by plotting these movements in Mathematica. In the following examples I graph both the y-coordinate of the tip of the propeller and the angle that the blade has rotated in radians. In the graph of y the coordinate, there are three sinusoidal functions representing 3 propellers, each offset from the previous by 120 degrees (thus equally spaced). These lines and their colors correspond to the colored lines on the radian vs. time graph. The red lines mark a flash or frame and the dot on the line shows the top-most propeller. As you vary the spacing of the lines and thus change the frame rate, you can see the propeller will appear to stay still, then go backwards, then flip back and forth with no perceived motion, then go forwards, until it appears to stand still again. Below are pictures showing each of these stages, followed by a video fluidly showing these variations.
Here is the propeller appearing to stand still. This is due to the fact that the spacing of the frames is twice the period.

The graphs below show the propeller appearing to go backwards. Here we see that the frame rate is just below two periods of the propeller. The downward slope on the radian graph is a simple quick way to see the direction of the propeller rotation.

Propeller appearing to flip repeatedly:

This example shows the propeller appearing to rotate forwards. Again, the upwards slope of the points on the radian graph is an easy way to see the direction of rotation.

Last, here is the propeller appearing to stand still again. Unlike the first case of the propeller standing still, the spacing of the frames is not a multiple of the period. Rather, we see here that it is a multiple of 1/3 the period. It is only necessary that the spacing be a multiple of 1/3 the period because there are three blades and the blades are indistinguishable.

And finally, putting it all together:

The Mathematica code can be viewed here or downloaded here, and a printout of the entire Mathematica worksheet can be found here. Last, if one had a camera which could vary the frame rate just so slightly as to find two nearest frame rates to show the propeller standing still, the frequency of the propeller could be calculated as shown below.

As for the iPhone picture, a single image (and knowing the number of blades) is enough to roughly approximate the speed of the propeller as shown below.

However, just as a warning both of these are back of the envelope calculations and it is very possible I made a mistake (if so please let me know). That is all for now. Nothing ground breaking, but as the title suggests, it was a good chance for some mental masturbation, playing with Mathematica and Matlab.

## Duke LDAP on the iPhone

#### July 19th, 2009 · No Comments

I got an e-mail this morning from someone who saw my post on Twitter about using LDAP on the iPhone here at Duke.  The person said they followed the tutorial but couldn’t quite get it to work.  So I figured it may be useful to post a few quick instructions on setting it up.  As the post on Twitter explains, the basic instructions for getting to adding an LDAP account can be viewed here and Duke’s LDAP server settings can be found here.  Once you are set to add the LDAP account, simply set the server to ldap.duke.edu, no need for a username or password.  Once you click next you will want to turn off SSL and change the Search settings for duke,edu to have a base value of “ou=People,dc=duke,dc=edu” (leave the scope at subtree).  And that’s it.  To use it, which turned out to be the issue for the person emailing me, go to write a new email and start to type in the name of the person to search.  You should see a throbber show up at the top of your screen, showing that it is connecting to the server.  There is a bit of a lag but it should eventually return the contacts for people by that name.  Below are some pictures of the settings and the search.  Let me know if you run into any issues.

#### July 18th, 2009 · No Comments

Also, as some friends like Niru, DJ, and Marc have pointed out, I have somewhat decreased my blogging but have been posting a good number of posts on Twitter.  So of course, you should follow me on Twitter here.

## Following Chromium Progress

#### June 4th, 2009 · No Comments

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63  #!/usr/bin/env python # encoding: utf-8   import sys import os import urllib import urllib2 import base64 import time from xml.dom import minidom   def twitter(twitter_username, twitter_password, message): request = urllib2.Request('http://twitter.com/statuses/update.json') request.headers['Authorization'] = 'Basic %s' % ( base64.b64encode(twitter_username + ':' + twitter_password),) request.data = urllib.urlencode({'status': message}) try: response = urllib2.urlopen(request) # The Response except HTTPError, e: print "Error posting to twitter" print "HTTP Error code: ", e.code except URLError, e: print "Error posting to twitter" print "URLError reason: ", e.reason   def main(): message = "" last_update = "17514"; chromium_url = "http://build.chromium.org/buildbot/snapshots/sub-rel-mac/" while(True): try: response = urllib2.urlopen(chromium_url + "LATEST") except HTTPError, e: print "HTTP Error code: ", e.code except URLError, e: print "URLError reason: ", e.reason else: latest = response.read() print "latest: ", latest if(latest != last_update): try: response2 = urllib2.urlopen(chromium_url + latest + "/changelog.xml") except HTTPError, e: print "HTTP Error code: ", e.code except URLError, e: print "URLError reason: ", e.reason else: html = response2.read() # print html dom = minidom.parseString(html) entries = dom.getElementsByTagName("logentry") #[0].childNodes print "entries: ", len(entries) for i in range(0, len(entries)): link = chromium_url + latest + "/ " msg = entries[i].getElementsByTagName("msg")[0].firstChild.nodeValue num = entries[i].getAttribute("revision") print "Revision: ", num twitter("USERNAME", "PASSWORD", "Chromium Revision " + num + ": " + msg) last_update = latest time.sleep((60*2))     if __name__ == '__main__': main()