

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Adv Topics in Pattern Analysis; Subject: (Computer Science); University: University of Houston; Term: Unknown 2008;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


The goal of this assignment is to apply statistical decision theory for the purpose of segmenting an image into two components, foreground and background. Specifically, the goal of this assignment is to segment the “cheetah” image into two components, the cheetah (foreground) and the grass (background). 1.) Any descriptor that we could use to describe the observation space would be a function of the image intensity. For the image in this case, a good descriptor would be a measure of texture in the image. We will consider a simple texture measure based on the discrete cosine transform (DCT). We will assume our observation space to be comprised of 8x8 image blocks, i.e. we view each image as a collection of 8×8 blocks. For each block we compute the discrete cosine transform (function dct2 on MATLAB) and obtain an array of 8×8 frequency coefficients. For computational ease, we can convert the 2D array of coefficient into a 1D vector comprising of 64 coefficients. The file ‘CoefficientPattern.txt’ provides the position of each coefficient in the 8x8 array. Further, the file ‘TrainingSamplesPart1.mat’ contains features for each class computed from a similar image. The features for the classes are stored in two separate matrices, ‘TrainsampleDCT_BG’ and ‘TrainsampleDCT_FG’ for background and foreground respectively. The next step is to estimate the class conditional densities. To make this task easier, we are going to reduce the feature vector to a single scalar. To do so, compute the position of the coefficient with the 2nd^ largest energy value (absolute value) in the vector. This will serve as our observation x. Given the training samples, build a histogram of these indexes to obtain
the class-conditionals for the two classes PX|Y (x|cheetah) and PX|Y (x|grass). The priors PY (cheetah) and PY (grass) should also be estimated from the training set as well. a) using the training data in ‘TrainingSamplesPart1.mat’, what are reasonable estimates for the prior probabilities? b) using the training data in ‘TrainingSamplesPart1.mat’, compute and plot the histograms PX|Y (x|cheetah) and PX|Y (x|grass). c) for each block in the image ‘cheetah.bmp’, compute the feature x. Compute the posterior probability P(Y|x) and assign a class label to the state variable Y using the minimum probability of error rule based on the probabilities obtained in a) and b). Store the state in an array A. Using the commands imagesc and colormap(gray(255)) create a picture of that array. d) The array A contains a mask that indicates which blocks contain grass and which contain the cheetah. Compare it with the ground truth provided in image ‘cheetah mask.bmp’ and compute the probability of error of your algorithm. Notes: