M-File Help: BagOfWords View code for BagOfWords

BagOfWords

Bag of words class

The BagOfWords class holds sets of features for a number of images and supports image retrieval by comparing new images with those in the 'bag'.

Methods

isword Return all features assigned to word
occurrences Return number of occurrences of word
remove_stop Remove stop words
wordvector Return word frequency vector
wordfreq Return words and their frequencies
similarity Compare two word bags
contains List the images that contain a word
exemplars Display examples of word support regions
display Display the parameters of the bag of words
char Convert the parameters of the bag of words to a string

Properties

K The number of clusters specified
nstop The number of stop words specified
nimages The number of images in the bag

Reference

J.Sivic and A.Zisserman, "Video Google: a text retrieval approach to object matching in videos", in Proc. Ninth IEEE Int. Conf. on Computer Vision, pp.1470-1477, Oct. 2003.

See also

PointFeature


BagOfWords.BagOfWords

Create a BagOfWords object

b = BagOfWords(f, k) is a new bag of words created from the feature vector f and with k words. f can also be a cell array, as produced by ISURF() for an image sequence.

The features are sorted into k clusters and each cluster is termed a visual word.

b = BagOfWords(f, b2) is a new bag of words created from the feature vector f but clustered to the words (and stop words) from the existing bag b2.

Notes

See also

PointFeature, isurf


BagOfWords.char

Convert to string

s = B.char() is a compact string representation of a bag of words.


BagOfWords.contains

Find images containing word

k = B.contains(w) is a vector of the indices of images in the sequence that contain one or more instances of the word w.


BagOfWords.display

Display value

B.display() displays the parameters of the bag in a compact human readable form.

Notes

See also

BagOfWords.char


BagOfWords.exemplars

Display exemplars of words

B.exemplars(w, images, options) displays examples of the support regions of the words specified by the vector w. The examples are displayed as a table of thumbnail images. The original sequence of images from which the features were extracted must be provided as images.

Options

'ncolumns', N Number of columns to display (default 10)
'maxperimage', M Maximum number of exemplars to display from any one image (default 2)
'width', W Width of each thumbnail [pixels] (default 50)

BagOfWords.isword

Features from words

f = B.isword(w) is a vector of feature objects that are assigned to any of the word w. If w is a vector of words the result is a vector of features assigned to all the words in w.


BagOfWords.occurrence

Word occurrence

n = B.occurrence(w) is the number of occurrences of the word w across all features in the bag.


BagOfWords.remove_stop

Remove stop words

B.remove_stop(n) removes the n most frequent words (the stop words) from the bag. All remaining words are renumbered so that the word labels are consecutive.


BagOfWords.wordfreq

Word frequency statistics

[w,n] = B.wordfreq() is a vector of word labels w and the corresponding elements of n are the number of occurrences of that word.


BagOfWords.wordvector

Word frequency vector

wf = B.wordvector(J) is the word frequency vector for the J'th image in the bag. The vector is Kx1 and the angle between any two WFVs is an indication of image similarity.

Notes


 

© 1990-2012 Peter Corke.