CSCI 497P/597P - Homework 1

Fall 2020

Complete the following problems and submit your solutions to the HW1 assignment on Canvas. For all questions, justify your answers either or showing your work or giving a brief explanation. Please typeset your solutions using latex or similar1; if you feel that typesetting your answers is a major burden, please email me I will try to help or make alternative arrangements. You may work with your classmates on these problems, but you must write up your own solutions individually without using notes or photos made during your collaborative discussions. This is largely new material, so please let me know if you think anything is unclear or ambiguous and I’ll make corrections or clarifications as needed.

  1. Consider the following 3x3 image: \[ \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix} \]

    1. (4 points) Use this image and an identity filter to show that (for this image and filter) commutativity holds when performing convolution, but not cross-correlation.

    2. (Optional, for 2 points of extra credit) Recall that the definition of convolution is: \[ g(x,y) = \sum_{i=-k}^{k}\sum_{j=-k}^{k} w(i,j) f(x-i, y-j) \] Prove that convolution is commutative in general. It may be helpful to first modify the above definition so that all functions are defined everywhere but zero outside their bounds, and both summations run from \(-\infty\) to \(\infty\).

  2. (4 points) As we’ve seen in class, a common approach to noise reduction is to blur the image using a Gaussian filter. Explain the tradeoffs involved when choosing a filter size.

    1. (2 points) Consider the following 1D “tent” filter, which also serves as a very rough size-3 approximation of a 1D Gaussian filter:

      \(G = \frac{1}{4} \begin{bmatrix}1 & 2 & 1\end{bmatrix}\)

      We can transpose the filter to create an equivalent 1D filter that applies a blur in the vertical direction:

      \(G^T = \frac{1}{4}\begin{bmatrix} 1\\2\\1 \end{bmatrix}\)

      Using zero-padding and full output size, compute \(H = G * G^T\).

    2. (3 points) \(H\) is an instance of a special kind of filter called a separable filter, which has the property that the result of the 2D filtering operation can be computed by doing two 1D filtering operations in series. Prove that convolving an image \(F\) with \(H\) gives the same result as convolving it with \(G\), then convolving the result with \(G^T\). Feel free to use any properties presented in class without proof.

    3. (3 points) Does the above proof hold true for this particular filter if you replace all convolutions with cross-correlations? Does it hold true for any possible choice of 1x3 filter \(G\)?

    4. (4 points) Suppose you wish to filter a 64x64 image \(F\) with \(H\), using valid output size. The image and filter(s) are both represented using floating-point numbers. How many floating-point multiplications between pixel and filter values are required to convolve with \(H\)? How many are required to convolve with \(G\) then \(G^T\). Which is more efficient?


  1. I’ve found a sweet spot writing documents, like this one, in Markdown and including Latex-style math inline (e.g., $\frac{a}{b}$), then using pandoc to convert to either HTML or PDF, which renders the math nicely. You can also find WYSIWYG Markdown editors that make the editing process nicer and allow you to export straight to PDF; I’ve been using Typora for this purpose. You can download the markdown source for this document here, which I converted into this webpage using a command something like pandoc hw1.md -s -c md.css --mathjax --to=html5 -o index.html. Converting to pdf works similarly.