Some years back, I saw a pair of excellent blog posts on the rolling shutter effect. The rolling shutter effect is a form of distortion that can appear in photographs taken on a phone, since phone cameras typically capture frames by scanning across a scene horizontally/vertically over a period of time instead of capturing the entire scene at the same instant. When the subject of the photograph is static or slow-moving, this method of recording an image does not cause a problem. But for a fast-moving object such as an airplane propeller, a rolling shutter can produce fascinating forms of distortion. For example, here’s an image of an airplane propeller captured by a Pixel 3: ​​
​​Let’s start with a plot of an “airplane propeller.” For this example, we’ll use the polar equation
r=3cos(5θ)
:
In[]:=
PolarPlot[3Cos[5θ],{θ,0,2Pi},ImageSize->300]
Now we can make the make the propeller spin by writing
r=3cos(5(θ+time))
for some fixed value “time.”
In[]:=
Manipulate[PolarPlot[3Cos[5(θ+time)],{θ,0,2Pi},PlotPoints50,PlotRange{{-3,3},{-3,3}},ImageSize->300],{time,0,2Pi},ControlPlacement->Top]
Next, let’s get the rolling shutter into the mix. We’ll start with a horizontal line at
y=3
that moves down as time progresses. This can be written as
y=3-time
. We will also adjust our propeller equation to be
r=3cos5θ+
time
s
. The newly introduced
s
is a factor that is meant to represent the fact that the rate at which the shutter moves may differ from the rate at which the propeller rotates. We are putting the
s
with the propeller since we are treating the speed of our rolling shutter as a constant while the speed of the propeller may vary:
In[]:=
ManipulateShowPolarPlot3Cos5θ+
time
s
,{θ,0,2Pi},PlotPoints50,PlotRange{{-3,3},{-3,3}},Graphics[Line[{{-3,3-time},{3,3-time}}]],ImageSize->250,{time,0,6},{{s,1.05},.5,2},ControlPlacement->Top
In order to simulate the rolling shutter effect, it will be helpful to switch to a Cartesian plot instead a polar plot. First rewrite
r=3cos5θ+
time
s
as
1=
3cos(5θ)
r
. Then substitute in
r=
2
x
+
2
y
and
θ=
-1
tan
(x,y)
to get
1=
3cos5
-1
tan
(x,y)+
time
s

2
x
+
2
y
. We can plot this using a contour plot:
In[]:=
ManipulateContourPlot3Cos5ArcTan[x,y]+
time
s
Sqrt[x^2+y^2]1,{x,-5,5},{y,-5,5},PlotPoints50,PlotRange{{-3,3},{-3,3}},ImageSize->250,{time,0,6},{{s,1.05},.5,2},ControlPlacement->Top
Finally, we need to find the “distorted” plot from the rolling shutter effect. We are looking for the locus of points intersecting the shutter
y=3-time
. Solving for
time
gives us the following:
time=3-y
​In polar coordinates,
y=rsin(θ)
, so
time=3-rsin(θ)
. In rectangular coordinates, we also substitute in
r=
2
x
+
2
y
and
θ=
-1
tan
(x,y)
: Let’s substitute all of this into our contour plot from above,
3cos5
-1
tan
(x,y)+
time
s

2
x
+
2
y
=1
:​
3cos5
-1
tan
(x,y)+
3-
2
x
+
2
y
sin
-1
tan
(x,y)
s
2
x
+
2
y
=1
​​This looks like a mess, but let’s plot an example for
s=0.8
to see if it looks reasonable:
In[]:=
s=0.8;ContourPlot
3Cos5ArcTan[x,y]+
3-Sqrt
2
x
+
2
y
Sin[ArcTan[x,y]]
s

Sqrt[x^2+y^2]
1,{x,-5,5},{y,-5,5},PlotPoints50,PlotRange{{-3,3},{-3,3}}
This looks exactly like the type of plot we expect. Let’s put it all together to see:
ManipulateGraphicsDynamic@First@ContourPlot
3Cos5ArcTan[x,y]+
3-Sqrt
2
x
+
2
y
Sin[ArcTan[x,y]]
s

Sqrt[x^2+y^2]
1,{x,-5,5},{y,-5,5},PlotPoints50,ContourStyle->Gray,PlotRange{{-3,3},{-3,3}},​​Dynamic@First@Graphics[{White,Rectangle[{-3,3-time},{3,-3}]}],​​Dynamic@First@ParametricPlot3Cos5θ+
time
s
{Cos[θ],Sin[θ]},{θ,0,Pi},PlotStyleRed,RegionFunction->Function[{x,y,θ},y<3-time],​​Dynamic@First@Graphics[Line[{{-3,3-time},{3,3-time}}]],Axes->True,PlotRange->{{-3,3},{-3,3}},{time,0,6},{{s,0.8},0.3,4},ControlPlacement->Top
Here’s a prettier version:
In[]:=
ManipulateGraphicsDynamic@First@ContourPlot
3Cos5ArcTan[x,y]+
3-Sqrt
2
x
+
2
y
Sin[ArcTan[x,y]]
s

Sqrt[x^2+y^2]
1,{x,-5,5},{y,-5,5},PlotPoints50,ContourStyle->Green,PlotRange{{-3,3},{-3,3}},​​Dynamic@First@Graphics[{Black,Rectangle[{-3,3-time},{3,-3}]}],​​Dynamic@First@ParametricPlot3Cos5θ+
time
s
{Cos[θ],Sin[θ]},{θ,0,Pi},PlotStyleRed,RegionFunction->Function[{x,y,θ},y<3-time],​​Dynamic@First@Graphics[Line[{{-3,3-time},{3,3-time}}]],Axes->False,PlotRange->{{-3,3},{-3,3}},Background->Black,{time,0,6},{{s,0.8},0.3,4},ControlPlacement->Top