This part based on an assignment by Z. Dodds.
In this section you will model and classify objects based on their color characteristics (and any other properties you wish to include). You will test your recognizer on images collected by the class, and then we will have a recognizer face off in class on Wednesday, October 19 on a new set of images, to be collected as part of this assignment.
In the directory
/cs/cs153/Images05/ModeledObjects
There are a number of objects for you to model. You must develop a model for 10 of the 13 objects in this directory. You will be developing modeling code that will (ideally) work to generate a model of your 10 objects.
In the above directory, in addition to the object images, there is also a .txt file for each image containing information about that image. (This is the .txt file you generated in problem set 2). This file contains, in the following order, each on their own line:
For this assignment you will be generating an object model based on only a few examples of an object, so a statistical classifier will not work because we do not have enough data to get a good approximation of the class conditional density (although one possible extension is to gather more data to estimate the class conditional density for a few objects). So essentially our object "models" will represent one point in feature space that is (ideally) close to the center of where the given class of objects lie in that space.
Segmenting the object from the background: As we learned, segmentation is hard. Luckily, you know where the dominant object is in the image! Your first task will be to write the matlab code that extracts the dominant object from the rest of the scene using the coordinates supplied in the corresponding .txt file. Then you can focus on only the relevant object for the rest of the modeling process. (You can do this by hand if you want, but it'll be easier if you write a program to do it for you.)
Modeling with Color: We will start by using color as the feature in the object model. You will have the option of adding other features as an extension. The most natural way to model color is with a color histogram (just like you did when you segmented images using color). To generate a color histogram, you will need to decide two things: which color space you would like to work with (RGB or HSV or something else) and how you will divide up your bins. Once you decide on a colorspace and a strategy for binning it, create and plot at least one histogram of an image using that division of colorspace; include the results (and a brief explanation) here. Keep in mind that you may not want to divide colorspace uniformly along its axes. Note that these color histograms are models of a single object, and not histogram models for the class conditional densities that we talked about in class!
Combining color histograms
Next, you'll need to decide exactly what will constitute the model of an object. This problem is based around histograms, yes, but there are a variety of ways to use histograms to model, say, a "parrot." The simplest would be to take a single parrot image and use its histogram as the model for parrots in general. Or, you may want to combine the information available from additional images -- for example, by averaging. Alternatively, there may be information you don't want to use in your model of an object: for example, you might considering a more careful hand-segmentation of the objects when creating your object model.
Ultimately, you should have a function or script that will create an object model, given an image/images or, if you prefer, a list of pixels (or several lists of pixels, coming from several images). Include your object-modeling code, along with a brief explanation and description, below.
Regardless of how you choose to match object models, you will want to try matching several to see how it performs. In addition to the ModeledObjects directory, there is also a sibling UnmodeledObjects directory you may want to use to test histogram comparison. Don't use the UnmodeledObjects, however, to build the object representations, as there needs to be some independent data for use in testing the final system. As you test, you may want to consider a criterion for a "reject class," i.e., a class for objects that do not match any of the 12 modeled ones well.
The end result of all this work should be the following (to which you should provide links here):
function models = loadModels( filename );that reads in a set of models and builds your matlab representation of these models, and
function class = classify( image, models );that takes the models output by the previous function and an image (of just the dominant object, as defined by its bounding box) and outputs the object's class.
First, for each image in the directory
/cs/cs153/Images/a3/UnmodeledObjects
create a row in a three-column list with
Remember that you need to pursue only one extension in one part of the assignment, and it can be anything you'd like to investigate. These are only suggestions.