I'm currently using this code to generate a Flann based matcher:
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.