Browse Source

不參與貼圖的修改

master
dongchangxi 2 years ago
parent
commit
05438bb2da
  1. 3
      libs/config.py
  2. 32
      main_step1.py

3
libs/config.py

@ -135,3 +135,6 @@ task_run_timeout = { @@ -135,3 +135,6 @@ task_run_timeout = {
high_host = ["R11","R12"]
low_host = ["R13","R14","R15","R16","R17"]
#不参与贴图的照片,使用的时候还需要增加指令 python main_step1.py 123 no_texture
noTextureColorPics = ["13", "23", "31", "52", "72", "82", "142", "173"] # 昆山老數據不慘與貼圖["134","135","136","142","143","14","15","16","24","25","26","44","45"]

32
main_step1.py

@ -112,7 +112,7 @@ def cal_reconstruction_region(psid, pid): @@ -112,7 +112,7 @@ def cal_reconstruction_region(psid, pid):
fix_region()
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 重建区域计算完成')
def step1(pid, experience=False, makeloop=True,task_distributed_id=""):
def step1(pid, experience=False, makeloop=True,task_distributed_id="",isNoColorTexture=""):
libs_db.start_task({"task_type": "make", "task_key": pid})
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 开始处理{pid}建模任务')
@ -167,6 +167,21 @@ def step1(pid, experience=False, makeloop=True,task_distributed_id=""): @@ -167,6 +167,21 @@ def step1(pid, experience=False, makeloop=True,task_distributed_id=""):
shutil.copytree(os.path.join(config.workdir, pid), os.path.join(config.sharedir, pid))
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} step1任务完成,移动到共享目录')
#指定photo2某些图片不参与贴图
#是否不参与贴图,true 不参与贴图
if isNoColorTexture == "NoColorTexture":
arrNoTextureColorPics = config.noTextureColorPics
if arrNoTextureColorPics is not None and len(arrNoTextureColorPics) > 0:
for camcerIndex in arrNoTextureColorPics:
#拼装坐标文件名称
filename = os.path.join(config.sharedir, pid,"photo2",str(camcerIndex)+"_8.xmp")
#判断文件是否存在
if os.path.exists(filename):
#存在就设置不参与贴图
libs.set_photo_join_type(config.workdir, pid, 'photo2', camcerIndex, mesh='0', texture='0')
# TODO: 更新本地step1任务状态,加入step2任务队列
if task_distributed_id == "":#不是分布式任务的时候就自动往下个步骤走,是分布式任务的时候就就执行当前任务
if makeloop:
@ -184,7 +199,7 @@ def step1(pid, experience=False, makeloop=True,task_distributed_id=""): @@ -184,7 +199,7 @@ def step1(pid, experience=False, makeloop=True,task_distributed_id=""):
return
def main(pid, experience=False, makeloop=True):
def main(pid, experience=False, makeloop=True,task_distributed_id="",isNoColorTexture=""):
if pid == '0':
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 开始进入本地任务值守模式...')
while True:
@ -199,26 +214,29 @@ def main(pid, experience=False, makeloop=True): @@ -199,26 +214,29 @@ def main(pid, experience=False, makeloop=True):
continue
else:
experience = True
step1(pid, experience, makeloop)
step1(pid, experience, makeloop,task_distributed_id,isNoColorTexture)
else:
step1(pid, experience, makeloop)
step1(pid, experience, makeloop,task_distributed_id,isNoColorTexture)
if __name__ == '__main__':
# 取云端redis任务,完成第一步的数据预处理后,将数据放入共享存储目录,将第二步任务塞入本地mysql队列
# 默认循环值守,可传参数运行单一任务,以方便调试
pid = '0'
isNoColorTexture = ""
if len(sys.argv) == 2:
pids = sys.argv[1].split(',')
for pid in pids:
main(pid, experience=False, makeloop=False)
main(pid, experience=False, makeloop=False,task_distributed_id="",isNoColorTexture=isNoColorTexture)
exit()
if len(sys.argv) == 3:
experience = False
if sys.argv[2] == '1':
print('演示测试...')
experience = True
elif sys.argv[2] == 'NoColorTexture':
isNoColorTexture = "NoColorTexture"
pids = sys.argv[1].split(',')
for pid in pids:
main(pid, experience=experience, makeloop=False)
main(pid, experience=experience, makeloop=False,task_distributed_id="",isNoColorTexture=isNoColorTexture)
exit()
main(pid, experience=False, makeloop=True)
main(pid, experience=False, makeloop=True,task_distributed_id="",isNoColorTexture=isNoColorTexture)
Loading…
Cancel
Save