Browse Source

新影棚也需要进行xmps 共享

master
dongchangxi 12 months ago
parent
commit
d51cc017a1
  1. 25
      new_studio_to_reg/get_new_studio_reg_info.py
  2. 4
      new_studio_to_reg/tools_to_xmps.py

25
new_studio_to_reg/get_new_studio_reg_info.py

@ -27,8 +27,8 @@ def get_xmps(psid,pid):
if file.key.endswith('.xmp'): if file.key.endswith('.xmp'):
filename = file.key.split('/')[-1] filename = file.key.split('/')[-1]
print('正在下载:', file.key) print('正在下载:', file.key)
# os.makedirs(os.path.join(config.sharedir, 'xmps_new_studio_rate', psid, 'texture'), exist_ok=True) 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)) config.oss_bucket.get_object_to_file(file.key, os.path.join(config.sharedir,'xmps_new_studio_rate',psid, 'texture', filename))
#将共享盘的对齐信息复制到工作目录,photo1 和 photo2 #将共享盘的对齐信息复制到工作目录,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) # 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): def get_photo2_align_info(pid):
pid = str(pid) pid = str(pid)
psid = libs.getPSid(pid) psid = libs.getPSid(pid)
#判断是否存在该目录 #判断是否存在该目录
if os.path.exists(os.path.join(config.workdir, pid)) == False: 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"))) 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}/')}") 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 isRate = False
# if not config.oss_bucket.object_exists(filename): if not config.oss_bucket.object_exists(filename):
# #提示是否进行 xmps_new_studio_rate 文件夹的创建 #提示是否进行 xmps_new_studio_rate 文件夹的创建
# yes_or_not = input('当前该影棚没有对应的对齐坐标,是否创建?(y/n)') yes_or_not = input('当前该影棚没有对应的对齐坐标,是否创建?(y/n)')
# if yes_or_not == 'y': if yes_or_not == 'y':
# tools_to_xmps.create_rate_xmps(pid) tools_to_xmps.create_rate_xmps(pid)
# isRate = True isRate = True
# else: else:
# sys.exit(0) sys.exit(0)
#旋转图片 #旋转图片
if isRate == False: if isRate == False:
@ -77,7 +76,7 @@ def get_photo2_align_info(pid):
tools_to_xmps.rateImages(pid) tools_to_xmps.rateImages(pid)
#下载对齐信息 #下载对齐信息
#get_xmps(psid,pid) get_xmps(psid,pid)
#执行对齐指令 #执行对齐指令
cmd = f'{config.rcbin} {config.r2["init"]} -setInstanceName {pid} \ cmd = f'{config.rcbin} {config.r2["init"]} -setInstanceName {pid} \

4
new_studio_to_reg/tools_to_xmps.py

@ -122,7 +122,7 @@ def create_rate_xmps(pid):
#photos1_count = len(os.listdir(photo1_path)) #photos1_count = len(os.listdir(photo1_path))
photos2_count = len(os.listdir(photo2_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},未能覆盖所有相机,是否继续计算相机位姿?') print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} photo2数量{photos2_count},未能覆盖所有相机,是否继续计算相机位姿?')
continue_or_not = input('是否继续计算相机位姿?(y/n)') continue_or_not = input('是否继续计算相机位姿?(y/n)')
if continue_or_not == 'y': if continue_or_not == 'y':
@ -169,7 +169,7 @@ def create_rate_xmps(pid):
if upload_or_not == 'y': if upload_or_not == 'y':
upload_xmp(pid) 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__': if __name__ == '__main__':

Loading…
Cancel
Save