\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry} 
\usepackage{amsmath}
\usepackage{tcolorbox}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{accents}
\pagestyle{fancy}
\setlength{\headheight}{40pt}


\newenvironment{solution}
  {\renewcommand\qedsymbol{$\blacksquare$}
  \begin{proof}[Solution]}
  {\end{proof}}
\renewcommand\qedsymbol{$\blacksquare$}

\newcommand{\ubar}[1]{\underaccent{\bar}{#1}}

\begin{document}

\lhead{UBC CPSC 425 Computer Vision: Assignment 1} 
\rhead{Term I 2025} 
\cfoot{\thepage\ of \pageref{LastPage}}

\noindent In this question, you will be practicing filtering by hand on the following image. You will enter your final result for each question in the provided empty tables.

\begin{center}
\begin{tabular}{|l|l|l|l|l|}
\hline
2 & 0 & 5 & 0 & 3 \\ \hline
0 & 1 & 0 & 3 & 2 \\ \hline
4 & 0 & 0 & 1 & 2 \\ \hline
1 & 0 & 3 & 0 & 1 \\ \hline
\end{tabular}
\end{center}
\textbf{Note that you do not have to fill all the cells. If a cell contains a number that is not an integer, enter it as a fraction.}

\subsection*{Question (1a)} Apply the correlation filter to the image with \textbf{no padding}.
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
0  & 0 & 1 \\ \hline
0  & 0 & 0 \\ \hline
-1 & 0 & 0 \\ \hline
\end{tabular}
\end{center}

\noindent Enter your final result here in integer or fraction:

\begin{center}
\begin{tabular}{|l|l|l|l|l|}
\hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\end{tabular}
\end{center}

\subsection*{Question (1b)} Apply the convolution filter to the image with \textbf{no padding}.
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
0  & 0 & 1 \\ \hline
0  & 0 & 0 \\ \hline
-1 & 0 & 0 \\ \hline
\end{tabular}
\end{center}

\noindent Enter your final result here in integer or fraction:

\begin{center}
\begin{tabular}{|l|l|l|l|l|}
\hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\end{tabular}
\end{center}

\newpage

\subsection*{Question (1c)} Apply the following filter to the image with \textbf{zero padding} to make the input image and the output have the same shape. \textbf{Note:} zero padding means to pad your image with zeros; it is not the same as ``no padding".
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
1/9  & 1/9 & 1/9 \\ \hline
1/9  & 1/9 & 1/9 \\ \hline
1/9  & 1/9 & 1/9 \\ \hline
\end{tabular}
\end{center}

\noindent Enter your final result here in integer or fraction:

\begin{center}
\begin{tabular}{|l|l|l|l|l|}
\hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} & \hspace{1mm} \\ \hline
\end{tabular}
\end{center}

\end{document}