-
Notifications
You must be signed in to change notification settings - Fork 44
Description
code:
#[...] /opensfm/pairs_selection.py
if not all(map(has_gps_info, exifs.values())):
if gps_neighbors != 0:
logger.warn(
"Not all images have GPS info. " "Disabling matching_gps_neighbors."
)
gps_neighbors = 0
max_distance = 0
graph_rounds = 0
Matching all photos is a aggressive drop down in this situation. My current issue is our drone screws up the first image in the process, but otherwise logs all GPS data to the exif. I'm also providing a geo.txt file in ODM. Am unsure if this process cares about the geo.txt file, but regardless, it seems like a improve default when certain gps files do not have gps would be segregate them.
The rest of the function is confusing. It looks like images_ref and cand_images and is only ever called with images from:
def run_dataset(data: DataSetBase) -> None:
"""Match features between image pairs."""
images = data.images()
start = timer()
pairs_matches, preport = matching.match_images(data, {}, images, images)
matching.save_matches(data, images, pairs_matches)
matching.clear_cache()
end = timer()
write_report(data, preport, list(pairs_matches.keys()), end - start)
then exifs is:
# Get EXIFs data
all_images = list(set(ref_images + cand_images))
exifs = {im: data.load_exif(im) for im in all_images}
so it seems like we could segregate images_ref and images_cand into a has_gps bucket before the all(*) check:
exif_items = exifs.items()
exif_found_gps = map(has_gps_info, [v for k,v in exif_items])
images_ref_has_gps = []
images_cand_has_gps = []
for i, has_gps in exif_found_gps:
if has_gps:
images_ref_has_gps.append(images_ref[i])
images_cand_has_gps.append(images_ref[i])
Note, I don't think the order is garunteed, so another function would need to find it, or it would need to be garunteed by caller.
I'm not sure how the rest of the logic goes, but we're simply trying to figure out pairs to run matching on. It seems like triggering the all pair selection:
if (
max_distance
== gps_neighbors
== time_neighbors
== order_neighbors
== bow_neighbors
== vlad_neighbors
== graph_rounds
== 0
):
# All pair selection strategies deactivated so we match all pairs
d = set()
t = set()
g = set()
o = set()
b = set()
v = set()
pairs = {sorted_pair(i, j) for i in images_ref for j in images_cand if i != j}
Kills processing time with just one image missing