Save flann matcher data for use later

asked 2014-05-30 08:20:20 -0600

cvash gravatar image

updated 2014-05-30 10:04:46 -0600

berak gravatar image

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.

edit retag flag offensive close merge delete

Comments

not yet possible, you might want to follow the outcome of this and this

berak gravatar imageberak ( 2014-05-30 10:07:16 -0600 )edit