kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
8f03ee7023
commit
d6f3c94f1a
|
@ -129,7 +129,7 @@ endforeach()
|
||||||
|
|
||||||
externalproject_add(mve
|
externalproject_add(mve
|
||||||
GIT_REPOSITORY https://github.com/OpenDroneMap/mve.git
|
GIT_REPOSITORY https://github.com/OpenDroneMap/mve.git
|
||||||
GIT_TAG 099
|
GIT_TAG 200
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
SOURCE_DIR ${SB_SOURCE_DIR}/elibs/mve
|
SOURCE_DIR ${SB_SOURCE_DIR}/elibs/mve
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
|
|
|
@ -2,19 +2,10 @@ import os
|
||||||
import shutil, errno
|
import shutil, errno
|
||||||
import json
|
import json
|
||||||
|
|
||||||
def get_files_list(path_dir):
|
|
||||||
return os.listdir(path_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def absolute_path_file(path_file):
|
def absolute_path_file(path_file):
|
||||||
return os.path.abspath(path_file)
|
return os.path.abspath(path_file)
|
||||||
|
|
||||||
|
|
||||||
def extract_file_from_path_file(path_file):
|
|
||||||
path, file = os.path.split(path_file)
|
|
||||||
return file
|
|
||||||
|
|
||||||
|
|
||||||
def extract_path_from_file(file):
|
def extract_path_from_file(file):
|
||||||
path_file = os.path.abspath(os.path.dirname(file))
|
path_file = os.path.abspath(os.path.dirname(file))
|
||||||
path, file = os.path.split(path_file)
|
path, file = os.path.split(path_file)
|
||||||
|
|
|
@ -129,6 +129,18 @@ class OSFMContext:
|
||||||
|
|
||||||
with open(os.path.join(self.opensfm_project_path, "exif_overrides.json"), 'w') as f:
|
with open(os.path.join(self.opensfm_project_path, "exif_overrides.json"), 'w') as f:
|
||||||
f.write(json.dumps(exif_overrides))
|
f.write(json.dumps(exif_overrides))
|
||||||
|
|
||||||
|
# Check image masks
|
||||||
|
masks = []
|
||||||
|
for p in photos:
|
||||||
|
if p.mask is not None:
|
||||||
|
masks.append((p.filename, os.path.join(images_path, p.mask)))
|
||||||
|
|
||||||
|
if masks:
|
||||||
|
log.ODM_INFO("Found %s image masks" % len(masks))
|
||||||
|
with open(os.path.join(self.opensfm_project_path, "mask_list.txt"), 'w') as f:
|
||||||
|
for fname, mask in masks:
|
||||||
|
f.write("{} {}\n".format(fname, mask))
|
||||||
|
|
||||||
# Compute feature_process_size
|
# Compute feature_process_size
|
||||||
feature_process_size = 2048 # default
|
feature_process_size = 2048 # default
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
import exifread
|
import exifread
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -14,12 +15,24 @@ import xmltodict as x2d
|
||||||
from opendm import get_image_size
|
from opendm import get_image_size
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
|
|
||||||
|
def find_mask(photo_path):
|
||||||
|
(pathfn, ext) = os.path.splitext(photo_path)
|
||||||
|
mask_path = "{}_mask{}".format(pathfn, ext)
|
||||||
|
if os.path.exists(mask_path):
|
||||||
|
# Spaces are not supported due to OpenSfM's mask_list.txt format reqs
|
||||||
|
if not " " in mask_path:
|
||||||
|
return os.path.basename(mask_path)
|
||||||
|
else:
|
||||||
|
log.ODM_WARNING("Image mask {} has a space. Spaces are currently not supported for image masks.".format(os.path.basename(mask_path)))
|
||||||
|
|
||||||
class ODM_Photo:
|
class ODM_Photo:
|
||||||
"""ODMPhoto - a class for ODMPhotos"""
|
"""ODMPhoto - a class for ODMPhotos"""
|
||||||
|
|
||||||
def __init__(self, path_file):
|
def __init__(self, path_file):
|
||||||
|
self.filename = os.path.basename(path_file)
|
||||||
|
self.mask = find_mask(path_file)
|
||||||
|
|
||||||
# Standard tags (virtually all photos have these)
|
# Standard tags (virtually all photos have these)
|
||||||
self.filename = io.extract_file_from_path_file(path_file)
|
|
||||||
self.width = None
|
self.width = None
|
||||||
self.height = None
|
self.height = None
|
||||||
self.camera_make = ''
|
self.camera_make = ''
|
||||||
|
|
|
@ -49,16 +49,16 @@ class ODMLoadDatasetStage(types.ODM_Stage):
|
||||||
with open(tree.benchmarking, 'a') as b:
|
with open(tree.benchmarking, 'a') as b:
|
||||||
b.write('ODM Benchmarking file created %s\nNumber of Cores: %s\n\n' % (system.now(), context.num_cores))
|
b.write('ODM Benchmarking file created %s\nNumber of Cores: %s\n\n' % (system.now(), context.num_cores))
|
||||||
|
|
||||||
# check if the extension is supported
|
# check if the image filename is supported
|
||||||
def supported_extension(file_name):
|
def valid_image_filename(filename):
|
||||||
(pathfn, ext) = os.path.splitext(file_name)
|
(pathfn, ext) = os.path.splitext(filename)
|
||||||
return ext.lower() in context.supported_extensions
|
return ext.lower() in context.supported_extensions and pathfn[-5:] != "_mask"
|
||||||
|
|
||||||
# Get supported images from dir
|
# Get supported images from dir
|
||||||
def get_images(in_dir):
|
def get_images(in_dir):
|
||||||
# filter images for its extension type
|
# filter images for its extension type
|
||||||
log.ODM_DEBUG(in_dir)
|
log.ODM_DEBUG(in_dir)
|
||||||
return [f for f in io.get_files_list(in_dir) if supported_extension(f)]
|
return [f for f in os.listdir(path_dir) if valid_image_filename(f)]
|
||||||
|
|
||||||
# get images directory
|
# get images directory
|
||||||
input_dir = tree.input_images
|
input_dir = tree.input_images
|
||||||
|
|
|
@ -77,7 +77,8 @@ class ODMMveStage(types.ODM_Stage):
|
||||||
self.update_progress(90)
|
self.update_progress(90)
|
||||||
|
|
||||||
scene2pset_config = [
|
scene2pset_config = [
|
||||||
"-F%s" % mve_output_scale
|
"-F%s" % mve_output_scale,
|
||||||
|
'-mmask'
|
||||||
]
|
]
|
||||||
|
|
||||||
# run scene2pset
|
# run scene2pset
|
||||||
|
|
Ładowanie…
Reference in New Issue