优化
This commit is contained in:
1 parent
46dacc2f7c
commit
2093ff5526
3 files changed
+26
-34
No files matched your search
+3
-30
@@ -94,30 +94,6 @@ def detect_markers(psid, pid):
|
||||
# photo3 exist, 设置photo3的xmp文件,不参与建模
|
||||
libs.set_photo_join_type(config.workdir, pid, 'photo3', filename.split('_')[0], mesh='0', texture='1')
|
||||
|
||||
def cal_reconstruction_region(psid, pid):
|
||||
def fix_region():
|
||||
region_filename = os.path.join(config.workdir, pid, f'{pid}.rcbox')
|
||||
with open(region_filename, 'r') as f:
|
||||
lines = f.readlines()
|
||||
lines = [line.replace('"NONE" globalCoordinateSystemWkt="NONE" globalCoordinateSystemName="NONE"', '"+proj=geocent +ellps=WGS84 +no_defs" globalCoordinateSystemName="local:1 - Euclidean"') for line in lines]
|
||||
add_photo3 = ' '
|
||||
if os.path.exists(os.path.join(config.workdir, pid, 'photo3')):
|
||||
add_photo3 = ' -addFolder "' + os.path.join(config.workdir, pid, 'photo3') + '" '
|
||||
cmd = f'{config.rcbin} {config.r2["init"]} -setInstanceName {pid} \
|
||||
-load "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" \
|
||||
-addFolder "{os.path.join(config.workdir, pid, "photo2")}" -align {add_photo3} \
|
||||
-detectMarkers "D:\\make2\\config\\detectMarkers.config.xml" {libs.get_defineDistances(psid)} -align -align \
|
||||
-update {config.r2["setRegion"]} \
|
||||
-exportControlPointsMeasurements "{os.path.join(config.workdir, pid, f"{pid}.controlPoints.csv")}" "D:\\make2\\config\\exportControlPoints.config.xml" \
|
||||
-selectAllImages -exportXMP "D:\\make2\\config\\exportXMP.config.xml" \
|
||||
-exportReconstructionRegion "{os.path.join(config.workdir, pid, f"{pid}.rcbox")}" \
|
||||
-save "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" -quit'
|
||||
print(cmd)
|
||||
cmd = shlex.split(cmd)
|
||||
res = subprocess.run(cmd)
|
||||
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="",isNoColorTexture=""):
|
||||
libs_db.start_task({"task_type": "make", "task_key": pid})
|
||||
|
||||
@@ -131,10 +107,7 @@ def step1(pid, experience=False, makeloop=True,task_distributed_id="",isNoColorT
|
||||
# 下载图片
|
||||
start_time = time.time()
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} 开始下载图片...')
|
||||
if experience:
|
||||
libs.down_from_oss(config.oss_bucket, config.workdir, pid, per=50)
|
||||
else:
|
||||
libs.down_from_oss(config.oss_bucket, config.workdir, pid)
|
||||
libs.down_from_oss(config.oss_bucket, config.workdir, pid)
|
||||
os.system(f'python tools/downxmps.py {pid}')
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} 图片下载完成,共费时{libs.diff_time(start_time)}')
|
||||
|
||||
@@ -223,7 +196,7 @@ def main(pid, experience=False, makeloop=True,task_distributed_id="",isNoColorTe
|
||||
time.sleep(3)
|
||||
continue
|
||||
else:
|
||||
experience = True
|
||||
experience = False
|
||||
step1(pid, experience, makeloop,task_distributed_id,isNoColorTexture)
|
||||
else:
|
||||
step1(pid, experience, makeloop,task_distributed_id,isNoColorTexture)
|
||||
@@ -242,7 +215,7 @@ if __name__ == '__main__':
|
||||
experience = False
|
||||
if sys.argv[2] == '1':
|
||||
print('演示测试...')
|
||||
experience = True
|
||||
experience = False
|
||||
elif sys.argv[2] == 'NoColorTexture':
|
||||
isNoColorTexture = "NoColorTexture"
|
||||
pids = sys.argv[1].split(',')
|
||||
|
||||
Reference in new issue
Block a user