OpenDroneMap / ODM

A command line toolkit to generate maps, point clouds, 3D models and DEMs from drone, balloon or kite images. 📷
https://opendronemap.org
GNU Affero General Public License v3.0
4.68k stars 1.07k forks source link

OpenSfM unable to match features between two heavily overlapping images captured on DJI #1693

Closed connor11son closed 10 months ago

connor11son commented 10 months ago

How did you install ODM? (Docker, installer, natively, ...)?

Docker Run

What is the problem?

ODM (OpenSfM specifically) is unable to match features between two images with ~70% overlap.

What should be the expected behavior? If this is a feature request, please describe in detail the changes you think should be made to the code, citing files and lines where changes should be made, if possible.

Features from the two images should be able to be matched, and OpenSfM should be able to stitch the images to create a mosaic. I am able to compute and match features using SIFT and RANSAC on the latest version of OpenCV.

How can we reproduce this? What steps did you do to trigger the problem? If this is an issue with processing a dataset, YOU MUST include a copy of your dataset AND task output log, uploaded on Google Drive or Dropbox (otherwise we cannot reproduce this).

docker run -ti --rm -v $PWD:/datasets opendronemap/odm --project-path /datasets project --dsm

where inside of your working directory you have a project folder with these images inside. Here are the relevant logs for this run:

[INFO] Running opensfm stage [INFO] Maximum photo dimensions: 5472px [INFO] Photo dimensions for feature extraction: 2736px [INFO] Altitude data detected, enabling it for GPS alignment [INFO] ['use_exif_size: no', 'flann_algorithm: KDTREE', 'feature_process_size: 2736', 'feature_min_frames: 10000', 'processes: 88', 'matching_gps_neighbors: 0', 'matching_gps_distance: 0', 'matching_graph_rounds: 50', 'optimize_camera_parameters: yes', 'reconstruction_algorithm: incremental', 'undistorted_image_format: tif', 'bundle_outlier_filtering_type: AUTO', 'sift_peak_threshold: 0.066', 'align_orientation_prior: vertical', 'triangulation_type: ROBUST', 'retriangulation_ratio: 2', 'matcher_type: FLANN', 'feature_type: SIFT', 'use_altitude_tag: yes', 'align_method: auto', 'local_bundle_radius: 0'] [INFO] Wrote reference_lla.json [INFO] running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" detect_features "/datasets/project3/opensfm" 2023-09-06 04:36:51,482 INFO: Planning to use 86844.55429687501 MB of RAM for both processing queue and parallel processing. 2023-09-06 04:36:51,482 INFO: Scale-space expected size of a single image : 170.66471099853516 MB 2023-09-06 04:36:51,483 INFO: Expecting to queue at most 200 images while parallel processing of 88 images. 2023-09-06 04:36:51,503 INFO: Reading data for image DJI_0001.JPG (queue-size=0) 2023-09-06 04:36:51,503 INFO: Reading data for image DJI_0002.JPG (queue-size=0) 2023-09-06 04:36:52,128 INFO: Extracting ROOT_SIFT features for image DJI_0002.JPG 2023-09-06 04:36:52,150 DEBUG: Computing sift with threshold 0.066 2023-09-06 04:36:52,241 INFO: Finished reading images 2023-09-06 04:36:52,241 INFO: Extracting ROOT_SIFT features for image DJI_0001.JPG 2023-09-06 04:36:52,385 DEBUG: Computing sift with threshold 0.066 2023-09-06 04:36:54,614 DEBUG: Found 13925 points in 2.4637513160705566s 2023-09-06 04:36:54,615 DEBUG: done 2023-09-06 04:36:54,917 DEBUG: Found 11908 points in 2.531656265258789s 2023-09-06 04:36:54,917 DEBUG: done [INFO] running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" match_features "/datasets/project3/opensfm" 2023-09-06 04:36:58,355 INFO: Matching 0 image pairs 2023-09-06 04:36:58,368 INFO: Computing pair matching with 88 processes 2023-09-06 04:36:58,368 INFO: Matched 0 pairs in 0.012679992243647575 seconds (0 seconds/pair). [INFO] running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" create_tracks "/datasets/project3/opensfm" 2023-09-06 04:36:59,515 INFO: reading features 2023-09-06 04:36:59,631 DEBUG: Merging features onto tracks 2023-09-06 04:36:59,631 DEBUG: Good tracks: 0 [INFO] running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" reconstruct "/datasets/project3/opensfm" 2023-09-06 04:37:00,845 INFO: Starting incremental reconstruction 2023-09-06 04:37:00,846 INFO: 0 partial reconstructions in total. [ERROR] The program could not process this dataset using the current settings. Check that the images have enough overlap, that there are enough recognizable features and that the images are in focus. You could also try to increase the --min-num-features parameter.The program will now exit.

pierotofy commented 10 months ago

Thanks for sharing a test dataset, this looks indeed like a bug, it's caused by OpenSfM's graph pre-matcher, which to work requires at least 3 images.

The workaround at the moment is to use --matcher-neighbors 2, which will use GPS-based pre-matching instead, which works fine for 2 images.

image