kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
8f03ee7023
commit
d6f3c94f1a
|
@ -129,7 +129,7 @@ endforeach()
|
|||
|
||||
externalproject_add(mve
|
||||
GIT_REPOSITORY https://github.com/OpenDroneMap/mve.git
|
||||
GIT_TAG 099
|
||||
GIT_TAG 200
|
||||
UPDATE_COMMAND ""
|
||||
SOURCE_DIR ${SB_SOURCE_DIR}/elibs/mve
|
||||
CONFIGURE_COMMAND ""
|
||||
|
|
|
@ -2,19 +2,10 @@ import os
|
|||
import shutil, errno
|
||||
import json
|
||||
|
||||
def get_files_list(path_dir):
|
||||
return os.listdir(path_dir)
|
||||
|
||||
|
||||
def absolute_path_file(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):
|
||||
path_file = os.path.abspath(os.path.dirname(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:
|
||||
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
|
||||
feature_process_size = 2048 # default
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
import re
|
||||
import os
|
||||
|
||||
import exifread
|
||||
import numpy as np
|
||||
|
@ -14,12 +15,24 @@ import xmltodict as x2d
|
|||
from opendm import get_image_size
|
||||
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:
|
||||
"""ODMPhoto - a class for ODMPhotos"""
|
||||
|
||||
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)
|
||||
self.filename = io.extract_file_from_path_file(path_file)
|
||||
self.width = None
|
||||
self.height = None
|
||||
self.camera_make = ''
|
||||
|
|
|
@ -49,16 +49,16 @@ class ODMLoadDatasetStage(types.ODM_Stage):
|
|||
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))
|
||||
|
||||
# check if the extension is supported
|
||||
def supported_extension(file_name):
|
||||
(pathfn, ext) = os.path.splitext(file_name)
|
||||
return ext.lower() in context.supported_extensions
|
||||
# check if the image filename is supported
|
||||
def valid_image_filename(filename):
|
||||
(pathfn, ext) = os.path.splitext(filename)
|
||||
return ext.lower() in context.supported_extensions and pathfn[-5:] != "_mask"
|
||||
|
||||
# Get supported images from dir
|
||||
def get_images(in_dir):
|
||||
# filter images for its extension type
|
||||
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
|
||||
input_dir = tree.input_images
|
||||
|
|
|
@ -77,7 +77,8 @@ class ODMMveStage(types.ODM_Stage):
|
|||
self.update_progress(90)
|
||||
|
||||
scene2pset_config = [
|
||||
"-F%s" % mve_output_scale
|
||||
"-F%s" % mve_output_scale,
|
||||
'-mmask'
|
||||
]
|
||||
|
||||
# run scene2pset
|
||||
|
|
Ładowanie…
Reference in New Issue