'Take an image with feature descriptors,
project on vocabulary and add to database.'

def add_to_index(self, imname, descr):

    if self.is_indexed(imname):
        return
    print 'indexing', imname
    imid = self.get_id(imname)
    imwords = self.voc.project(descr)
    nbr_words = imwords.shape[0]
    for i in range(nbr_words):
        word = imwords[i]
        self.con.execute('insert    into    imwords(imid,wordid,vocname)    values    (?,?,?)', (imid, word, self.voc.name))
    self.con.execute('insert    into    imhistograms(imid,histogram,vocname)    values    (?,?,?)', (imid, pickle.dumps(imwords), self.voc.name))
