From d51cc017a13047a851efd1b00f272b9152342993 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sun, 5 Jan 2025 10:20:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BD=B1=E6=A3=9A=E4=B9=9F=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E8=BF=9B=E8=A1=8Cxmps=20=E5=85=B1=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- new_studio_to_reg/get_new_studio_reg_info.py | 25 ++++++++++---------- new_studio_to_reg/tools_to_xmps.py | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/new_studio_to_reg/get_new_studio_reg_info.py b/new_studio_to_reg/get_new_studio_reg_info.py index 27bbabb..e57e8c0 100644 --- a/new_studio_to_reg/get_new_studio_reg_info.py +++ b/new_studio_to_reg/get_new_studio_reg_info.py @@ -27,8 +27,8 @@ def get_xmps(psid,pid): if file.key.endswith('.xmp'): filename = file.key.split('/')[-1] print('正在下载:', file.key) - # os.makedirs(os.path.join(config.sharedir, 'xmps_new_studio_rate', psid, 'texture'), exist_ok=True) - config.oss_bucket.get_object_to_file(file.key, os.path.join(config.sharedir,'xmps_new_studio_rate', 'texture', filename)) + os.makedirs(os.path.join(config.sharedir, 'xmps_new_studio_rate', psid, 'texture'), exist_ok=True) + config.oss_bucket.get_object_to_file(file.key, os.path.join(config.sharedir,'xmps_new_studio_rate',psid, 'texture', filename)) #将共享盘的对齐信息复制到工作目录,photo1 和 photo2 # shutil.copytree(os.path.join(config.sharedir, 'xmps_new_studio_rate', psid, 'mesh'), os.path.join(config.workdir, pid, 'photo1'),dirs_exist_ok=True) @@ -44,7 +44,6 @@ def get_xmps(psid,pid): def get_photo2_align_info(pid): pid = str(pid) psid = libs.getPSid(pid) - #判断是否存在该目录 if os.path.exists(os.path.join(config.workdir, pid)) == False: #下载照片 @@ -60,16 +59,16 @@ def get_photo2_align_info(pid): photosNums = len(os.listdir(os.path.join(config.workdir, pid, "photo2"))) #判断是否存在该目录 print(f"影棚号:{psid} , {config.oss_bucket.object_exists(f'xmps_new_studio_rate/{psid}/')}") - #filename = f'xmps_new_studio_rate/{psid}/{psid}.rcbox' + filename = f'xmps_new_studio_rate/{psid}/{psid}.rcbox' isRate = False - # if not config.oss_bucket.object_exists(filename): - # #提示是否进行 xmps_new_studio_rate 文件夹的创建 - # yes_or_not = input('当前该影棚没有对应的对齐坐标,是否创建?(y/n)') - # if yes_or_not == 'y': - # tools_to_xmps.create_rate_xmps(pid) - # isRate = True - # else: - # sys.exit(0) + if not config.oss_bucket.object_exists(filename): + #提示是否进行 xmps_new_studio_rate 文件夹的创建 + yes_or_not = input('当前该影棚没有对应的对齐坐标,是否创建?(y/n)') + if yes_or_not == 'y': + tools_to_xmps.create_rate_xmps(pid) + isRate = True + else: + sys.exit(0) #旋转图片 if isRate == False: @@ -77,7 +76,7 @@ def get_photo2_align_info(pid): tools_to_xmps.rateImages(pid) #下载对齐信息 - #get_xmps(psid,pid) + get_xmps(psid,pid) #执行对齐指令 cmd = f'{config.rcbin} {config.r2["init"]} -setInstanceName {pid} \ diff --git a/new_studio_to_reg/tools_to_xmps.py b/new_studio_to_reg/tools_to_xmps.py index 3df72e7..1a38ef3 100644 --- a/new_studio_to_reg/tools_to_xmps.py +++ b/new_studio_to_reg/tools_to_xmps.py @@ -122,7 +122,7 @@ def create_rate_xmps(pid): #photos1_count = len(os.listdir(photo1_path)) photos2_count = len(os.listdir(photo2_path)) - if photos2_count < 21: + if photos2_count < 22: print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} photo2数量{photos2_count},未能覆盖所有相机,是否继续计算相机位姿?') continue_or_not = input('是否继续计算相机位姿?(y/n)') if continue_or_not == 'y': @@ -169,7 +169,7 @@ def create_rate_xmps(pid): if upload_or_not == 'y': upload_xmp(pid) - print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} rate_xmps文件生成完成,共费时{libs.diff_time(start_time)}') + print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} xmps_new_studio_rate文件生成完成,共费时{libs.diff_time(start_time)}') if __name__ == '__main__':