Skip to content

Commit

Permalink
Ignore matching_gps_neighbors if any image has no GPS data
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinus committed Dec 21, 2015
1 parent d3c7528 commit a0671c4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions bin/match_features
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#!/usr/bin/env python
import os.path, sys
import time
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

import argparse
import logging
from multiprocessing import Pool
import time

import numpy as np
from itertools import combinations
import argparse

from opensfm import dataset
from opensfm import features
from opensfm import matching
from opensfm import geo

logger = logging.getLogger(__name__)


def has_gps_info(exif):
return (exif
Expand All @@ -26,7 +29,7 @@ def distance_from_exif(exif1, exif2):
gps2 = exif2['gps']
lon1, lat1 = gps1['longitude'], gps1['latitude']
lon2, lat2 = gps2['longitude'], gps2['latitude']
return geo.gps_distance([lon1,lat1], [lon2, lat2])
return geo.gps_distance([lon1, lat1], [lon2, lat2])
else:
return 0

Expand All @@ -42,6 +45,11 @@ def match_candidates_from_metadata(images, exifs, data):
max_neighbors = data.config['matching_gps_neighbors']
max_time_neighbors = data.config['matching_time_neighbors']

if not all(map(has_gps_info, exifs)) and max_neighbors != 0:
logger.warn("Not all images have GPS info. "
"Disabling matching_gps_neighbors.")
max_neighbors = 0

pairs = set()
for im1 in images:
distances = []
Expand Down Expand Up @@ -135,6 +143,7 @@ def match_arguments(pairs):


if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser(description='Match features between all image pairs.')
parser.add_argument('dataset', help='path to the dataset to be processed')
args = parser.parse_args()
Expand Down

0 comments on commit a0671c4

Please sign in to comment.