'Save the bag of features codebook and data set to a local file.'

def save(self, imgfname, datafname):

    myFile = open(datafname, 'w')
    myFile.write('BOF    Codebook    Data\n')
    myFile.write((str(self.mNumCodes) + '\n'))
    myFile.write((str(self.mPatchSize[0]) + '\n'))
    myFile.write((str(self.mPatchSize[1]) + '\n'))
    myFile.write((str(self.mPadding) + '\n'))
    myFile.write((str(self.mLayout[0]) + '\n'))
    myFile.write((str(self.mLayout[1]) + '\n'))
    myFile.write((imgfname + '\n'))
    myFile.close()
    if (self.mCodebookImg is None):
        self._codebook2Img(self.mCodebook, self.mPatchSize, self.mNumCodes, self.mLayout, self.mPadding)
    self.mCodebookImg.save(imgfname)
    return
