From 2b2875bec6f4ba358530e293caec80d011b71ea9 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 11 Jan 2023 15:48:37 -0500 Subject: [PATCH] Fix width/height --- opendm/objpacker/objpacker.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/opendm/objpacker/objpacker.py b/opendm/objpacker/objpacker.py index 533c310d..75ddf863 100644 --- a/opendm/objpacker/objpacker.py +++ b/opendm/objpacker/objpacker.py @@ -2,8 +2,12 @@ import os import rasterio import warnings import numpy as np -from .imagepacker.utils import AABB -from .imagepacker import pack +try: + from .imagepacker.utils import AABB + from .imagepacker import pack +except ImportError: + from imagepacker.utils import AABB + from imagepacker import pack warnings.filterwarnings("ignore", category=rasterio.errors.NotGeoreferencedWarning) @@ -139,10 +143,13 @@ def write_obj_changes(obj_file, mtl_file, uv_changes, single_mat, output_dir, _i f.writelines(out_lines) def write_output_tex(img, profile, path, _info=print): - _, h, w = img.shape + _, w, h = img.shape profile['width'] = w profile['height'] = h + if 'tiled' in profile: + profile['tiled'] = False + _info("Writing %s (%sx%s pixels)" % (path, w, h)) with rasterio.open(path, 'w', **profile) as dst: for b in range(1, img.shape[0] + 1):