#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================
#  File Name: test_ms_bench.py
#  Author: Xu Zhang, Columbia University
#  Creation Date: 01-25-2019
#  Last Modified: Sun Mar  3 18:09:44 2019
#
#  Usage: python test_ms_bench.py
#  Description:test matching score benchmark
#
#  Copyright (C) 2018 Xu Zhang
#  All rights reserved.
#
#  This file is made available under
#  the terms of the BSD license (see the COPYING file).
# ===========================================================

import os
import sys
cwd = os.getcwd()
sys.path.insert(0, '{}/python/'.format(cwd))

import bench.Utils
import bench.MatchingScoreBench
import bench.repBench
import features.cyvlsift_official
import features.vlsift_load_matlab
import dset.vgg_dataset


if __name__ == "__main__":
    
    # Define matching score benchmark
    ms_bench = bench.MatchingScoreBench.MatchingScoreBench()

    # Define feature 1
    vlsift_py = features.cyvlsift_official.cyvlsift_official()

    # Define feature 2
    vlsift_load_matlab = features.vlsift_load_matlab.vlsift_load_matlab()
    
    # Define dataset
    vggh = dset.vgg_dataset.vggh_Dataset()

    # Do the evaluation
    ms_result_py = ms_bench.evaluate(
        vggh, vlsift_py, use_cache=True, save_result=True)

    ms_result_matlab = ms_bench.evaluate(
        vggh, vlsift_load_matlab, use_cache=True, save_result=True)
    
    # Make the results from different detectors as a list. 
    ms_result = [ms_result_py, ms_result_matlab]

    # Show the result
    for result_term in ms_result[0]['result_term_list']:
        bench.Utils.print_result(ms_result, result_term)
        bench.Utils.save_result(ms_result, result_term)

    #show result for different sequences
    for sequence in vggh.sequence_name_list:
        for result_term in ms_result[0]['result_term_list']:
            bench.Utils.print_sequence_result(ms_result, sequence, result_term)
            bench.Utils.save_sequence_result(ms_result, sequence, result_term)

@@ -764,16 +764,188 @@
 _matlab%0A
+import features.cv_orb%0Aimport features.cv_mser%0Aimport features.cv_brisk%0Aimport features.cv_fast%0Aimport features.cv_akaze%0Aimport features.cv_kaze%0Aimport features.superpoint%0A
 import d
@@ -989,20 +989,16 @@
 ain__%22:%0A
-    
 %0A    # D
@@ -1110,18 +1110,17 @@
  feature
- 1
+s
 %0A    vls
@@ -1179,110 +1179,266 @@
 l()%0A
-%0A
     
-# Define feature 2%0A    vlsift_load_matlab = features.vlsift_load_matlab.vlsift_load_matlab()%0A    
+cv_orb = features.cv_orb.cv_orb()%0A    cv_brisk = features.cv_brisk.cv_brisk()%0A    cv_fast = features.cv_fast.cv_fast()%0A    cv_akaze = features.cv_akaze.cv_akaze()%0A    cv_kaze = features.cv_kaze.cv_kaze()%0A    superpoint = features.superpoint.SuperPoint()%0A
 %0A   
@@ -1537,18 +1537,22 @@
 _result_
-py
+vlsift
  = ms_be
@@ -1643,68 +1643,363 @@
 ult_
-matlab = ms_bench.evaluate(%0A        vggh, vlsift_load_matlab
+cv_orb = ms_bench.evaluate(%0A        vggh, cv_orb, use_cache=True, save_result=True)%0A%0A    ms_result_cv_brisk = ms_bench.evaluate(%0A        vggh, cv_brisk, use_cache=True, save_result=True)%0A%0A    ms_result_cv_kaze = ms_bench.evaluate(%0A        vggh, cv_kaze, use_cache=True, save_result=True)%0A%0A    ms_result_cv_akaze = ms_bench.evaluate(%0A        vggh, cv_akaze
 , us
@@ -2030,20 +2030,123 @@
 t=True)%0A
+%0A
     
+ms_result_superpoint = ms_bench.evaluate(%0A        vggh, superpoint, use_cache=True, save_result=True)%0A
 %0A    # M
@@ -2196,17 +2196,16 @@
  a list.
- 
 %0A    ms_
@@ -2224,18 +2224,22 @@
 _result_
-py
+vlsift
 , ms_res
@@ -2242,22 +2242,137 @@
 _result_
-matlab
+cv_orb,%0A                 ms_result_cv_brisk, ms_result_cv_kaze,%0A                 ms_result_cv_akaze, ms_result_superpoint
 %5D%0A%0A    #

add more features to matching test