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.67k stars 1.07k forks source link

Support of 8bit multi band JPEG + 16bit single band TIFF images #1238

Closed zgyivi closed 1 year ago

zgyivi commented 3 years ago

How did you install OpenDroneMap? (Docker, natively, ...)?

Docker as part of WebODM

What's your browser and operating system? (Copy/paste the output of https://www.whatismybrowser.com/)

Firefox 86 on Ubuntu Linux

What is the problem?

DJI Multispectral camera provides 8bit RGB JPG files with EXIF data + 5 separate 16bit single band TIFF images When I try to process such a set OpenMVS/DensifyPointCloud reports error, because the undistorted RGB images are converted to 16bit 3band TIFF format and it cannot process that.

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.

Undistorting should keep 8bit format for multiband images even if there are 16bit single band files in the set.

How can we reproduce this? (What steps did you do to trigger the problem? What parameters are you using for processing? If possible please include a copy of your dataset uploaded on Google Drive or Dropbox. Be detailed)

The problem occur on the image set which was shared by mapninja on community page DJI Phantom 4 Pro Multipectral w/o RTK Only the JPGs can be processed properly, but when all images added processing fails as described above. Consol log shows (link to whole log): [INFO] Initializing ODM - Sat Feb 27 23:14:17 2021 [INFO] ============== [INFO] build_overviews: False [INFO] camera_lens: auto [INFO] cameras: {} [INFO] crop: 3 [INFO] debug: False [INFO] dem_decimation: 1 [INFO] dem_euclidean_map: False [INFO] dem_gapfill_steps: 3 [INFO] dem_resolution: 5 [INFO] depthmap_resolution: 640 [INFO] dsm: False [INFO] dtm: False [INFO] end_with: odm_report [INFO] fast_orthophoto: False [INFO] feature_quality: high [INFO] feature_type: sift [INFO] force_gps: False [INFO] gcp: None [INFO] geo: None [INFO] gps_accuracy: 10 [INFO] ignore_gsd: False [INFO] matcher_distance: 0 [INFO] matcher_neighbors: 8 [INFO] matcher_type: flann [INFO] max_concurrency: 16 [INFO] merge: all [INFO] mesh_octree_depth: 11 [INFO] mesh_size: 200000 [INFO] min_num_features: 8000 [INFO] name: 9357efe3-2a90-4fc2-b82c-be94813d33fb [INFO] optimize_disk_space: False [INFO] orthophoto_compression: DEFLATE [INFO] orthophoto_cutline: False [INFO] orthophoto_no_tiled: False [INFO] orthophoto_png: False [INFO] orthophoto_resolution: 5 [INFO] pc_classify: False [INFO] pc_csv: False [INFO] pc_ept: False [INFO] pc_filter: 2.5 [INFO] pc_las: False [INFO] pc_quality: medium [INFO] pc_rectify: False [INFO] pc_sample: 0 [INFO] primary_band: auto [INFO] project_path: /var/www/data [INFO] radiometric_calibration: camera [INFO] rerun: None [INFO] rerun_all: False [INFO] rerun_from: None [INFO] resize_to: 2048 [INFO] skip_3dmodel: False [INFO] skip_band_alignment: False [INFO] skip_report: False [INFO] sm_cluster: None [INFO] smrf_scalar: 1.25 [INFO] smrf_slope: 0.15 [INFO] smrf_threshold: 0.5 [INFO] smrf_window: 18.0 [INFO] split: 999999 [INFO] split_image_groups: None [INFO] split_overlap: 150 [INFO] texturing_data_term: gmi [INFO] texturing_outlier_removal_type: gauss_clamping [INFO] texturing_skip_global_seam_leveling: True [INFO] texturing_skip_local_seam_leveling: False [INFO] texturing_tone_mapping: none [INFO] tiles: False [INFO] time: False [INFO] use_3dmesh: False [INFO] use_exif: False [INFO] use_fixed_camera_params: False [INFO] use_hybrid_bundle_adjustment: False [INFO] verbose: False [INFO] ============== [INFO] Running dataset stage [INFO] Loading dataset from: /var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/images [INFO] Loading 486 images [INFO] Found 486 usable images [INFO] Parsing SRS header: WGS84 UTM 10N [INFO] Finished dataset stage [INFO] Running split stage [INFO] Normal dataset, will process all at once. [INFO] Finished split stage [INFO] Running merge stage [INFO] Normal dataset, nothing to merge. [INFO] Finished merge stage [INFO] Running opensfm stage [INFO] Reconstruction will use 81 images from auto band [INFO] Writing exif overrides [INFO] Maximum photo dimensions: 1600px [INFO] Altitude data detected, enabling it for GPS alignment [INFO] ['use_exif_size: no', 'flann_algorithm: KDTREE', 'feature_process_size: 800', 'feature_min_frames: 8000', 'processes: 16', 'matching_gps_neighbors: 8', 'matching_gps_distance: 0', 'optimize_camera_parameters: yes', 'undistorted_image_format: tif', 'bundle_outlier_filtering_type: AUTO', 'align_orientation_prior: vertical', 'triangulation_type: ROBUST', 'retriangulation_ratio: 2', 'feature_type: SIFT', 'use_altitude_tag: yes', 'align_method: auto', 'local_bundle_radius: 0'] [INFO] running /code/SuperBuild/src/opensfm/bin/opensfm extract_metadata "/var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm" 2021-02-27 23:14:23,295 INFO: Extracting EXIF for DJI_0030.JPG 2021-02-27 23:14:23,327 INFO: Extracting EXIF for DJI_0020.JPG 2021-02-27 23:14:23,348 INFO: Extracting EXIF for DJI_0040.JPG 2021-02-27 23:14:23,369 INFO: Extracting EXIF for DJI_0050.JPG ... [INFO] Undistorting /var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm ... 2021-02-27 23:21:06,859 DEBUG: Undistorting image DJI_0155.TIF 2021-02-27 23:21:06,861 DEBUG: Undistorting image DJI_0602.TIF 2021-02-27 23:21:06,865 DEBUG: Undistorting image DJI_0455.TIF 2021-02-27 23:21:06,867 DEBUG: Undistorting image DJI_0453.TIF 2021-02-27 23:21:06,868 DEBUG: Undistorting image DJI_0451.TIF 2021-02-27 23:21:06,872 DEBUG: Undistorting image DJI_0054.TIF 2021-02-27 23:21:06,876 DEBUG: Undistorting image DJI_0053.TIF 2021-02-27 23:21:06,881 DEBUG: Undistorting image DJI_0051.TIF 2021-02-27 23:21:06,887 DEBUG: Undistorting image DJI_0144.TIF 2021-02-27 23:21:06,895 DEBUG: Undistorting image DJI_0143.TIF ... 2021-02-27 23:23:01,227 DEBUG: Undistorting image DJI_0373.TIF 2021-02-27 23:23:01,378 DEBUG: Undistorting image DJI_0040.JPG 2021-02-27 23:23:01,534 DEBUG: Undistorting image DJI_0291.TIF 2021-02-27 23:23:01,539 DEBUG: Undistorting image DJI_0294.TIF 2021-02-27 23:23:02,542 DEBUG: Undistorting image DJI_0702.TIF 2021-02-27 23:23:02,901 DEBUG: Undistorting image DJI_0703.TIF 2021-02-27 23:23:03,235 DEBUG: Undistorting image DJI_0705.TIF [INFO] Restored reconstruction.json [INFO] Undistorting /var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm ... 2021-02-27 23:23:09,796 DEBUG: Undistorting the reconstruction 2021-02-27 23:23:15,243 DEBUG: Undistorting image DJI_0150.JPG 2021-02-27 23:23:15,243 DEBUG: Undistorting image DJI_0600.JPG 2021-02-27 23:23:15,243 DEBUG: Undistorting image DJI_0450.JPG 2021-02-27 23:23:15,243 DEBUG: Undistorting image DJI_0050.JPG 2021-02-27 23:23:15,243 DEBUG: Undistorting image DJI_0140.JPG 2021-02-27 23:23:15,244 DEBUG: Undistorting image DJI_0430.JPG 2021-02-27 23:23:15,244 DEBUG: Undistorting image DJI_0740.JPG ... 2021-02-27 23:23:40,559 DEBUG: Undistorting image DJI_0220.JPG 2021-02-27 23:23:40,559 DEBUG: Undistorting image DJI_0810.JPG 2021-02-27 23:23:40,896 DEBUG: Undistorting image DJI_0780.JPG 2021-02-27 23:23:41,218 DEBUG: Undistorting image DJI_0650.JPG [INFO] running /code/SuperBuild/src/opensfm/bin/opensfm export_visualsfm --points "/var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm" [INFO] Multiple bands found [INFO] Finished opensfm stage [INFO] Running openmvs stage [INFO] running /code/SuperBuild/src/opensfm/bin/opensfm export_openmvs "/var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm" [INFO] Running dense reconstruction. This might take a while. [INFO] running /code/SuperBuild/install/bin/OpenMVS/DensifyPointCloud "/var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm/undistorted/openmvs/scene.mvs" --resolution-level 2 --min-resolution 320 --max-resolution 1397 --max-threads 16 --number-views-fuse 2 -w "/var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm/undistorted/openmvs/depthmaps" -v 0 23:24:28 [App ] Build date: Feb 27 2021, 22:53:47 23:24:28 [App ] CPU: Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz (16 cores) 23:24:28 [App ] RAM: 15.62GB Physical Memory 0B Virtual Memory 23:24:28 [App ] OS: Linux 4.15.0-134-generic (x86_64) 23:24:28 [App ] SSE & AVX compatible CPU & OS detected 23:24:28 [App ] Command line: /var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm/undistorted/openmvs/scene.mvs --resolution-level 2 --min-resolution 320 --max-resolution 1397 --max-threads 16 --number-views-fuse 2 -w /var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm/undistorted/openmvs/depthmaps -v 0 23:24:28 [App ] error: failed loading image header 23:24:28 [App ] error: failed reloading image '/var/www/data/9357efe3-2a90-4fc2-b82c-be94813d33fb/opensfm/undistorted/images/DJI_0280.JPG.tif' 23:24:28 [App ] error: invalid project Traceback (most recent call last): File "/code/run.py", line 68, in app.execute() File "/code/stages/odm_app.py", line 81, in execute self.first_stage.run() File "/code/opendm/types.py", line 338, in run self.next_stage.run(outputs) File "/code/opendm/types.py", line 338, in run self.next_stage.run(outputs) File "/code/opendm/types.py", line 338, in run self.next_stage.run(outputs) [Previous line repeated 1 more time] File "/code/opendm/types.py", line 319, in run self.process(self.args, outputs) File "/code/stages/openmvs.py", line 60, in process system.run('%s "%s" %s' % (context.omvs_densify_path, File "/code/opendm/system.py", line 79, in run raise Exception("Child returned {}".format(retcode)) Exception: Child returned 1

huazai-1994 commented 2 years ago

My multispectral images were acquired by DJI drones ,and the images contain 8bit RGB JPG files with EXIF data + 5 separate 16bit single band TIFF images. I just put all the images in a folder named "images", and I can get a result without running error.But there is something wrong with the result,which exists severely missing

捕获

.

pierotofy commented 1 year ago

This is fixed with #1512 , thanks for sharing an input dataset to test with! :pray: