% Created 2016-02-12 Fri 13:24
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\usepackage{khpreamble}
\providecommand{\alert}[1]{\textbf{#1}}

\title{Computerized control - Partial exam 1 (20\%)}
\author{Kjartan Halvorsen}
\date{2016-02-10}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs Org-mode version 7.9.3f}}

\begin{document}

\maketitle

\section*{Instructions}
\label{sec-1}

Write your answers clearly and motivate well! You can write by hand or on a computer. If you write by hand, you may scan your pages using, for instance, the app CamScanner that can produce pdf-documents. \textbf{Answers should be handed in on Blackboard (assignment ``Partial exam 1'') no later than midnight 2016-02-11.}
\section*{The plant}
\label{sec-2}

The dynamic model of a particular industrial induction motor\footnote{Jung, Seul, and Richard C. Dorf. ``Analytic PIDA controller design technique for a third order system.'' Decision and Control, 1996., Proceedings of the 35th IEEE Conference on. Vol. 3. IEEE, 1996.
 } can be written
\begin{equation}
G(s) = \frac{168}{s(s^2 + 25.9s + 168)}
\label{eq:plantmodel}
\end{equation}
\section*{Problem 1 (10p)}
\label{sec-3}

  Determine the poles of the continuous-time model and plot these in the imaginary plane.
\section*{Problem 2 (50p)}
\label{sec-4}

  Obtain a sampled model of the plant in \eqref{eq:plantmodel} using zero-order-hold sampling for arbitrary $h$ (sample the model symbolically). You may express the pulse-transfer function as a sum of rational functions in $z$ (you do not have to write it on a common fraction line).

\section*{Problem 3 (10p)}
\label{sec-5}

  Choose a reasonable value for the sampling period $h$, considering the poles of the plant $G(s)$, and using the rule-of-thumb in Åström \& Wittenmark section 2.9.
\section*{Problem 4 (20p)}
\label{sec-6}

  Determine the poles of the discrete-time system using the sampling period you decided in Problem 3. Plot the poles in the imaginary plane. For each pole, indicate which continuous-time pole it corresponds to.
\section*{Problem 5 (10p)}
\label{sec-7}

  The unit delay in discrete-time has pulse-transfer function \[H(z) =\frac{1}{z}\] with a single pole in the origin. Where is the pole of the corresponding continuous-time system?
\section*{Solutions}
\label{sec-8}
\subsection*{Problem 1}
\label{sec-8-1}

   The continuous-time poles are
   \begin{center}
   %\includegraphics[width=0.5\linewidth]{ct-poles}
   \includegraphics[]{ct-poles}
   \end{center}

\subsection*{Problem 2 - Sampled model}
\label{sec-8-2}
\subsubsection*{1}
\label{sec-8-2-1}

  Find the step-response in the Laplace-domain by partial fraction decomposition. This gives (with the help of a symbolic math tool)
       \begin{equation*}
        \begin{split}
         Y(s) &= \frac{G(s)}{s} = \frac{168}{s^2(s^2 + 25.9s + 168)}\\
              &= \frac{1}{s^2} - \frac{0.15417}{s} + \frac{0.15417s + 2.993}{s^2 + 25.9s + 168}.
        \end{split}
       \end{equation*}
      The last term can be written on the form
      \[ \frac{0.15417s + 2.993}{s^2 + 25.9s + 168} = b_1\frac{s+a}{(s+a)^2 + \omega^2} + b_2\frac{\omega}{(s+a)^2 + \omega^2}, \]
      with
      \[ a = 12.95, \quad \omega=0.5454. \]
      \[ b_1 = 0.15417, \quad b_2 = 1.8269\]
      We can then use the formulas for the laplace-transform of exponentially decaying sine- and cosines
      \[ \mexp{-at}\cos(\omega t) \quad \underset{\longleftrightarrow}{\mathcal{L}} \quad \frac{s+a}{(s+a)^2 + \omega^2} \]
      \[ \mexp{-at}\sin(\omega t) \quad \underset{\longleftrightarrow}{\mathcal{L}} \quad \frac{\omega}{(s+a)^2 + \omega^2} \]
\subsubsection*{2.}
\label{sec-8-2-2}

    Apply the inverse laplace transform on each of the terms to get $y(t)$:
       \begin{equation*}
        \begin{split}
         y(t) &= \laplaceinv{Y(s)} = \laplaceinv{\frac{1}{s^2}} - \laplaceinv{\frac{0.15417}{s}} \\
              & \quad + \laplaceinv{0.15417\frac{s+12.95}{(s+12.95)^2 + 0.5454^2}}\\
              & \quad + \laplaceinv{1.8269\frac{0.5454}{(s+12.95)^2 + 0.5454^2}}\\
              &= tu(t) - 0.15417u(t) + 0.15417\mexp{-12.95t}\cos(0.5454t) + 1.8269\mexp{-12.95t}\sin(0.5454t).
     \end{split}
    \end{equation*}
\subsubsection*{3.}
\label{sec-8-2-3}

    Sample and apply z-transform
   The sampled step-response becomes (note that $u(kh) = u(k)$)
    \begin{equation*}
     \begin{split}
      y(kh) &= hku(k) - 0.15417u(k) + 0.15417\left(\mexp{-12.95h}\right)^k\cos(0.5454hk) + 1.8269\left(\mexp{-12.95h}\right)^k\sin(0.5454hk).
     \end{split}
    \end{equation*}
   From the table of z-transforms we get
    \begin{equation*}
     \begin{split}
      Y(z) &= \frac{hz}{(z-1)^2} - \frac{0.15417z}{z-1} \\
           &\; + 0.15417 \frac{z(z-\mexp{-12.95h}\cos(0.5454h))}{z^2 - 2\mexp{-12.95h}\cos(0.5454h)z + \mexp{-2\cdot{}12.95h}}\\
           & \quad + 1.8269 \frac{z\mexp{-12.95h}\sin(\0.5454h)}{z^2 - 2\mexp{-12.95h}\cos(0.5454h)z + \mexp{-2\cdot{}12.95h}}.
     \end{split}
    \end{equation*}
\subsubsection*{4}
\label{sec-8-2-4}

    Divide by $U(z) = \frac{z}{z-1}$
       \begin{equation*}
        \begin{split}
         H(z) &= \frac{Y(z)}{U(z)} = \frac{h}{z-1} - 0.15417\\
              &\; + 0.15417 \frac{(z-1)(z-\mexp{-12.95h}\cos(0.5454h))}{z^2 - 2\mexp{-12.95h}\cos(0.5454h)z + \mexp{-2\cdot{}12.95h}}\\
              &\quad + 1.8269 \frac{(z-1)\mexp{-12.95h}\sin(\0.5454h)}{z^2 - 2\mexp{-12.95h}\cos(0.5454h)z + \mexp{-2\cdot{}12.95h}}\\
      &= \frac{h-0.15417z + 0.15417}{z-1}\\ &\; + \frac{(z-1)\big(0.15417(z-\mexp{-12.95h}\cos(0.5454h)) + 1.8296\mexp{-12.95h}\sin(\0.5454h)\big)}{(z-\mexp{-12.95h}\cos(0.5454h))^2 + \mexp{-12.95h}\sin^2(0.5454h)}.
        \end{split}
       \end{equation*}
\subsection*{Problem 3 - choose sampling period}
\label{sec-8-3}

   The dynamics of the system is governed by the two complex-conjugated poles. These are almost completely damped, with
   \[ \zeta = \frac{12.95}{\sqrt{12.95^2 + 0.5454^2}} \approx 0.999. \]
   and
   \[ \phi = \cos^{-1}(\zeta) = 0.042. \]
   This gives for the epxression for rise time of a second order system (Å\&W 2.9)
   \[ T_r \approx \omega_0^{-1}\mexp{\phi/\tan(\phi)} = \omega_0^{-1}2.72. \]
   It is suitable with 4-10 sampling periods per rise time. This gives
   \[ (4-10)h \approx \omega_0^{-1}2.72 \]
   or
   \[ h \approx \omega_0^{-1} (0.272 - 0.68) \]
   with
   \[ \omega_0 = \sqrt{0.5454^2 + 12.95^2} = 12.96 \]
   \[ h \approx 0.021 - 0.052. \]
\subsection*{Problem 4 - plot the discrete-time poles}
\label{sec-8-4}

   With \(h=0.025\) the poles are
   \begin{align*}
   z_1 &= \mexp{-12.95h}\cos(0.5454h) + i\mexp{-12.95h}\sin(0.5454h) \approx = 0.723 + i0.010\\
   z_2 &= \mexp{-12.95h}\cos(0.5454h) - i\mexp{-12.95h}\sin(0.5454h) \approx = 0.723 - i0.010\\
   z_3 &= 1
   \end{align*}
   and  plotted below
   \begin{center}
   \includegraphics[width=0.8\linewidth]{dt-poles}
   \end{center}
\subsection*{Problem 5 - pole of the continuous-time delay}
\label{sec-8-5}

   The pole of a transfer function $G(s)$ is a value of $s$ for which the value of the transfer function goes to infinity. The continuous-time transfer function corresponding to a unit delay in discrete time (delay of $h$) is
   \[ G(s) = \mexp{-sh}. \]
   The value of the transfer function goes to infinity as \( s \to -\infty\). Hence the pole is at minus infinity.

   Or, in other words a pole at minus infinity is mapped to zero through the mapping
   \[ z = \mexp{sh} \]
   that relates continuous- and discrete-time poles.

\end{document}


\documentclass[aps,pra,notitlepage,amsmath,amssymb,letterpaper,12pt]{revtex4-1}
\usepackage{amsthm}
\usepackage{graphicx}
%  Above uses the Americal Physical Society template for Physical Review A
%  as a reasonable and fully-featured default template

%  Below define helpful commands to set up problem environments easily
\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}}

% --------------------------------------------------------------
%                   Document Begins Here
% --------------------------------------------------------------

\begin{document}

\title{Classwork 01}
\author{Sharon Kim, Kynan Barton, Kristalee Lio}
\affiliation{CS 510, Schmid College of Science and Technology, Chapman University}
\date{\today}

\maketitle
\section{Abstract}
\noindent The derivative is one of the core concepts of calculus. After mastering derivatives, students can apply them to various fields such as statistics, engineering, economics, medicine, etc. This paper provides the first step in understanding derivatives by giving you the definition of a derivative in algebraic and graphical terms. A step by step example is also provided to illustrate how to use the definition of a derivative to calculate the derivative of a function.

\section{The Derivative}

\noindent \textbf{Definition.}
Let \textbf{\textit{y = f(x)}} be a function. The derivative of f is the function whose value at \textbf{\textit{x}} is the limit provided this limit exists.

\begin{align*}
f'(x) &= \lim_{h \to 0} \frac{f(x+h)-f(x)}{h}.
\end{align*}

\noindent If this limit exists for each \textbf{\textit{x}} in an open interval \textbf{\textit{I}}, then we say that \textit{f} is differentiable on \textbf{\textit{I}}.

\bigskip
\noindent \textbf{Example.}
Find the derivative of the following function using the definition of the derivative.
\begin{align*}
f(x) &= 2x^2-16x+35
\end{align*}

\noindent \textbf{Solution.}
Plug this function into the definition of the derivative, and do some algebra. First plug the function into the definition of the derivative. Then multiply everything out. Notice that every term in the numerator that did not have an h in it cancelled out. We can now factor an h out of the numerator which we will cancel against the h in the denominator. After that, we can compute the limit.
\begin{align*}
f'(x) &= \lim_{h \to 0} \frac{f(x+h)-f(x)}{h} \\
&= \lim_{h \to 0} \frac{2(x+h)^2 -16(x+h) +35 -(2x^2-16x+35)}{h} \\
&= \lim_{h \to 0} \frac{2x^2 +4xh +2h^2 -16x -16h +35 -2x^2+16x-35}{h}\\
&= \lim_{h \to 0} \frac{4xh +2h^2 -16h}{h} \\
&= \lim_{h \to 0} \frac{h(4x+2h-16)}{h} \\
&= \lim_{h \to 0} 4x+2h-16 \\
f'(x) &= 4x-16
\end{align*}

\noindent \textbf{Figure.}

\begin{figure}[h!]
 \includegraphics[width=0.6\textwidth]{derivativedefinition.JPG}
  \caption{}
  \label{fig:figlabel}
\end{figure}

\noindent Figure 1 shows a graphical representation of the definition of a derivative. f'(x) represents the slope of f(x) at an arbitrary point in it's domain.

\section{References}
\noindent Lawrence S. Husch. \textit{Husch: Definition of Derivative.} \\ URL: http://archives.math.utk.edu/visual.calculus/2/definition.12/
\\
\\
\noindent Paul Dawkins. \textit{Dawkins: The Definition of the Derivative.} \\ URL: http://tutorial.math.lamar.edu/Classes/CalcI/DefnOfDerivative.aspx
\\
\\
\noindent \textit{Limits and Derivatives} URL: https://learnmathforfree.jimdo.com/calculus/limits-and-derivatives/
\\
\\
\noindent Jeff Cruzan. \textit{Cruzan: The Derivative} URL: http://www.drcruzan.com/TheDerivative.html

\end{document}


\documentclass{beamer}
\usetheme{Copenhagen}

\title{Introduction to Python}
\usepackage{listings}
\subtitle{Objects 2: Inheritance and Hooks}
\date{}
\newcommand{\snippet}{\lstinline}
\begin{document}
\definecolor{keywords}{RGB}{255,0,90}
\definecolor{comments}{RGB}{0,0,113}
\definecolor{red}{RGB}{160,0,0}
\definecolor{green}{RGB}{0,150,0}
\lstset{language=Python,
        basicstyle=\ttfamily\small,
        keywordstyle=\color{keywords},
        commentstyle=\color{comments},
        stringstyle=\color{red},
        showstringspaces=false,
        identifierstyle=\color{green},
        procnamekeys={def,class}}
\begin{frame}
  \titlepage
\end{frame}

\section{Inheritance}

\begin{frame}[fragile]{Why Objects?}
 	Object-oriented programming can be used for:
 	\begin{itemize}
 		\item Encapsulation
 		\item Abstraction
 		\item \textbf{Code reuse}
 	\end{itemize}
\end{frame}

\begin{frame}[fragile]{Inheritance}
	\begin{itemize}
	\item { Inheritance is a mechanism by which one class \textbf{inherits} code from another class.
	}
	\pause
	\item {Best seen by example. Lets write a program to model cars.
  \begin{block}{}
\begin{lstlisting}{frame=single}
class Car():
    def changeGear(self, gear):
        self.gear = gear

    def printMe(self):
        print "I'm a car."
\end{lstlisting}
\end{block}
	}
	\end{itemize}
\end{frame}
\begin{frame}[fragile]{Inheritance}
  \begin{block}{}
\begin{lstlisting}{frame=single}
class Car():
    def changeGear(self, gear):
        self.gear = gear

    def printMe(self):
        print "I'm a car."

class Ford(Car):
    def printMe(self):
        print "I'm a Ford!"
x = Ford()
x.printMe() # prints "I'm a Ford!"
x.changeGear(5)
print x.gear #prints 5
\end{lstlisting}
\end{block}

\end{frame}
\begin{frame}[fragile]{How does inheritance work?}
	\begin{itemize}
	\item {Every class inherits from \snippet{object} implicitly.  }
	\pause
	\item {If \snippet{X} inherits from \snippet{Y} then we say \snippet{X} is a \textbf{subclass} of \snippet{Y}.}
	\pause
	\item {When you call a method on an instance the interpreter checks if the class has that method. If not it looks up the inheritance chain until it finds it.}
	\end{itemize}
\end{frame}
\begin{frame}[fragile]{Constructors of Subclasses}
If you need to initialise data then you must tell your superclass to initialise itself as well.
  \begin{block}{}
\begin{lstlisting}{frame=single}
class Dog():
    def __init__(self, colour):
        self.colour = colour

class BlackDog(Dog):
    def __init__(self, name):
        Dog.__init__(self, "Black")
        self.name = name
\end{lstlisting}
\end{block}
Make sure to initialise everything in the superclass before setting up the subclass.
\end{frame}
\section{Hooks}
\begin{frame}[fragile]{What is a hook?}
	\begin{itemize}
	\item { Consider the following code:
  \begin{block}{}
\begin{lstlisting}{frame=single}
print 1+2 #  3
print "h" + "i" # hi
print ["h"] + ["i"] # ["h","i"]
\end{lstlisting}
\end{block}
	}
	\pause
	\item {All of these types (\snippet{int}, \snippet{str}, \snippet{list}) know how to respond
	to \snippet{print} and \snippet{+}.}
	\pause
	\item { Using \snippet{print} on our classes so far has resulted in fairly useless output.}
	\end{itemize}
\end{frame}
\begin{frame}[fragile]{What is a hook?}
	\begin{itemize}
	\item { Recall the \snippet{Rational} class from last time:
  \begin{block}{}
\begin{lstlisting}{frame=single}
class Rational():
    def __init__(self, numerator, denominator):
        self.numerator = numerator
        self.denominator = denominator

half = Rational(1,2)
print half
\end{lstlisting}
\end{block}
	Prints "\_\_main\_\_.Rational instance at 0x10a183440"
	}
	\pause
	\item {Because I haven't told \snippet{Rational} how to respond to print, it defaults to printing
	its location in memory.}
	\pause
	\item {Bonus question: how does it know how to do that?}
	\end{itemize}
\end{frame}

\begin{frame}[fragile]{What is a hook?}
	\begin{itemize}
	\item { Let's fix that behaviour:
  \begin{block}{}
\begin{lstlisting}{frame=single}
class Rational():
    def __init__(self, numerator, denominator):
        self.numerator = numerator
        self.denominator = denominator

    def __repr__(self):
        return str(self.numerator) + '/' + str(self.denominator)
\end{lstlisting}
\end{block}
	}
	\pause
	\item { \snippet{__repr__} is a \textbf{hook} that the statement \snippet{print} calls on
	it's arguments.}
	\pause
	\item {This is very useful for keeping track of what your program is doing!}
	\item {\snippet{__} is pronounced \textbf{dunder}- so dunder repr}
	\end{itemize}
\end{frame}

\begin{frame}[fragile]{Important Hooks}
	There are a ton of hooks that you can decide whether to implement for your class. Here are a few I find useful (see Python documentation for full list):
	\begin{itemize}
	\item {\snippet{__eq__(self, other)}: How to respond to comparison with \snippet{==}.}
	\item {\snippet{__add__(self,other)}: How to respond to \snippet{+}}.
	\item{\snippet{__getitem__(self,other)}: implement access to data using the \snippet{x[integer]} notation.}
	\end{itemize}
	Use wisely. If you don't think hard about this you can really confuse your users (or yourself)!
\end{frame}

\subsection{Demo}
\begin{frame}[fragile]{Demo}
	 \huge{\textbf{Demo Time!}}
\end{frame}

\end{document}


\documentclass[letterpaper]{article}

\usepackage{gensymb}
\usepackage[vmargin=1in,hmargin=1.25in]{geometry}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{microtype}
\usepackage{lmodern}

\author{Philip Pham}
\title{ECE/CSE 576, Spring 2019 Homework 1: Filtering, Edge finding, and Clustering}
\date{\today}

\begin{document}
\maketitle

\section*{Task 1: Convolution}

For this task, we implement a general convolution method for linear filters. My
code can be found at
\href{https://github.com/ppham27/cse576/blob/master/hw1/Code/Project1.cpp\#L216}{\texttt{Convolution}}. The
run time complexity is $O\left(HWCK_wK_h\right)$, where $H$ is the height of the
imate, $W$ is the width of the image, $C$ is the number of channels, $K_w$ is
the width of the kernel, and $K_h$ is the height of the kernel.

\section*{Task 2: Gaussian Blur}

In this task, we apply the Gaussian blur filter.

\begin{center}
\includegraphics[width=0.85\textwidth]{task2.png}
\end{center}

$\sigma = 4.0$ was used. The darkened borders are due to zero padding.

\section*{Task 3: Separable Gaussian Blur}

The separable Gaussian blur applies a vertical and horizontal Gaussian blur
filter separately.

\begin{center}
\includegraphics[width=0.85\textwidth]{task3.png}
\end{center}

The results are the same as Task 2, which demonstrates the commutativity as
associativity of convolutions.

\section*{Task 4: Image derivatives}

In this task we compute derivatives to help detect edges.

\begin{center}
  \includegraphics[width=0.85\textwidth]{task4a.png}

  $x$-derivative of \texttt{LadyBug.jpg} with $\sigma = 1.0$.
\end{center}

\begin{center}
  \includegraphics[width=0.85\textwidth]{task4b.png}

  $y$-derivative of \texttt{LadyBug.jpg} with $\sigma = 1.0$.
\end{center}

\begin{center}
  \includegraphics[width=0.85\textwidth]{task4c.png}

  Second derivative of \texttt{LadyBug.jpg} with $\sigma = 1.0$.
\end{center}

\section*{Task 5: Image Sharpening}

By substracting the second derivative from the original image, we can sharpen
it.

\begin{center}
  \includegraphics[width=0.85\textwidth]{task5.png}

  \texttt{Yosemite.png} sharpened with $\sigma = 1.0$ and $\alpha = 5.0$.
\end{center}

\section*{Task 6: Edge Detection}

The Sobel operator can be used to detect edges.

\begin{center}
  \includegraphics[width=0.85\textwidth]{task6.png}

  The Sobel operator is applied to \texttt{LadyBug.jpg}.
\end{center}

\section*{Task 7: Bilinear Interpolation}

Bilinear interpolation is used to rotate an image.

\begin{center}
  \includegraphics[width=0.9\textwidth]{task7.png}

  \texttt{Yosemite.png} rotated by 20\degree.
\end{center}

\section*{Task 8: Finding edge peaks}

Edge peaks are found with a combination of the Sobel operator and bilinear
interpolation. The Sobel operator gives us a pixel's magnitude and
orientation. With bilinear interpolation we can get the magnitude of the two
neighboring perpendicular pixels. If the pixel is an edge peak, it should have
the greatest magnitude.

\begin{center}
  \includegraphics{task8.png}

  Edge peaks for \texttt{Circle.png} with a threshold of $40.0$.
\end{center}

\section*{Task 9: K-means color clustering}

Each pixel of an image can be seen as belonging to a cluster based on its
colors. Lloyd's algorithm with the $l_1$ norm is used to cluster the pixels.

\section*{Task 9a: With random seeds}

One way to initialize the clusters is randomly.

\begin{center}
  \includegraphics[width=0.85\textwidth]{task9a.png}

  K-means clustering applied to \texttt{Flower.png} with 4 clusters initialized
  randomly.
\end{center}

\section*{Task 9b: With pixel seeds}

Another way to initialize the clusters is by selecting a subset of pixels to be
initial seeds.

\begin{center}
  \includegraphics[width=0.85\textwidth]{task9b.png}

  K-means clustering applied to \texttt{Flower.png} with 5 clusters initialized
  from pixel seeds.
\end{center}

\section*{Bells: Reflected padding}

As seen in Tasks 2 and 3, one downside of zero padding is that the intensity of
the border points change. Padding by reflecting along the image borders can fix
this.

\begin{center}
  \includegraphics[width=0.824\textwidth]{reflectedpaddingtaskborder.png}

  \texttt{Seattle.jpg} padded out. The original border is shown in red.
\end{center}

\begin{center}
  \includegraphics[width=0.8\textwidth]{reflectedgaussianblur.png}

  Gaussian blur with $\sigma = 4.0$ applied to a padded with reflection \texttt{Seattle.jpg}.
\end{center}

The pixel intensity along the border is now maintained in constrast to Tasks 2 and 3.

\section*{Bells: Histogram K-means}

In Task 9b, selecting clusters from the empirical distribution of pixels can be
noisy. One way to smooth out the distribution is to bucket them into a histogram
and initialize clusters that way. If each color is divided into $8$ buckets,
there will be $8 \times 8 \times 8 = 512$ total buckets.

\begin{center}
  \includegraphics[width=0.85\textwidth]{histogramtask.png}

  K-means clustering of \texttt{Flower.png} into 5 clusters initialized from a
  histogram.
\end{center}

\section*{Bells: Median Filter}

Taking the median intensity of of a neighborhood can smooth and reduce noise.

\begin{center}
  \includegraphics[width=0.7\textwidth]{mediantasknoise.png}

  Noisy black and white version of \texttt{Seattle.jpg}.

  \includegraphics[width=0.7\textwidth]{mediantask.png}

  Noise reduction on greyscale version of \texttt{Seattle.jpg} with a median
  filter of radius 2.
\end{center}

\section*{Whistles: Bilateral Filter}

The bilateral filter is similar to the Gaussian filter in that it smooths and
reduces noise. By using a weighted average of pixel intensity, it preserves
sharp edges.

\begin{center}
  \includegraphics[width=0.85\textwidth]{bilateraltask.png}

  Bilateral filter applied to \texttt{Yosemite.png} with $\sigma_S = 2.0$ and
  $\sigma_I = 20.0$.
\end{center}

\section*{Whistles: Hough Transform}

The Hough transform takesas input edge peaks. For each edge peak pixel, the
Hough transform considers all the lines that the pixel could possibly be part of
by considering all $\theta$ in polar $\left(r, \theta\right)$ space. The most
likely lines are returned and merged with the edge peaks are filtered based on
these lines to get line segments.

\begin{center}
  \includegraphics[width=0.6\textwidth]{houghtask1.png}
  \includegraphics[width=0.6\textwidth]{houghtask2.png}
  \includegraphics[width=0.6\textwidth]{houghtask3.png}

  Identifying line segments with the Hough transform in \texttt{Flags.png}. The
  original image, edge peaks, and the result of the Hough transform are shown.
\end{center}

\section*{Appendix}

All code used to generate these images can be found at
\href{https://github.com/ppham27/cse576/blob/master/hw1}{\texttt{ppham27/cse576/hw1}}. The
embedded PNG files and the \LaTeX can be found in
\href{https://github.com/ppham27/cse576/blob/master/hw1/report}{\texttt{ppham27/cse576/hw1/report}}.

\end{document}