|
|
|
|
@ -73,11 +73,18 @@ def filter_dark_texture_image(pid):
@@ -73,11 +73,18 @@ def filter_dark_texture_image(pid):
|
|
|
|
|
|
|
|
|
|
def detect_markers(psid, pid): |
|
|
|
|
def fix_region(): |
|
|
|
|
region_filename = os.path.join(config['workdir'], pid, f'{pid}.rcbox') |
|
|
|
|
#判断是否存在rcbox |
|
|
|
|
region_filename = os.path.join(config["workdir"], pid, f"{pid}.rcbox") |
|
|
|
|
while True: |
|
|
|
|
if os.path.exists(region_filename): |
|
|
|
|
print("region_filename",region_filename) |
|
|
|
|
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] |
|
|
|
|
|
|
|
|
|
break |
|
|
|
|
else: |
|
|
|
|
time.sleep(10) |
|
|
|
|
print(f"不存在{region_filename}") |
|
|
|
|
start_time = time.time() |
|
|
|
|
textpicCmd ='-selectImage "'+os.path.join(config['workdir'],pid,'photo2')+'\*" -enableTexturingAndColoring true' |
|
|
|
|
|
|
|
|
|
@ -88,9 +95,9 @@ def detect_markers(psid, pid):
@@ -88,9 +95,9 @@ def detect_markers(psid, pid):
|
|
|
|
|
-save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ |
|
|
|
|
-addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -align -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" \ |
|
|
|
|
-align -selectAllImages \ |
|
|
|
|
-detectMarkers "{dirCurr}\detectMarkers.config.xml" \ |
|
|
|
|
-detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ |
|
|
|
|
-defineDistance 36h11:001 36h11:002 1 -defineDistance 36h11:002 36h11:004 1 -defineDistance 36h11:004 36h11:003 1 -defineDistance 36h11:003 36h11:001 1 -align -align -update {config["r2"]["setRegion"]} \ |
|
|
|
|
-exportXMP "{dirCurr}\exportXMP.config.xml" \ |
|
|
|
|
-exportXMP "{dirCurr}\exportXMP.1.5.draft.config.xml" \ |
|
|
|
|
-exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ |
|
|
|
|
-exportReconstructionRegion "{os.path.join(config["workdir"], pid, f"{pid}.rcbox")}" \ |
|
|
|
|
{textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' |
|
|
|
|
@ -126,18 +133,27 @@ def step2(pid,headsCount):
@@ -126,18 +133,27 @@ def step2(pid,headsCount):
|
|
|
|
|
print(cmd) |
|
|
|
|
cmd = shlex.split(cmd) |
|
|
|
|
res = subprocess.run(cmd) |
|
|
|
|
print("res",res) |
|
|
|
|
#阻塞判断是否导出完成 |
|
|
|
|
while True: |
|
|
|
|
try: |
|
|
|
|
#判断 output 目录下是否存在 三个文件 |
|
|
|
|
files = os.listdir(os.path.join(config['workdir'], pid, "output")) |
|
|
|
|
if len(files) >= 3: |
|
|
|
|
time.sleep(5) |
|
|
|
|
break |
|
|
|
|
except Exception as e: |
|
|
|
|
time.sleep(5) |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#将导出的文件移动到指定目录 |
|
|
|
|
sourceDir = config["local_complate_build"] |
|
|
|
|
#判断目录是否存在,不存在就创建 |
|
|
|
|
if not os.path.exists(sourceDir): |
|
|
|
|
os.makedirs(sourceDir) |
|
|
|
|
if os.path.exists(os.path.join(sourceDir,pid)): |
|
|
|
|
#删除 |
|
|
|
|
os.removedirs(os.path.join(sourceDir,pid)) |
|
|
|
|
os.makedirs(os.path.join(sourceDir,pid)) |
|
|
|
|
|
|
|
|
|
#将 output 目录里的文件移动到指定目录 |
|
|
|
|
shutil.move(os.path.join(config['workdir'], pid, "output"),os.path.join(sourceDir,pid)) |
|
|
|
|
@ -153,6 +169,8 @@ def main(pid,headsCount):
@@ -153,6 +169,8 @@ def main(pid,headsCount):
|
|
|
|
|
step1(pid, headsCount) |
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
# step1("235558",1) |
|
|
|
|
# exit() |
|
|
|
|
try: |
|
|
|
|
url = config['urls']['update_status_modelsuccess_url'] |
|
|
|
|
if url == "": |
|
|
|
|
@ -191,13 +209,15 @@ if __name__ == '__main__':
@@ -191,13 +209,15 @@ if __name__ == '__main__':
|
|
|
|
|
try: |
|
|
|
|
while True: |
|
|
|
|
time.sleep(5) |
|
|
|
|
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 建模任务循环开始') |
|
|
|
|
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 建模任务循环开始,{needBuildDir}') |
|
|
|
|
for pid in os.listdir(needBuildDir): |
|
|
|
|
print("pid=",pid) |
|
|
|
|
if not os.path.isdir(os.path.join(needBuildDir,pid)): |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
#判断是否存在 canDo.txt 文件,如果不存在就跳过 |
|
|
|
|
if not os.path.exists(os.path.join(needBuildDir,pid,"canDo.txt")): |
|
|
|
|
print(f'不存在 canDo.txt- {os.path.join(needBuildDir,pid,"canDo.txt")}') |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
#读取 canDo.txt 文件内容 |
|
|
|
|
@ -208,6 +228,7 @@ if __name__ == '__main__':
@@ -208,6 +228,7 @@ if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
#判断文件夹里是否存在 do.txt , 如果存在就跳过,不存在就创建 |
|
|
|
|
if os.path.exists(os.path.join(needBuildDir,pid,"do.txt")): |
|
|
|
|
print("存在 do.txt 。则跳过处理") |
|
|
|
|
continue |
|
|
|
|
else: |
|
|
|
|
with open(os.path.join(needBuildDir,pid,"do.txt"),"w") as f: |
|
|
|
|
|