\documentclass[12pt]{article}
\renewcommand{\baselinestretch}{1.35}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{times}
\usepackage{latexsym}
\usepackage{graphics}
\usepackage{placeins}
\usepackage{amsmath,amsthm,float,tabularx}
\usepackage[dvips]{graphicx}
\newtheorem{definition}{Definition}
\usepackage{grffile}
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5}
\headheight 10pt
\headsep 10pt
\topmargin 10pt
\oddsidemargin 0pt
\textwidth 170.0mm
\textheight 210.0mm
\renewcommand{\topfraction}{1}
\renewcommand{\bottomfraction}{1}
\renewcommand{\textfraction}{0}
\begin{document}
\markright{CS9630a Assignment 1 2015}
\pagestyle{myheadings}
\pagenumbering{arabic}
\large
\begin{center}
{\Large\bf Assignment 1 CS9630a} \\
{Out: Monday, November3rd, 2015} \\
{In: Monday, November 24th, 2015}
\end{center}
\vspace{0.01in}
\normalsize
\section*{Introduction}
We investigate the processing of images in
both the spatial and frequency domains in this assignment.
Use MatLab to answer these questions.
You MUST use latex to
present the answers to the questions on this assignment.
Include images and graphs resulting from your computations
in your latex answer file. Use MatLab
to make all these images and graphs.
\begin{enumerate}
\item Use latex or pdflatex (better) only (Do {\bf NOT} use Word under any circumstances!).
The $1^{st}$ line of your tex document should be \verb!\documentclass! (do not
use the \verb!documentstyle! statement, its old latex before 2009).
Only \verb!pdflatex! will be use in the explanations below.
\item Always run pdflatex twice to get automatic referencing
correct. Read your output to verify this. Yes, latex is very verbose but
it will tell you if something is wrong!!!
For example, {\bf pdflatex x.tex} generates a pdf file the first time you run it
but citations, equation numbers, table numbers, figure numbers will be unresolved.
So a second execution of \verb!pdflatex! is necessary and then all \verb!?!'s will
be replaced by the correct numbers.
Always look at pdflatex's output to see if there are undefined references; if there are
and you have run pdflatex twice already, fix them (maybe the label is wrong?).
Just typing returns until pdflatex terminates will not give you a good pdf file!!!
\end{enumerate}
Equations are a bit more complicated.
For example, Equations (\ref{eqn1} and (\ref{eqn2})) below gives the 1D Gaussian
functions, $h(x)$, and its Fourier transforms $H(u)$ as
\begin{eqnarray}
h(x) & = & \frac{1}{\sqrt{2\pi} \sigma} e^{\frac{-x^2}{2 \sigma^2}} \label{eqn1} \\
H(u) & = & e^{\frac{-u^2 \sigma^2}{2}} \label{eqn2}.
\end{eqnarray}
$\sigma$ is called the standard deviation as its value determines the
amount of blurring (smoothing) done. Low $\sigma$ values mean little
blurring whereas high $\sigma$ values mean lots of blurring.\\
Equations (\ref{eqn3}) and (\ref{eqn4}) give the 2D Gaussian function, $h(x,y)$ and
its Fourier Transform, $H(u,v)$, as:
\begin{eqnarray}
h(x,y) & = & \frac{1}{2\pi \sigma^2} e^{\frac{-(x^2+y^2)}{2 \sigma^2}} \label{eqn3} \\
H(u,v) & = & e^{\frac{-(u^2+v^2) \sigma^2}{2}} \label{eqn4}.
\end{eqnarray}
The latex to produce these equations is given as:
\begin{verbatim}
\begin{eqnarray}
h(x) & = & \frac{1}{\sqrt{2\pi} \sigma}
e^{\frac{-x^2}{2 \sigma^2}} \label{eqn1} \\
H(u) & = & e^{\frac{-u^2 \sigma^2}{2}} \label{eqn2}.
\end{eqnarray}
\end{verbatim}
and
\begin{verbatim}
\begin{eqnarray}
h(x,y) & = & \frac{1}{2\pi \sigma^2}
e^{\frac{-(x^2+y^2)}{2 \sigma^2}} \label{eqn3} \\
H(u,v) & = & e^{\frac{-(u^2+v^2) \sigma^2}{2}} \label{eqn4}.
\end{eqnarray}
\end{verbatim}
You should not need many equations in this assignment writeup but if you do
look in a latex book or on the web to see how to construct them.
The professor may also be able to help you.
If you use {\bf latex} things are more complicated. Now all image files must
be {\bf eps} files while for {\bf pdflatex} then can be {\bf jpg}, {\bf png} or {\bf pdf} files (but
not {\bf eps} files).
Using a package \verb!\usepackage{grffile}! it is possible to set up {\bf pdflatex}
to take {\bf eps} files as well. It is recommended you do not use latex and
avoid {\bf eps} files all together.
pdflatex is available on both the {\bf gaul}
and {\bf csd} networks. Good versions of latex are available
on the web if you want to install it on your laptop
(The MacTeX-2014 Distribution at https://tug.org/mactex/ for macs,
MikTex at https://tug.org/mactex/ for pcs and Tex Live at https://www.tug.org/texlive/
for linux users).
This assignment handout is a latex document and is available on
the course webpage as {\bf ass1-15.tex}. A shell handin file is also
on the webpage as {\bf ass1-15-answers.tex}. The latter tex file is just ass1-15.tex
with all the latex explanation stuff removed but with the questions remaining.
Just add your answers in
the appropriate sections after each question in this file.
In MatLab, use \verb!imread(f,'file.ras')! to read a rasterfile. Or you can read a
jpeg or tiff file using \verb!imread(f,'file.jpg')! or \verb!imread(f,'file.tif')!.
MatLab can handle about 20+ different file types (look on the web to see what these are).
Use \verb!rgb2gray! as one way to convert a colour image into a grayvalue image.
Use \verb!imshow(f,[])! to display the image and \verb!print file.jpg -djpeg!
or \verb!print file.png -dpng! to write a displayed image or graph
into an \verb!jpg! or \verb!png! file suitable for inclusion in a tex file.
The \verb!print! command will most likely add ``white'' space to your image or
graph, especially is you title or label your image or graph in anyway.
To print an image in MatLab without white space (and without titles or labels)
use \verb!imwrite!.
A figure can be referred to in your latex file
using Figure \verb!\ref{fig1}!, which
appears as Figure \ref{fig1} in your pdf file.
Note that with this automatic labelling, the inserting or deleting of
figures causes the old figure numbers to change when
latex is run again. This works also
for citations, equations labels, table and page numbers. Please
see a latex book for more details \cite{Lamport-1994}
(use \verb!\cite{Lamport-1994}!) in your latex file). This citation
can be used in your latex file with:
\begin{verbatim}
\begin{thebibliography}{99}
\bibitem{Lamport-1994} L. Lamport, ``Latex - A Document
Preparation System - User's Guide and Reference
Manual'', Addison-Wesley Publishing Company,
$2^{nd}$ Edition, 1994.
\end{thebibliography}
\end{verbatim}
at the end of your tex file. Another book by Kopka and Daly
\cite{Kopka-Daly-2004} is also quite good. The use of \verb!bibtex!
is a better option than the use of \verb!bibitem! for your bibliography, see your latex reference
for all the details.
We can also display images in a latex document as shown in Figure \ref{fig1}.
\begin{figure}[htbp]
\begin{center}
\begin{tabular}{c c}
\includegraphics[width=7.62cm]{clip4.440.jpg} &
\includegraphics[width=3.0in]{clip9.040.jpg} \\
{(a) clip4.440.eps} & {(b) clip9.040.jpg}
\end{tabular}
\end{center}
\caption{Images {\bf clip4.440.ras} and {\bf clip9.040.ras}
displayed using {\bf includegraphics} with a width scale
factor of 3.0in or 7.62cm (1in is 2.54cm).}
\label{fig1}
\end{figure}
\newline
\noindent The latex source to make Figure \ref{fig1} is:
\begin{verbatim}
\begin{figure}[htbp]
\begin{center}
\begin{tabular}{c c}
\includegraphics[width=7.62cm]{clip4.440.jpg} &
\includegraphics[width=3in]{clip9.040.jpg} \\
{(a) clip4.440.jpg} & {(b) clip9.040.jpg}
\end{tabular}
\end{center}
\caption{Images {\bf clip4.440.jpg} and {\bf clip9.040.jpg}
displayed using {\bf includegraphics} with a width scale
factor of 3.0in or 7.62cm (1in is 2.54cm).}
\label{fig1}
\end{figure}
\end{verbatim}
The character string
\verb![htbp]! specifies where the figure should be placed. \verb!h!
means here, \verb!t! means top of page, \verb!b! means bottom of
page and \verb!p! means float the image to the next available space.
Latex tries placing the text with the first strategy specified if it can, an so on. It
just might let large figures float to the end of your document.
Note that you can tell latex what to do but it may decide to
ignore you and place the figure where it wants to!!!
You can always force latex to print out all figures and tables
encountered so far (even if they are
floating) using \verb!\clearpage!. On the other hand, \verb!\newpage! just goes to a
new page but does not force floating figures/tables to be printed.
Use {\bf ghostview} (or {\bf acroread} or {\bf preview} (or your favourite program)
to preview your pdf file before printing. [There are lots of other programs to
preview a pdf file on Unix, Linux, Mac and Microsoft.] As we have already seen,
absolute scale sizes can
be specified in {\bf includegraphics} using {\bf width} and {\bf height}.
For example:
\begin{verbatim}
\includegraphics[width=60mm]{x.png}
\includegraphics[height=1.2in]{y.png}
\includegraphics[width=60mm,height=1.2in]{z.png}
\end{verbatim}
Images \verb!x.png! and \verb!y.png! are uniformly scaled so
the width of \verb!x.png! is 60mm and the height of \verb!y.png!
is 1.2 inches while image \verb!z.png! is non-uniformly scaled
(distorted) so that it is 1.2 inches high and 60mm wide.
\verb!clip4.440.jpg! and \verb!clip9.040.jpg! are actually
24-bit colour SUN rasterfile images from a long video sequence
made by a digital camera.
Because these files are video images,
their acquisition is interlaced, i.e. first all even lines
were acquired and second all odd lines were acquired. If you look
carefully at Figure \ref{fig1} you will notice some ``streaking''
in the image because of the motion between the even and odd lines.
We can pull these even and odd lines out and make 2 new colour
images. For the even image we use linear interpolation to compute
the odd lines and for the odd image we use linear interpolation
to compute the even lines. These images have names: \verb!even9.040.png!
and \verb!odd9.040.png!, respectively, and are also on the course webpage.
Figures \ref{fig2}a and \ref{fig2}b shows \verb!even9.040.png! and
\verb!odd9.040.png! for comparison purposes with Figure \ref{fig1}a while
Figures \ref{fig2}c and \ref{fig2}d shows \verb!even4.440.png! and
\verb!odd4.440.png! for comparison purposes with Figure \ref{fig1}b. Note
that the even and odd lines have almost no streakiness and that there
is now a small motion between the two images.
\begin{figure}[htb]
\begin{center}
\begin{tabular}{c c}
\includegraphics[width=3.0in]{even4.440.png} &
\includegraphics[width=3.0in]{odd4.440.png} \\
{(a) even4.440.png} & {(b) odd4.440.png} \\
\includegraphics[width=3.0in]{even9.040.png} &
\includegraphics[width=3.0in]{odd9.040.png} \\
{(c) even9.040.png} & {(d) odd9.040.png}
\end{tabular}
\end{center}
\caption{The four images: (a) even4.440.png, (b) odd4.440.png,
(c) even9.040.png and (d) odd9.040.png}
\label{fig2}
\end{figure}
\noindent The latex source to make Figure \ref{fig2} is:
\begin{verbatim}
\begin{figure}[htb]
\begin{center}
\begin{tabular}{c c}
\includegraphics[width=3.0in]{even4.440.png} &
\includegraphics[width=3.0in]{odd4.440.png} \\
{(a) even4.440.png} & {(b) odd4.440.png} \\
\includegraphics[width=3.0in]{even9.040.png} &
\includegraphics[width=3.0in]{odd9.040.png} \\
{(c) even9.040.png} & {(d) odd9.040.png}
\end{tabular}
\end{center}
\caption{The four images: (a) even4.440.png, (b) odd4.440.png,
(c) even9.040.png and (d) odd9.040.png}
\label{fig2}
\end{figure}
\end{verbatim}
Use \verb!\clearpage!
to print out all the images for a question before you start the
answer to the next question. Put the relevant MatLab code with formulae
(in latex) with your answers. Include the parts of your program listing
relevant to each question in your answers in your writeup.
Finally, please staple your assignment writeup and your program
listing on the {\bf left} and {\bf NOT} on the {\bf right}.
For your computed images, label and caption
each image using latex's labelling/captioning capability
(see the latex version of this file {\bf ass1-15.tex}
on the course webpage for a latex example, copy it and modify it
as needed).
Note that a caption should be a stand-alone brief description of
the image(s) in a figure. That is, after reading a caption, the
reader should have a good idea of what the images are. Longer
more detailed descriptions are also given in the text (there is some redundancy).
Captions like ``q1.1.3'' are {\bf not} appropriate.
Put all equations/mathematical expressions
in equation mode. Use \verb!$x$! in a sentence to print $x$ in
equation mode. Use
\verb!\begin{equation}! - \verb!\end{equation}! or
\verb!\begin{displaymath}! - \verb!\end{displatmath}!
(equations without numbers) to display equations.
[Remember: you have to run pdflatex twice to get the latex labelling to work.]
Group each question's answer(s) together and in the correct
order. Failure to follow these presentation instructions will reflect
negatively on your grade. And again, {\bf DON'T} even think of using
WORD to do this assignment!
The correct way to create the latex document with your answers is to insert your
answers in \verb!ass1-15-answers.tex!. That is:
\begin{enumerate}
\item Re-state the question (copy it from ass1-15.tex, done in \verb!ass1-15-answers.tex!),
\item For each question, place the relevant code segments
(between \verb!\begin{verbatim}! and \verb!\end{verbatim}!
pairs).
\item Include any English language descriptions/comments as required.
\item Include appropriately captioned images and graphs.
\item Give your discussion and conclusions at the end of each
question's (sub-question's answer).
\item Use \verb!\clearpage!
to flush latex's buffer after printing the answer to each question (all floating figures
and text will be forced to print before any further processing is done).
\end{enumerate}
Remember, the captions for your figures and your text should
be reasonably independent of each other. The descriptions in
the captions should be brief but should indicate concisely
what the figures are about. I should be able to read the caption
and understand (roughly) what the images are about.
Submit \verb!5! files for this assignment, namely:
\begin{enumerate}
\item \verb!ass1_barron_123456789_2015_1.m!,
\item \verb!ass1_barron_123456789_2015_2.m!,
\item \verb!ass1_barron_123456789_2015_3.m!,
\item \verb!ass1_barron_123456789_2015_4.m! and
\item \verb!ass1_barron_123456789_2015.pdf!.
\end{enumerate}
Replace my surname with your surname and my (pseudo) student number with your (real)
student number. MatLab code files
have the answers for each of the \verb!n=4! questions below, where
\verb!n! is a question number.
\verb!ass1_barron_123456789_2015.pdf! is, of course, my pdf answer file.
You must zip these 5 MatLab files into a file names with
your assignment number, surname, student number and year, for example,
\verb!ass1_barron_2015_123456789.zip!. You could put these files
in an appropriately named directory and zip that directory.
Do NOT include you image files in this zip file, as
these can be reproduced by running your code if necessary.
When your assignment is finished do the following:
\begin{enumerate}
\item Pass in a hardcopy of your assignment writeup, \verb!ass1_barron_123456789_2015.pdf!
plus the 4 question MatLab code files, \verb!ass1_barron_123456789_2015_1.m!\\ to
\verb!ass1_barron_123456789_2015_4.m!,
to the professor (you can slip it under my door of my office MC379). Note
that this assignment is due at midnight on November $24^{th}$.
\item Email your zipped file to the professor at {\bf barron@csd.uwo.ca} by midnight
on November $24^{th}$.
\end{enumerate}
Although the due date is midnight November $24^{th}$ I will consider on time
any assignment I receive by the time I come to my office on November $25^{th}$.
Use a spell checker on your tex file. {\bf ispell} is recommended as it understands latex somewhat
and won't suggest that all latex keywords are spelling errors.
It is ok to use another system (other than gaul or csd) to
do this assignment but remember that all your code must run on our
system and your answer file must be in latex.
Finally, remember
that {\bf independent} work is required for all assignments in
this course. In particular, do not pass off copied code as your own code.
If you take code from the webpage, you must reference it (using a footnote).
{\bf NOTE:} When answering the questions below you can use shell
latex file {\bf ass1-15-answers.tex} available on the course webpage. If you
use code from the web you should not expect an optimal grade.
\vspace*{-0.15in}
\section*{Preamble to Questions}
\vspace*{-0.1in}
In this assignment writeup, $f(x,y)$ will
refer to image intensity values (0-255) and $F(u,v)$ will refer
to its Fourier Transform (FT). You'll probably always want to
do translation to (0,0) on all your images before and undo this
translation after
taking the FT (in MatLab, use \verb!fftshift! and \verb!ifftshift! to do this).
If the image specified is in colour and you requires its grayvalue equivalent,
use \verb!rgb2gray!.
If you show an image with some feature, display it large enough
to see to see that feature. Use the \verb!help command! in MatLab
to find out the details of a \verb!command!.
Consider the 24bit colour image \verb!lena.jpg!, available on the course webpage. This
image is a $512 \times 512$ image originally use in image compression studies.
\begin{figure}[htb]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=3.0in]{lena.jpg}
\end{tabular}
\end{center}
\caption{The lena image: {\bf lena.jpg}, available on the course webpage.}
\label{fig1-1}
\end{figure}
Some {\bf m-files} in chapters 2 and 3 of the course textbook
\cite{Gonzalez-et-al-2004,Gonzalez-et-al-2009} are available on the course webpage
(password protected like the notes).
Fell free to use any or none of these in your answers.
You do not need to pass in the listing of these file
on your assignment hand-in if you use any of them.
Lastly, try to {\bf vectorize} your MatLab code as
much as possible.
\clearpage
\noindent (1) (20\%) QUESTION\\
This is {\bf copy} question.
For this question, wherever you need to ``translate to the origin'', multiply each
grayvalue at location $(x,y)$ by $-1^{x+y}$. Do NOT use \verb!fftshift! or
\verb!ifftshift!. Answer the following questions:
\begin{enumerate}
\item Construct a $512 \times 512$ grayvalue image from the blue plane of lena.jpg.
(1 image required).
\item Construct a $512 \times 512$ spike image (1 at the center and 0 everywhere else).
(1 image required). Can you see the bright
center pixel?
\item In the spatial domain, show the result of convolving the blue lena image
and spike image (1 image required).
\item Translate the blue lena and spike images to the origin (call them $f$ and $h$)
and compute their FFTs, $F$ and $H$. Multiple these arrays together, element by element,
to get $G$, compute the inverse FFT of $G$ (call it $g$), and then translate
that result to the origin.
Show the $g$ image (1 image required).
\item Display both the \verb!abs(G)!
and the \verb!log(1+abs(G))! images (2 images required).
\end{enumerate}
Discuss and explain your results.\\[-0.1in]
\noindent ANSWER:
\clearpage
\noindent (2) (20\%) QUESTION\\
This the {\bf filtering question}.
Consider the Butterworth bandreject and bandpass filters:
\begin{displaymath}
H_{reject} (u,v) ~ = ~ \frac{1}{1+\left[ \frac{D(u,v)W}{D^2 (u,v) - D_0^2 }\right]^{2n}}
\end{displaymath}
and
\begin{displaymath}
H_{pass}(u,v) = 1-H_{reject} (u,v),
\end{displaymath}
where $W$ is the band width, $D_0$ is the band center and $D(u,v)$ is now
the distance from the center of the Fourier Transform. Use $n=1$ for this question.
Use the red plane of the lena.jpg image for this question.
\begin{enumerate}
\item Consider $D_0=0.05$ and $W=0.1$. How the resulting images for the bandreject
and bandpass filters applied to this image. This question requires 2 images.
\item For these $D_0$ and $W$ values, show the images:
\begin{enumerate}
\item when bandreject filtering is first performed and then bandpass filtering
on that result is performed and
\item when bandpass filtering is first performed and then bandreject filtering
on that result is performed.
\end{enumerate}
This question requires 2 images.
\item What happens when $n$ is changed to 5 for the above 2 filtering scenarios.
This question requires 4 images.
\end{enumerate}
Show and discuss your results in your writeup.\\[-0.1in]
\noindent ANSWER:
\clearpage
\noindent (3) (28\%) QUESTION\\
This is the {\bf sampling} question.
This question concerns sampling and the 1D Fourier Transform.
Generate a $4096$ 1D signal, $S^\prime(x)$, created by summing three
1D sinusoids. Use the following equation to make the sinusoid as:
\begin{displaymath}
S(x) ~ = ~ C \left[
\cos \left( \frac{2\pi}{\lambda_1} x \Delta x \right) +
\cos \left( \frac{2\pi}{\lambda_2} x \Delta x \right) +
\cos \left( \frac{2\pi}{\lambda_3} x \Delta x \right) \right],
\end{displaymath}
where $\lambda_1=16$, $lambda_2=32$ and $\lambda_2=64$ are the
spatial wavelengths of the sinusoid.
(these are the number of pixels per cycle for the sinusoids)
and $C$ is a constant equal to 1.0. These wavelengths correspond
to frequencies $f_1=0.062500$, $f_2=0.031250$ and $f_3=0.015625$ respectively.
Note that $\cos$ is $\sin$ out of phase by $\pm90^\circ$.
$x$ is the 4096 component vector \verb!0:4095!.
$\Delta x$ is the sampling rate, for this assignment we are interested
in $\Delta x \in$ \verb![4 24 48 96]!.
This means the frequencies of the signal are the vector:
\begin{displaymath}
\frac{\left(\frac{-1}{2} \right)}{\Delta x}:\frac{\frac{1}{4096}}{\Delta x}:\frac{\left(\frac{1}{2}-\frac{1}{4096} \right)}{\Delta x}.
\end{displaymath}
When sampling each value $(\Delta x=1)$, the minimum wavelength is 2
(maximum frequency magnitude 1/2) but when sampling every second value only
$(\Delta x=2)$ the minimum wavelength is 4 (maximum frequency magnitude 1/4).
You have to take this into account when analyzing your results.
We are interested in ``significant'' Fourier Transform values (significant
is when the magnitude of the response is $\geq$ $1.0^{-6}$.
Can the information at the 3 frequencies be recovered
for various $\Delta x$ values? In particular:
\begin{enumerate}
\item When $\Delta x=4$ what frequencies be recovered?
\item When $\Delta x=24$ what frequencies be recovered?
\item When $\Delta x=48$ what frequencies be recovered?
\item When $\Delta x=96$ what frequencies be recovered?
\end{enumerate}
Show your answers by printing the complex FT responses, their amplitudes,
frequencies and phases for FT responses that are significant (too keep
the output manageable).
Show and explain your results.
Note that you may find the following MatLab functions useful:
\verb!abs(x)! returns the magnitude of complex number \verb!x! while
\verb!real(x)! and \verb!imag(x)! return the real and imaginary parts
of \verb!x! as real numbers, \verb!find! can be used to find the coordinates
of a vector for those values satisfying some condition (i.e.
\verb!find(abs(F)>=1.0^{-6})! find the coordinates of the FT responses in
\verb!F! $\geq 1.0^{-6 }$ and \verb!atan(imag(x)/real(x))*180/pi! gives the phase of
complex number \verb!x! in degrees. Since some frequencies are close together,
if you use \verb!plot! to display your FT results,
it may not be easy to distinguish between all the responses. Instead of \verb!plot!,
I thresholded the FT results using a magnitude of $1.0^{-6}$ to find the significant
non-zero Fourier Transform responses and then, for those values, computed the amplitude,
frequency and phase information so as to answer the above questions.
My solution to this question does not use any loops: vectorized
your calculations and use \verb!find!.\\[0.1in]
\noindent ANSWER:
\clearpage
\noindent (4) (32\%) QUESTION:\\
This is the {\bf edge detection} question.
\begin{enumerate}
\item Generate 4 Gaussian images of the green grayvalue of the lena.jpg for
$\sigma=1.0$, $\sigma=2.0$, $\sigma=3.0$ and $\sigma=4.0$ by multiplication
in the frequency domain. Call these results $g1$, $g2$, $g3$ and $g4$.
This question requires 4 images. [Hint; use double() to convert the unsigned char images
integers inti double.]
% \item Perform inverse blurring on the blurred images.
% That is, compute $F(u,v) = \frac{G(u,v)}{H(u,v)}$ where $H(u,v)$ is the Fourier
% Transform of the Gaussian and $G(x,y,\sigma)$ is the Fourier Transform
% of the blurred image. Show the images obtained when
% \begin{enumerate}
% \item when the FT is stored to disk and then retrieved for the inverse FT computation and
% \item when the inverse FT is immediately computed on the FT results
% (no intermediate use of a disk).
% \end{enumerate}
% This question requires 8 images.
\item From the floating point representations of the
4 Gaussian blurred images in (1), compute the 3 Laplacians as DOGs (Difference
of Gaussians):
\begin{enumerate}
\item Use the Gaussian images with $\sigma=1.0$ and $\sigma=2.0$ ($g1-g2$),
\item Use the Gaussian images with $\sigma=2.0$ and $\sigma=3.0$ ($g3-g2$) and
\item Use the Gaussian images with $\sigma=3.0$ and $\sigma=4.0$ ($g4-g3$).
\end{enumerate}
[Note that the second $\sigma$ values are not 1.75 times the first $\sigma$ value.
This may or may not affect the answer!]
This question requires 3 images.
\item Compute the 3 Laplacian images for $\sigma=1.0$, $\sigma=2.0$ and $\sigma=3.0$
directly from the Laplacian formula:
\begin{displaymath}
\nabla^2 g(x,y) =
\frac{1}{\pi \sigma^4} \left[ 1- \frac{x^2+y^2}{2 \sigma^2} \right]
e^{\frac{-(x^2+y^2)}{2 \sigma^2}}.
\end{displaymath}
The spatial extents of these filters must satisfy the $6 \sigma+1$ rule for the largest
$\sigma$ value. This question requires 3 images.
\item For the three Laplacian and three DOG images created above compute
their edge maps by creating images with pixels having 1 of 2 values:
\begin{enumerate}
\item Black (grayvalue 0) at pixel $(i,j)$ if the Laplacian value
changes sign from $(i,j)$ to $(i+1,j)$ or from $(i,j)$ to $(i,j+1)$ and
\item White (grayvalue 255) everywhere else.\\
\end{enumerate}
This question requires 6 images.
\item Use the MatLab edge detector, \verb!edge! with the 'log' option (Laplacian
of Gaussian operator) for the 3 $\sigma$ values. Note that the scalar value for
\verb!edge! specifies the standard deviation of the Laplacian of Gaussian filter.
The size of the filter is $n \times n$, where $n = \lceil \sigma*6+1 \rceil$.
\end{enumerate}
Compare the Gaussians, Laplacians, DoGs, zero crossing and LoG images.
Discuss their similarities and differences. One thing to do is print
out the density of computed edgels. BTW: edges should be black edges on a white
background.\\[0.25in]
\noindent ANSWER:
\begin{thebibliography}{99}
\bibitem{Lamport-1994} L. Lamport, ``Latex - A Document
Preparation System - User's Guide and Reference
Manual'', Addison-Wesley Publishing Company,
$2^{nd}$ Edition, 1994.
\bibitem{Kopka-Daly-2004} H. Kopka and P.W. Daly, ``Guide to Latex'',
$4^{th}$ edition, Addison-Wesley, 2004.
\bibitem{Gonzalez-et-al-2004} R. C. Gonzalez, R. E. Woods and
S. L. Eddins, ``Digital Image Processing using MatLab'',
Pearson/Prentice-Hall, 2004.
\bibitem{Gonzalez-et-al-2009} R. C. Gonzalez, R. E. Woods and
S. L. Eddins, ``Digital Image Processing using MatLab'', $2^{nd}$ edition,
Gatesmark Publishing, 2009.
\bibitem{Hanselman-Littlefield-2005}
D. Hanselman and B. Littlefield, ``Mastering MatLab 7'',
Pearson/Prentice-Hall, 2005.
\bibitem{Hanselman-Littlefield-2012} D. Hanselman and B. Littlefield,
``Mastering MatLab'', Pearson Education, 2012.
\item{Pratap-2006} R. Pratap, ``Getting Started with MatLab 7: A Quick
Introduction for Scientists and Engineers'',
Oxford University Press, 2006.
\end{thebibliography}
\end{document}
\section*{Questions}
In this assignment writeup, $f(x,y)$ will
refer to image intensity values (0--255) and $F(u,v)$ will refer
to its Fourier Transform (F.T.).
\end{document}