# HG changeset patch # User Puneeth Chaganti # Date 1257440870 -19800 # Node ID b2dafce03b8d533e16983e2f093d64666c7fc5ac # Parent ce818f645f6b78bc2248b8c02f74a9fdace56a23 Added Slicing and Striding exercises. diff -r ce818f645f6b -r b2dafce03b8d day1/session4.tex --- a/day1/session4.tex Thu Nov 05 21:04:23 2009 +0530 +++ b/day1/session4.tex Thu Nov 05 22:37:50 2009 +0530 @@ -258,11 +258,39 @@ \begin{frame}[fragile] \frametitle{Slicing \& Striding Exercises} +\begin{small} \begin{lstlisting} +In []: A = imread('lena.png') + +In []: imshow(A) +Out[]: + +In []: A.shape +Out[]: (512, 512, 4) \end{lstlisting} +\end{small} + \begin{itemize} + \item Crop the image to get the top-left quarter + \item Crop the image to get only the face + \item Resize image to half by dropping alternate pixels + \end{itemize} \end{frame} -\subsection{Basic Operations} +\begin{frame}[fragile] + \frametitle{Slicing \& Striding Exercises \ldots} +\begin{small} + \begin{lstlisting} +In []: imshow(A[:256,:256]) +Out[]: + +In []: imshow(A[200:400,200:400]) +Out[]: + +In []: imshow(A[::2,::2]) +Out[]: + \end{lstlisting} +\end{small} +\end{frame} \begin{frame}[fragile] \frametitle{Transpose of a Matrix} @@ -401,7 +429,7 @@ \frametitle{$L$ vs. $T^2$} \vspace{-0.15in} \begin{figure} -\includegraphics[width=4in]{data/L-Tsq-points.png} +\includegraphics[width=4in]{data/L-Tsq-points} \end{figure} \end{frame} @@ -409,7 +437,7 @@ \frametitle{$L$ vs. $T^2$} \vspace{-0.15in} \begin{figure} -\includegraphics[width=4in]{data/L-Tsq-Line.png} +\includegraphics[width=4in]{data/L-Tsq-Line} \end{figure} \end{frame} @@ -417,7 +445,7 @@ \frametitle{Least Squares Fit} \vspace{-0.15in} \begin{figure} -\includegraphics[width=4in]{data/least-sq-fit.png} +\includegraphics[width=4in]{data/least-sq-fit} \end{figure} \end{frame} @@ -494,7 +522,6 @@ \end{lstlisting} \end{frame} -\subsection{Plotting} \begin{frame}[fragile] \frametitle{Least Square Fit Line \ldots} We get the points of the line from \typ{coef}