kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
4aee7f6e2a
commit
a3cce4752a
|
@ -19,4 +19,7 @@ def join_paths(path1, path2):
|
|||
return os.path.join(path1, path2)
|
||||
|
||||
def file_exists(path_file):
|
||||
return os.path.isfile(path_file)
|
||||
return os.path.isfile(path_file)
|
||||
|
||||
def dir_exists(dirname):
|
||||
return os.path.isdir(dirname)
|
|
@ -26,7 +26,14 @@ class ODMLoadDatasetCell(ecto.Cell):
|
|||
# get parameters
|
||||
args = self.inputs.args
|
||||
project_path = io.absolute_path_file(args['project_path'])
|
||||
images_dir = io.join_paths(project_path, 'images')
|
||||
images_dir = io.join_paths(project_path, 'images_resize')
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = args['run_only'] is not None \
|
||||
and args['run_only'] == 'resize'
|
||||
|
||||
if not io.dir_exists(images_dir) or rerun_cell:
|
||||
images_dir = io.join_paths(project_path, 'images')
|
||||
|
||||
log.ODM_DEBUG('Loading dataset from: %s' % images_dir)
|
||||
|
||||
|
@ -38,9 +45,8 @@ class ODMLoadDatasetCell(ecto.Cell):
|
|||
files = [f for f in files if supported_extension(f)]
|
||||
|
||||
if files:
|
||||
photos = []
|
||||
|
||||
# create ODMPhoto list
|
||||
photos = []
|
||||
for f in files:
|
||||
path_file = io.join_paths(images_dir, f)
|
||||
photos.append(types.ODMPhoto(path_file, args))
|
||||
|
|
|
@ -64,6 +64,9 @@ class ODMResizeCell(ecto.Cell):
|
|||
new_meta.read()
|
||||
# copy metadata
|
||||
old_meta.copy(new_meta)
|
||||
# update metadata size
|
||||
new_meta['Exif.Photo.PixelXDimension'].value = img_r.shape[0]
|
||||
new_meta['Exif.Photo.PixelYDimension'].value = img_r.shape[1]
|
||||
new_meta.write()
|
||||
# update photos array with new values
|
||||
photo.path_file = new_path_file
|
||||
|
@ -72,10 +75,12 @@ class ODMResizeCell(ecto.Cell):
|
|||
photo.update_focal()
|
||||
|
||||
# log message
|
||||
log.ODM_DEBUG('Resized %s | dimensions: %s to %s' % \
|
||||
(photo.filename, img_r.shape, args['resize_to']))
|
||||
log.ODM_DEBUG('Resized %s | dimensions: %s' % \
|
||||
(photo.filename, img_r.shape))
|
||||
else:
|
||||
log.ODM_WARNING('Already resized %s' % photo.filename)
|
||||
# log message
|
||||
log.ODM_WARNING('Already resized %s | dimensions: %s x %s' % \
|
||||
(photo.filename, photo.width, photo.height))
|
||||
|
||||
log.ODM_INFO('Resized %s images' % len(photos))
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue