kopia lustrzana https://github.com/OpenDroneMap/ODM
Skip corrupted photos
rodzic
944cd4a0bf
commit
8566ba617c
|
@ -36,6 +36,9 @@ def find_largest_photo_dim(photos):
|
|||
|
||||
return max_dim
|
||||
|
||||
class PhotoCorruptedException(Exception):
|
||||
pass
|
||||
|
||||
class ODM_Photo:
|
||||
"""ODMPhoto - a class for ODMPhotos"""
|
||||
|
||||
|
@ -270,8 +273,11 @@ class ODM_Photo:
|
|||
# self.set_attr_from_xmp_tag('bandwidth', tags, [
|
||||
# 'Camera:WavelengthFWHM'
|
||||
# ], float)
|
||||
try:
|
||||
self.width, self.height = get_image_size.get_image_size(_path_file)
|
||||
except Exception as e:
|
||||
raise PhotoCorruptedException(str(e))
|
||||
|
||||
self.width, self.height = get_image_size.get_image_size(_path_file)
|
||||
# Sanitize band name since we use it in folder paths
|
||||
self.band_name = re.sub('[^A-Za-z0-9]+', '', self.band_name)
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import json
|
|||
from opendm import context
|
||||
from opendm import io
|
||||
from opendm import types
|
||||
from opendm.photo import PhotoCorruptedException
|
||||
from opendm import log
|
||||
from opendm import system
|
||||
from opendm.geo import GeoFile
|
||||
|
@ -109,11 +110,14 @@ class ODMLoadDatasetStage(types.ODM_Stage):
|
|||
with open(tree.dataset_list, 'w') as dataset_list:
|
||||
log.ODM_INFO("Loading %s images" % len(path_files))
|
||||
for f in path_files:
|
||||
p = types.ODM_Photo(f)
|
||||
p.set_mask(find_mask(f, masks))
|
||||
photos += [p]
|
||||
dataset_list.write(photos[-1].filename + '\n')
|
||||
|
||||
try:
|
||||
p = types.ODM_Photo(f)
|
||||
p.set_mask(find_mask(f, masks))
|
||||
photos += [p]
|
||||
dataset_list.write(photos[-1].filename + '\n')
|
||||
except PhotoCorruptedException:
|
||||
log.ODM_WARNING("%s seems corrupted and will not be used" % os.path.basename(f))
|
||||
|
||||
# Check if a geo file is available
|
||||
if tree.odm_geo_file is not None and os.path.isfile(tree.odm_geo_file):
|
||||
log.ODM_INFO("Found image geolocation file")
|
||||
|
|
|
@ -24,7 +24,7 @@ class ODMOrthoPhotoStage(types.ODM_Stage):
|
|||
system.mkdir_p(tree.odm_orthophoto)
|
||||
|
||||
if args.skip_orthophoto:
|
||||
log.ODM_WARNING("--skip-orthophoto is set, skipping orthophoto generation.")
|
||||
log.ODM_WARNING("--skip-orthophoto is set, no orthophoto will be generated")
|
||||
return
|
||||
|
||||
if not io.file_exists(tree.odm_orthophoto_tif) or self.rerun():
|
||||
|
|
Ładowanie…
Reference in New Issue