Lab 1. Introduction
Outline
- Introduction (about 10
minutes)
- STPR toolbox installation (15
minutes)
- Refreshing your knowledge
of Matlab (15 minutes)
- Simple data task (up to
55 minutes)
STPR toolbox installation
Expected time duration: 15 minutes
Statistical Pattern Recognition Toolbox contains variety of algorithms
which you will implement yourself during this course (you can use them as an
inspiration) and contains also many support functions which we will use
throughout the semester.
Download the latest version of the toolbox from its pages.
Unpack the content of the .zip file into your working directory (you should be
able to find it next week!). To be able to use the toolbox, you have to set the
path to it:
- Run Matlab
- Change the path to the
directory where you unpacked the toolbox (use cd command or the
path combo box at right top of the Matlab window)
- Running stprpath will
set the path and do initialization of the toolbox
Now you can switch to any other directory and still use the
functions from the STPR toolbox.
To verify the success of previous steps try to run demo_ocr.
Refreshing you knowledge of Matlab
Expected time duration: 15 minutes
We will be using Matlab programming language during whole semester. It is
necessary for you to be as familiar with it as possible, since the labs are
time limited and the tasks are often challenging. It may happen that you spend
more time looking for Matlab syntax of some function instead of solving
the problem itself.
For the case you are not too sure about your Matlab skills, here are few useful
links:
- Very short revision
of basic operations.
- MIT tutorial.
Compact, concise tutorial. Describes work with Matlab under Unix but most
of it is applicable to any operating system (just skip the section
"Starting a Session")
As part of today’s assignment, do following
(avoiding the use of any loops in your program):
- Create an arbitrary 4x4
matrix A and find its transpose,
- Print out third column of
the matrix A, print out last two rows from second to the last column of
the matrix,
- Find all positions in A
greater then 3 and increment them by 1,
- Add a column of ones to the
matrix A.
Simple data task
Expected time duration: up to 55 minutes
In this part of the exercise, we will work with a simple input data and we
will split it into training and test part. The data contains images of letters.
Do the following:
- Download the data file with the letter images and save
it to your working directory,
- Load the file to Matlab
(function load). You
will get variables images (3D array of images), Alphabet
(letters in the images) and labels (indexes of the images into Alphabet
array),
- Display one or more images
for each letter in the Alphabet list (see doc on functions imshow, imagesc, subplot, montage),
Try this code:
ims =
reshape(images,size(images,1),size(images,2),1,size(images,3));
montage(ims); colormap gray;
- Compute the mean images of
you name initials and display them (You will probably encounter a problem
with non-decimal numbers in the image matrix. You can avoid them by using
floor or uint8 function),
- For all letters plot the histograms
of dark pixels (value below 128) in the image. Plot all the histograms
into one graph to compare them.
Created by Jan
Šochman, 4.10.2006, last update 22.2.2008