The code that was used for object recognition in the Poeticon project.
Instructions:
Gather training images. All images must be the same size and in the same folder.
Create corresponding masks. These should be images of the same size as the training images, in the same order within their own folder. They should have the label 0 for unknown pixels, 1 for pixels of the class "hand", 2 for pixels of the class "background,." for example. You can have any number of different labels. This is the numeric parameter in the 'train' command.
train('name of image folder','name of mask folder',2); This will create the model.mat file you want. There are parameters that can be changed in the beginning of the file 'train.'
Then to test that it worked, type
load model;
test('name of test image folder', 'name of output folder',model);