capmoe.cv

capmoe.cv.bof

synopsis:Create BoF representation from features & visual words
class capmoe.cv.bof.BoFMaker(visualwords, index_filepath=None, algorithm=u'kdtree', loglevel=u'WARNING')[source]

Bases: object

Create BoF representation from features & visual words.

Since ANN algorithm is used internally, the result BoF representation is approximation.

Index creation is wrapped by this class.

__init__(visualwords, index_filepath=None, algorithm=u'kdtree', loglevel=u'WARNING')[source]

Create or load index of visual words.

Parameters:
  • visualwords (M x len(feature) numpy.ndarray, where each element is numpy.float32) – 2D array of base vectors
  • index_filepath – If not None, index is not created but load from specified file. The file must be created by BoFMaker.save()
  • algorithm – passed to pyflann.FLANN().build_index
make(features, norm_order=None)[source]

Create BoF representation of features.

Parameters:
  • features (N x len(feature) numpy.ndarray, where each element is numpy.float32) – 2D array of feature vectors
  • norm_order1 for L1-norm, 2 for L2-norm, ... Histogram is not normalized when this is None.
static meta_filepath(index_filepath)[source]

Generate path to meta data file

save(filepath)[source]

Save index of visual words to filepath

capmoe.cv.capdetector

synopsis:Provides function to detect a beer cap from an image
capmoe.cv.capdetector.capdetector(imgpath, max_candidates, loglevel=u'WARNING')[source]

Detect circles from an image

Return type:[{‘x’: <cap circle center x>, ‘y’: <cap circle center y>, ‘r’: <cap circle radius>}, ...]

capmoe.cv.visualwords

synopsis:Creates visual words (codebook) from features of images
capmoe.cv.visualwords.visualwords_union(features, loglevel=u'WARNING')[source]

Create simple visual words just by making union of feature vectors

Not suitable for large number of features.

Parameters:features

feature vectors. Iterable of 2-D numpy.ndarray. Example:

Return type:2-D numpy.ndarray

Table Of Contents

This Page