kopia lustrzana https://github.com/OpenDroneMap/ODM
PoC DNG file support
rodzic
0333e08ce0
commit
175d141ea7
|
@ -21,7 +21,7 @@ The easiest way to run ODM is via docker. To install docker, see [docs.docker.co
|
|||
docker pull opendronemap/odm
|
||||
```
|
||||
|
||||
Run ODM by placing some images (JPEGs or TIFFs) in a folder named “images” (for example `C:\Users\youruser\datasets\project\images` or `/home/youruser/datasets/project/images`) and simply run from a Command Prompt / Terminal:
|
||||
Run ODM by placing some images (JPEGs, TIFFs or DNGs) in a folder named “images” (for example `C:\Users\youruser\datasets\project\images` or `/home/youruser/datasets/project/images`) and simply run from a Command Prompt / Terminal:
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
|
|
|
@ -244,7 +244,7 @@ externalproject_add(dem2points
|
|||
externalproject_add(odm_orthophoto
|
||||
DEPENDS opencv
|
||||
GIT_REPOSITORY https://github.com/OpenDroneMap/odm_orthophoto.git
|
||||
GIT_TAG 353
|
||||
GIT_TAG 355
|
||||
PREFIX ${SB_BINARY_DIR}/odm_orthophoto
|
||||
SOURCE_DIR ${SB_SOURCE_DIR}/odm_orthophoto
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
|
||||
|
|
|
@ -25,7 +25,7 @@ ExternalProject_Add(${_proj_name}
|
|||
#--Download step--------------
|
||||
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
|
||||
GIT_REPOSITORY https://github.com/OpenDroneMap/OpenSfM/
|
||||
GIT_TAG 352
|
||||
GIT_TAG 355
|
||||
#--Update/Patch step----------
|
||||
UPDATE_COMMAND git submodule update --init --recursive
|
||||
#--Configure step-------------
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.5.4
|
||||
3.5.5
|
||||
|
|
|
@ -40,7 +40,7 @@ odm_orthophoto_path = os.path.join(superbuild_bin_path, "odm_orthophoto")
|
|||
settings_path = os.path.join(root_path, 'settings.yaml')
|
||||
|
||||
# Define supported image extensions
|
||||
supported_extensions = {'.jpg','.jpeg','.png', '.tif', '.tiff', '.bmp'}
|
||||
supported_extensions = {'.jpg','.jpeg','.png', '.tif', '.tiff', '.bmp', '.raw', '.dng', '.nef'}
|
||||
supported_video_extensions = {'.mp4', '.mov', '.lrv', '.ts'}
|
||||
|
||||
# Define the number of cores
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from PIL import Image
|
||||
import cv2
|
||||
|
||||
import rawpy
|
||||
from opendm import log
|
||||
|
||||
Image.MAX_IMAGE_PIXELS = None
|
||||
|
@ -9,12 +9,19 @@ def get_image_size(file_path, fallback_on_error=True):
|
|||
"""
|
||||
Return (width, height) for a given img file
|
||||
"""
|
||||
|
||||
try:
|
||||
with Image.open(file_path) as img:
|
||||
width, height = img.size
|
||||
if file_path[-4:].lower() in [".dng", ".raw", ".nef"]:
|
||||
with rawpy.imread(file_path) as img:
|
||||
s = img.sizes
|
||||
|
||||
width, height = s.raw_width, s.raw_height
|
||||
else:
|
||||
with Image.open(file_path) as img:
|
||||
width, height = img.size
|
||||
except Exception as e:
|
||||
if fallback_on_error:
|
||||
log.ODM_WARNING("Cannot read %s with PIL, fallback to cv2: %s" % (file_path, str(e)))
|
||||
log.ODM_WARNING("Cannot read %s with image library, fallback to cv2: %s" % (file_path, str(e)))
|
||||
img = cv2.imread(file_path)
|
||||
width = img.shape[1]
|
||||
height = img.shape[0]
|
||||
|
|
|
@ -69,6 +69,12 @@ def find_largest_photo(photos):
|
|||
|
||||
return max_p
|
||||
|
||||
def has_raw_format_photo(photos):
|
||||
for p in photos:
|
||||
if p.is_raw_format():
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_mm_per_unit(resolution_unit):
|
||||
"""Length of a resolution unit in millimeters.
|
||||
|
||||
|
@ -510,6 +516,9 @@ class ODM_Photo:
|
|||
self.compute_focal(tags, xtags)
|
||||
self.compute_opk()
|
||||
|
||||
def is_raw_format(self):
|
||||
return self.filename[-4:].lower() in [".dng", ".raw", ".nef"]
|
||||
|
||||
def compute_focal(self, tags, xtags):
|
||||
try:
|
||||
self.focal_ratio = self.extract_focal(self.camera_make, self.camera_model, tags, xtags)
|
||||
|
|
|
@ -23,6 +23,7 @@ rasterio==1.2.3 ; sys_platform == 'linux'
|
|||
rasterio==1.3.6 ; sys_platform == 'darwin'
|
||||
https://github.com/OpenDroneMap/windows-deps/raw/main/rasterio-1.2.3-cp38-cp38-win_amd64.whl ; sys_platform == 'win32'
|
||||
https://github.com/OpenDroneMap/windows-deps/raw/main/GDAL-3.2.3-cp38-cp38-win_amd64.whl ; sys_platform == 'win32'
|
||||
rawpy==0.21.0
|
||||
repoze.lru==0.7
|
||||
scikit-learn==1.1.1
|
||||
Pywavelets==1.3.0
|
||||
|
|
|
@ -6,7 +6,7 @@ from opendm import system
|
|||
from opendm import context
|
||||
from opendm import types
|
||||
from opendm.multispectral import get_primary_band_name
|
||||
from opendm.photo import find_largest_photo_dim
|
||||
from opendm.photo import find_largest_photo_dim, has_raw_format_photo
|
||||
from opendm.objpacker import obj_pack
|
||||
from opendm.gltf import obj2glb
|
||||
|
||||
|
@ -18,7 +18,14 @@ class ODMMvsTexStage(types.ODM_Stage):
|
|||
max_dim = find_largest_photo_dim(reconstruction.photos)
|
||||
max_texture_size = 8 * 1024 # default
|
||||
|
||||
if max_dim > 8000:
|
||||
if has_raw_format_photo(reconstruction.photos):
|
||||
# Assuming the output are usually 16bit RGB TIFFs
|
||||
# if we don't decrease the size, opencv imread calls in odm_orthophoto
|
||||
# fail to open the resulting texture images due to excessive size.
|
||||
log.ODM_INFO("RAW format images, decreasing maximum texture size.")
|
||||
max_texture_size //= 2
|
||||
|
||||
elif max_dim > 8000:
|
||||
log.ODM_INFO("Large input images (%s pixels), increasing maximum texture size." % max_dim)
|
||||
max_texture_size *= 3
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue