Example #1
0
 def wrapper(*args, **kwargs):
     try:
         coverage = get_coverage(request)
         token = get_token(request)
     except exceptions.HeaderAbsent, e:
         return marshal({'error': {'message': utils.parse_error(e)}},
                        fields.error_fields), 400
Example #2
0
 def wrapper(*args, **kwargs):
     try:
         coverage = get_coverage(request)
         token = get_token(request)
     except exceptions.HeaderAbsent, e:
         return marshal({'error': {
             'message': utils.parse_error(e)
         }}, fields.error_fields), 400
Example #3
0
 def wrapper(*args, **kwargs):
     try:
         coverage = get_coverage(request)
         token = get_token(request)
     except exceptions.HeaderAbsent as e:
         return marshal({'error': {
             'message': utils.parse_error(e)
         }}, fields.error_fields), 400
     nav = Navitia(current_app.config['NAVITIA_URL'], coverage, token)
     return func(*args, navitia=nav, **kwargs)
Example #4
0
 def output(self, key, obj):
     if not obj:
         return None
     if obj.type == 'line_section':
         return None
     navitia = Navitia(current_app.config['NAVITIA_URL'],
                       get_coverage(request), get_token(request))
     response = navitia.get_pt_object(obj.uri, obj.type)
     if response and 'name' in response:
         return response['name']
     return 'Unable to find object'
Example #5
0
 def wrapper(*args, **kwargs):
     try:
         coverage = get_coverage(request)
         token = get_token(request)
     except exceptions.HeaderAbsent as e:
         return marshal(
             {'error': {'message': utils.parse_error(e)}},
             fields.error_fields
         ), 400
     nav = Navitia(current_app.config['NAVITIA_URL'], coverage, token)
     return func(*args, navitia=nav, **kwargs)
Example #6
0
 def output(self, key, obj):
     if not obj:
         return None
     if obj.type == 'line_section':
         return None
     navitia = Navitia(
         current_app.config['NAVITIA_URL'],
         get_coverage(request),
         get_token(request))
     response = navitia.get_pt_object(obj.uri, obj.type)
     if response and 'name' in response:
         return response['name']
     return 'Unable to find object'
Example #7
0
    def output(self, key, obj):
        if not obj:
            return None
        if isinstance(obj, dict) and 'uri' in obj and 'type' in obj:
            obj_uri = obj['uri']
            obj_type = obj['type']
        else:
            obj_uri = obj.uri
            obj_type = obj.type

        navitia = Navitia(
            current_app.config['NAVITIA_URL'],
            get_coverage(request),
            get_token(request))

        return navitia.find_tc_object_name(obj_uri, obj_type)
Example #8
0
    def output(self, key, obj):
        to_return = []
        navitia = Navitia(current_app.config['NAVITIA_URL'],
                          get_coverage(request), get_token(request))
        for localization in obj.localizations:
            response = navitia.get_pt_object(localization.uri,
                                             localization.type)

            if response and 'name' in response:
                response["type"] = localization.type
                to_return.append(response)
            else:
                to_return.append({
                    "id": localization.uri,
                    "name": "Unable to find object",
                    "type": localization.type
                })
        return to_return
Example #9
0
    def output(self, key, obj):
        to_return = []
        navitia = Navitia(current_app.config['NAVITIA_URL'],
                          get_coverage(request),
                          get_token(request))

        if isinstance(obj, dict) and 'localizations' in obj:
            for localization in obj['localizations']:

                response = navitia.get_pt_object(
                    localization['uri'],
                    localization['type'])

                if response and 'name' in response:
                    response["type"] = localization['type']
                    to_return.append(response)
                else:
                    to_return.append(
                        {
                            "id": localization['uri'],
                            "name": "Unable to find object",
                            "type": localization['type']
                        }
                    )
        elif obj.localizations:
            for localization in obj.localizations:
                response = navitia.get_pt_object(
                    localization.uri,
                    localization.type)

                if response and 'name' in response:
                    response["type"] = localization.type
                    to_return.append(response)
                else:
                    to_return.append(
                        {
                            "id": localization.uri,
                            "name": "Unable to find object",
                            "type": localization.type
                        }
                    )
        return to_return
    2. kp in trg img in the overlapping region
    3. no of unique matches
    4. no of spurious kp in qry img
    5. no of spurious kp in trg img
    6. no of multiple matches
    7. unique match ratio
    8. spurious ratio for qry img
    9. spurious ratio for trg img
    10. multiple match ratio
    11. repeatability score
    '''

    ################# [2] Get coverage of keypoints ########################
    print('==================== TASK 2 ==================== ')
    print('============= COVERAGE IN THE IMAGE =============')
    progress = 1
    len_kp = len(keypoint_list)
    for item in keypoint_list:
        print(progress, 'out of', len_kp, item[0], item[1])
        cache_coverage.append(get_coverage(item))
        progress = progress + 1
    print('Writing coverage results to disk: ', results_dir)
    save_cache_coverage()
    print('Results saved!')
    print('The pickle file is a list with each item storing:')
    print(
        '(sequence[v_boat], img_name[1.ppm], img_shape[(680,850)], no_of_kp[500], hm, hm_normalized) '
    )

    end = time.time()
    print('Total time required in min: %.4f' % ((end - start) / 60))