\input{psfig}
\documentstyle[times]{article}
\setlength{\textwidth}{6in}
\setlength{\textheight}{8.5in}
\setlength{\topmargin}{-.5in}	% top of page to top of running head minus 1in
\setlength{\oddsidemargin}{.5in}	% left margin minus 1in on odd pages
\setlength{\evensidemargin}{0in}	% left margin minus 1in on even pages
\setlength{\parskip}{1ex}		% vertical space between paragraphs

\def\prob #1#2 {\vspace{5ex}\noindent {\bf \Large #1} [#2] }
\def\ba{{\bf a)\ }}
\def\bb{{\bf b)\ }}
\def\bc{{\bf c)\ }}
\def\bd{{\bf d)\ }}

% convolution symbol
\def\conv{\mathbin{\hbox{$\,*$\kern-1.5ex$\odot$}}}

\begin{document}
\begin{center}
{\LARGE Written Assignment W1} \\
Computer Graphics 2 (15-463) \\
13 Feb. 1996
\vskip 2ex
Due noon Friday, 16 Feb. 1996 at my office (DH 4301A).
\end{center}

\prob{1.}{10 pts.}
An affine warp from picture A to picture B has been defined in terms of
three points $(u_i,v_i)$, $i=1,2,3$ in A and their corresponding points
$(x_i,y_i)$, $i=1,2,3$ in B.
Write out the formulas and pseudocode for transforming an
arbitrary point $(x,y)$ of picture B to its corresponding point $(u,v)$
of picture A.
Your answer may make use of determinants or linear systems solvers for
$3 \times 3$ or smaller matrices.

\prob{2.}{20 pts.}
Find the continuous Fourier transform of $f(x)=K\sin(\alpha x + \phi)$.
Also plot the magnitude of $F(\omega)$.
Hint: first find the inverse Fourier transforms of
$B \delta(\omega-\alpha)$ and
$C \delta(\omega+\alpha)$, using the sifting property of delta functions
given in Notes 7.

\prob{3.}{20 pts.}
Given an image that has been blurred, and the filter with which it was
blurred, how can we ``unblur'' to recover the original image?
That is, given a filter $g$, and the blurred image $h$, where $h=f \conv g$
for some input image $f$, how can we compute $f$?
What can go wrong?
Hints (use either):
$h\!=\!f \conv g \quad \leftrightarrow \quad H\!=\!F \cdot G$,
or write convolution as a matrix multiply.
Extra credit: try it, and print a picture of $g$, $h$, and the recovered $f$.

\newpage
\prob{4.}{20 pts.}
You are given an intensity-linear (gamma=1), 3-bit per pixel, grayscale
display device and asked to display some 8-bit grayscale images
on it so that they {\bf look as similar to the originals as possible}
given limited information about the pictures to be displayed.
Dithering is not allowed.
To display each 8-bit picture, you'll map input pixel value \verb|a| through a
quantization table \verb|b = quant[a]| that maps 8 bits to 3 bit
pixel values \verb|b| that you write into the display memory, and then the
hardware will display the intensity \verb|c = cm[b]| at each pixel,
where \verb|cm| is a colormap that you can set, which maps 3 bits to 8 bits.

\noindent
Uniform quantization would use
\verb|quant[a]=a/32, a=0..255|
and \verb|cm[b]=b*32, b=0..7| or something very similar.
Plots of \verb|quant|, \verb|cm|, and their
composition for uniform quantization are below.

\begin{figure}[h]
\centerline{\psfig{figure=quant_cm.eps,width=6in}}
\end{figure}

\noindent
\ba Given no knowledge about the character of the pictures to be displayed,
what colormap and quantization table
would you use to improve on uniform quantization?
Hint: think about sensitivity to intensity differences.
Graph the quantization table, colormap, and their composition
in a manner similar to the above, labeling the axes.
Your pictures should be qualitatively correct (relative spacing and number
of plateaus) but need not be exact.

\noindent
\bb For a set of pictures that each has the
histogram shown below, sketch the
best quantization table, colormap, and their composition.
Remember that the goal here is perceptually accurate reproduction
of intensities, not histogram equalization.

\begin{figure}[h]
\centerline{\psfig{figure=histo.eps}}
\end{figure}

\noindent
\bc If you're given a similar display device that has a gamma greater than
1, how would answer ``a)'' change?  Draw new curves.

\end{document}
