Ask Your Question

cvash's profile - activity

2014-05-30 08:21:11 -0600 received badge  Editor (source)
2014-05-30 08:20:20 -0600 asked a question Save flann matcher data for use later

I'm currently using this code to generate a Flann based matcher in Python using OpenCV's cv2 module:

flann_params = dict(algorithm = 1, trees = 4)
matcher = cv2.FlannBasedMatcher(flann_params, {})

# Train FLANN matcher with descriptors of all images
for f in os.listdir("images/"):
    image = get_image("./images/%s" % (f,))
    keypoints, descriptors = get_image_features(image)
    matcher.add([descriptors])
    files.append(f)
    matcher.train()

What I want to do is to save the Flann index generated and use it later on by simply loading it, from a file on the disk. How to do that? I've searched extensively for this in the reference manual but found nothing in OpenCV's Python docs.