From 01098b5cc09874bc5f77e127c3fda901d2b18414 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Thu, 9 Jan 2025 15:20:52 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E5=AF=B9=E9=BD=90=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=92=8C=E7=85=A7=E7=89=87=E6=95=B0=E9=87=8F=E7=9A=84=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- old_to_new_build/get_reg_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/old_to_new_build/get_reg_info.py b/old_to_new_build/get_reg_info.py index fa7fb0e..b934938 100644 --- a/old_to_new_build/get_reg_info.py +++ b/old_to_new_build/get_reg_info.py @@ -112,7 +112,7 @@ def get_photo2_align_info(pid,flagDoXmps=False): #上传到指定的目录 config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/repeat_build/jpgs/{file}', os.path.join(config.workdir, pid, 'reg', file)) - + print(f'影棚号:{psid} , PID:{pid},照片数量:{photosNums} 对齐的图片数量:{alignNums}') if alignNums != photosNums: notify(f'影棚号:{psid} , PID:{pid},没有对齐,照片数量:{photosNums} 对齐的图片数量:{alignNums}') #删除文件夹 From 19bd30acfb13af099ebd7886a660f3c438b3b619 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 20:20:42 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E4=BA=91=E7=AE=AD=E5=BB=BA=E6=A8=A11.5rc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yj_local_build/config.json | 6 +-- yj_local_build/detectMarkers_1.5.config.xml | 7 +++ yj_local_build/exportXMP.1.5.draft.config.xml | 8 +++ yj_local_build/exportXMP.1.5.lock.config.xml | 8 +++ yj_local_build/main_step1.py | 53 +++++++++++++------ 5 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 yj_local_build/detectMarkers_1.5.config.xml create mode 100644 yj_local_build/exportXMP.1.5.draft.config.xml create mode 100644 yj_local_build/exportXMP.1.5.lock.config.xml diff --git a/yj_local_build/config.json b/yj_local_build/config.json index ae82af5..4423757 100644 --- a/yj_local_build/config.json +++ b/yj_local_build/config.json @@ -1,8 +1,8 @@ { "workdir": "D://", - "local_need_build": "/\\172.31.1.253/modeling/local_need_build", - "local_complate_build":"/\\172.31.1.253/modeling/local_complate_build", - "rcbin": "'C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe'", + "local_need_build": "D://local_need_build", + "local_complate_build":"D://local_complate_build", + "rcbin": "'C:\\Program Files\\Epic Games\\RealityCapture_1.5\\AppProxy.exe'", "urls": { "update_status_modelsuccess_url": "http://172.16.20.13:8383/update_take_photo" }, diff --git a/yj_local_build/detectMarkers_1.5.config.xml b/yj_local_build/detectMarkers_1.5.config.xml new file mode 100644 index 0000000..8f436f7 --- /dev/null +++ b/yj_local_build/detectMarkers_1.5.config.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/yj_local_build/exportXMP.1.5.draft.config.xml b/yj_local_build/exportXMP.1.5.draft.config.xml new file mode 100644 index 0000000..8f7ebb6 --- /dev/null +++ b/yj_local_build/exportXMP.1.5.draft.config.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/yj_local_build/exportXMP.1.5.lock.config.xml b/yj_local_build/exportXMP.1.5.lock.config.xml new file mode 100644 index 0000000..c073e91 --- /dev/null +++ b/yj_local_build/exportXMP.1.5.lock.config.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index f2cd11b..c499f69 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -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') - 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] - + #判断是否存在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): -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): print(cmd) cmd = shlex.split(cmd) res = subprocess.run(cmd) + print("res",res) #阻塞判断是否导出完成 while True: - #判断 output 目录下是否存在 三个文件 - files = os.listdir(os.path.join(config['workdir'], pid, "output")) - if len(files) >= 3: - break + 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)) @@ -152,7 +168,9 @@ def step2(pid,headsCount): def main(pid,headsCount): step1(pid, headsCount) -if __name__ == '__main__': +if __name__ == '__main__': + # step1("235558",1) + # exit() try: url = config['urls']['update_status_modelsuccess_url'] if url == "": @@ -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__': #判断文件夹里是否存在 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: From 277766ffca3637e9372eab744f8037d0721695d0 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 20:34:56 +0800 Subject: [PATCH 03/23] 1 --- yj_local_build/main_step1.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index c499f69..f7ac059 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -165,6 +165,24 @@ def step2(pid,headsCount): print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid:{pid} - 建模完成状态变更失败 - {e}') +#做xmps的坐标 +def getXmps(pid): + + #从共享盘上下载对齐信息,判断是否有 + print(f"判断是否存在 {os.path.join(config.sharedir, 'xmps_rate','texture')} -- {os.path.exists(os.path.join(config.sharedir, 'xmps_rate','texture'))}") + if os.path.exists(os.path.join(config.workdir, 'xmps','texture')) == False or os.path.exists(os.path.join(config.workdir, 'xmps','mesh')) == False: + print(f"检测不到对齐坐标,请先人工建一次模进行对齐,创建坐标,创建制定的坐标到 {os.path.join(config.workdir, 'xmps_rate','mesh')} 和 os.path.join(config.workdir, 'xmps_rate','texture')") + return False + else: + #将共享盘的对齐信息复制到工作目录,photo1 和 photo2 + shutil.copytree(os.path.join(config.workdir, 'xmps_rate','mesh'), os.path.join(config.workdir, pid, 'photo1'),dirs_exist_ok=True) + shutil.copytree(os.path.join(config.workdir, 'xmps_rate','texture'), os.path.join(config.workdir, pid, 'photo2'),dirs_exist_ok=True) + + return True + + + + def main(pid,headsCount): step1(pid, headsCount) @@ -212,6 +230,11 @@ if __name__ == '__main__': print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 建模任务循环开始,{needBuildDir}') for pid in os.listdir(needBuildDir): print("pid=",pid) + + res = getXmps(pid) + if res == False: + break + if not os.path.isdir(os.path.join(needBuildDir,pid)): continue From cd8a15bf49ea4b6a188bf32044a177b5815c0ad8 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 20:40:30 +0800 Subject: [PATCH 04/23] 1 --- yj_local_build/main_step1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index f7ac059..8ba9e67 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -169,7 +169,7 @@ def step2(pid,headsCount): def getXmps(pid): #从共享盘上下载对齐信息,判断是否有 - print(f"判断是否存在 {os.path.join(config.sharedir, 'xmps_rate','texture')} -- {os.path.exists(os.path.join(config.sharedir, 'xmps_rate','texture'))}") + print(f"判断是否存在 {os.path.join(config.workdir, 'xmps_rate','texture')} -- {os.path.exists(os.path.join(config.workdir, 'xmps_rate','texture'))}") if os.path.exists(os.path.join(config.workdir, 'xmps','texture')) == False or os.path.exists(os.path.join(config.workdir, 'xmps','mesh')) == False: print(f"检测不到对齐坐标,请先人工建一次模进行对齐,创建坐标,创建制定的坐标到 {os.path.join(config.workdir, 'xmps_rate','mesh')} 和 os.path.join(config.workdir, 'xmps_rate','texture')") return False From c0ec8a39cfacef3797ad6ae30fd2030a4587c383 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 20:43:15 +0800 Subject: [PATCH 05/23] 1 --- yj_local_build/main_step1.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 8ba9e67..e87f67d 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -169,14 +169,14 @@ def step2(pid,headsCount): def getXmps(pid): #从共享盘上下载对齐信息,判断是否有 - print(f"判断是否存在 {os.path.join(config.workdir, 'xmps_rate','texture')} -- {os.path.exists(os.path.join(config.workdir, 'xmps_rate','texture'))}") + print(f"判断是否存在 {os.path.join(config.workdir, 'xmps','texture')} -- {os.path.exists(os.path.join(config.workdir, 'xmps','texture'))}") if os.path.exists(os.path.join(config.workdir, 'xmps','texture')) == False or os.path.exists(os.path.join(config.workdir, 'xmps','mesh')) == False: - print(f"检测不到对齐坐标,请先人工建一次模进行对齐,创建坐标,创建制定的坐标到 {os.path.join(config.workdir, 'xmps_rate','mesh')} 和 os.path.join(config.workdir, 'xmps_rate','texture')") + print(f"检测不到对齐坐标,请先人工建一次模进行对齐,创建坐标,创建制定的坐标到 {os.path.join(config.workdir, 'xmps','mesh')} 和 {os.path.join(config.workdir, 'xmps','texture')}") return False else: #将共享盘的对齐信息复制到工作目录,photo1 和 photo2 - shutil.copytree(os.path.join(config.workdir, 'xmps_rate','mesh'), os.path.join(config.workdir, pid, 'photo1'),dirs_exist_ok=True) - shutil.copytree(os.path.join(config.workdir, 'xmps_rate','texture'), os.path.join(config.workdir, pid, 'photo2'),dirs_exist_ok=True) + shutil.copytree(os.path.join(config.workdir, 'xmps','mesh'), os.path.join(config.workdir, pid, 'photo1'),dirs_exist_ok=True) + shutil.copytree(os.path.join(config.workdir, 'xmps','texture'), os.path.join(config.workdir, pid, 'photo2'),dirs_exist_ok=True) return True From 0fcb1369344d56f5dbfb0f017b7a892255eeb462 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 20:46:48 +0800 Subject: [PATCH 06/23] 1 --- yj_local_build/main_step1.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index e87f67d..e1877d3 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -169,14 +169,14 @@ def step2(pid,headsCount): def getXmps(pid): #从共享盘上下载对齐信息,判断是否有 - print(f"判断是否存在 {os.path.join(config.workdir, 'xmps','texture')} -- {os.path.exists(os.path.join(config.workdir, 'xmps','texture'))}") - if os.path.exists(os.path.join(config.workdir, 'xmps','texture')) == False or os.path.exists(os.path.join(config.workdir, 'xmps','mesh')) == False: - print(f"检测不到对齐坐标,请先人工建一次模进行对齐,创建坐标,创建制定的坐标到 {os.path.join(config.workdir, 'xmps','mesh')} 和 {os.path.join(config.workdir, 'xmps','texture')}") + print(f"判断是否存在 {os.path.join(config['workdir'], 'xmps','texture')} -- {os.path.exists(os.path.join(config['workdir'], 'xmps','texture'))}") + if os.path.exists(os.path.join(config['workdir'], 'xmps','texture')) == False or os.path.exists(os.path.join(config['workdir'], 'xmps','mesh')) == False: + print(f"检测不到对齐坐标,请先人工建一次模进行对齐,创建坐标,创建制定的坐标到 {os.path.join(config['workdir'], 'xmps','mesh')} 和 {os.path.join(config['workdir'], 'xmps','texture')}") return False else: #将共享盘的对齐信息复制到工作目录,photo1 和 photo2 - shutil.copytree(os.path.join(config.workdir, 'xmps','mesh'), os.path.join(config.workdir, pid, 'photo1'),dirs_exist_ok=True) - shutil.copytree(os.path.join(config.workdir, 'xmps','texture'), os.path.join(config.workdir, pid, 'photo2'),dirs_exist_ok=True) + shutil.copytree(os.path.join(config['workdir'], 'xmps','mesh'), os.path.join(config['workdir'], pid, 'photo1'),dirs_exist_ok=True) + shutil.copytree(os.path.join(config['workdir'], 'xmps','texture'), os.path.join(config['workdir'], pid, 'photo2'),dirs_exist_ok=True) return True From 5c0025ceb96e9a5a97cce16eba8341e2d9c7426c Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 21:05:59 +0800 Subject: [PATCH 07/23] 1 --- yj_local_build/main_step1.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index e1877d3..b17dced 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -263,6 +263,11 @@ if __name__ == '__main__': #将文件夹移动到工作目录 shutil.move(os.path.join(needBuildDir,pid),os.path.join(workdir,pid)) + + res = getXmps(pid) + if res == False: + break + #执行建模流程,建模中的流程 try: requests.post(url, data={'id': pid,'status':4000}) @@ -270,6 +275,7 @@ if __name__ == '__main__': print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid:{pid} - 状态变更失败 - {e}') #continue + main(pid,headsCounts) except Exception as e: print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 建模任务循环异常 - {e}') From b55bed422432532a33023dc7f32d3778db1f7ff2 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 21:14:13 +0800 Subject: [PATCH 08/23] 1 --- yj_local_build/main_step1.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index b17dced..e920302 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -93,9 +93,8 @@ def detect_markers(psid, pid): cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {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")}" \ + -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ -align -selectAllImages \ - -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.1.5.draft.config.xml" \ -exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ From 4c6f8d02c99a7cf84bc784a4d5d52bf8a44aa035 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 21:20:03 +0800 Subject: [PATCH 09/23] 11 --- yj_local_build/main_step1.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index e920302..9ffa917 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -93,8 +93,9 @@ def detect_markers(psid, pid): cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ - -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ - -align -selectAllImages \ + -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ + -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ + -align -align -align -align -selectAllImages \ -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.1.5.draft.config.xml" \ -exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ From a27bdd1894e607ad9b2d41b98d24c562afdb1442 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 21:22:11 +0800 Subject: [PATCH 10/23] 111 --- yj_local_build/main_step1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 9ffa917..b0dbca2 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -95,7 +95,7 @@ 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"]} -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ - -align -align -align -align -selectAllImages \ + -align -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" -align -align -selectAllImages \ -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.1.5.draft.config.xml" \ -exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ From a85f53257f8097d3d476bbdf78a27037fb502b06 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 23:26:41 +0800 Subject: [PATCH 11/23] 1 --- yj_local_build/main_step1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index b0dbca2..08f0a26 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -93,8 +93,8 @@ def detect_markers(psid, pid): cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ - -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ - -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ + -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]}\ + -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ -align -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" -align -align -selectAllImages \ -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.1.5.draft.config.xml" \ From dc2f8a299f490e0bcc479fc3aa5bbea73c08c5bb Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 23:35:11 +0800 Subject: [PATCH 12/23] 1 --- yj_local_build/main_step1.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 08f0a26..a369ca8 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -103,7 +103,29 @@ def detect_markers(psid, pid): {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' print(cmd) cmd = shlex.split(cmd) - res = subprocess.run(cmd) + #res = subprocess.run(cmd) + # 使用 Popen 来执行命令 + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + # 检查命令是否执行完毕 + while True: + return_code = process.poll() # 获取进程的退出码,None 表示进程仍在运行 + if return_code is not None: + print("Command finished with return code:", return_code) + break + print("Command is still running...") + time.sleep(1) # 每秒检查一次进程状态 + + # 获取命令的输出 + stdout, stderr = process.communicate() + + # 打印输出结果 + if return_code == 0: + print("Command executed successfully.") + print(f"Output: {stdout.decode()}") + else: + print(f"Command failed with return code {return_code}") + print(f"Error: {stderr.decode()}") time.sleep(3) fix_region() print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') From 6658d79fd8b9606165760acfc948a2f0cf156189 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Fri, 10 Jan 2025 23:37:44 +0800 Subject: [PATCH 13/23] 111 --- yj_local_build/main_step1.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index a369ca8..08f0a26 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -103,29 +103,7 @@ def detect_markers(psid, pid): {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' print(cmd) cmd = shlex.split(cmd) - #res = subprocess.run(cmd) - # 使用 Popen 来执行命令 - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - # 检查命令是否执行完毕 - while True: - return_code = process.poll() # 获取进程的退出码,None 表示进程仍在运行 - if return_code is not None: - print("Command finished with return code:", return_code) - break - print("Command is still running...") - time.sleep(1) # 每秒检查一次进程状态 - - # 获取命令的输出 - stdout, stderr = process.communicate() - - # 打印输出结果 - if return_code == 0: - print("Command executed successfully.") - print(f"Output: {stdout.decode()}") - else: - print(f"Command failed with return code {return_code}") - print(f"Error: {stderr.decode()}") + res = subprocess.run(cmd) time.sleep(3) fix_region() print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') From af67fbcc0cbcf404979b6b71fa0603da26a078fa Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sat, 11 Jan 2025 23:47:31 +0800 Subject: [PATCH 14/23] 1 --- yj_local_build/main_step1.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 08f0a26..61d3ef7 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -103,7 +103,26 @@ def detect_markers(psid, pid): {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' print(cmd) cmd = shlex.split(cmd) - res = subprocess.run(cmd) + #res = subprocess.run(cmd) + + # ######################################## + + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # 检查进程是否完成 + while True: + retcode = process.poll() # 返回值为None表示进程尚未结束 + if retcode is not None: + # 如果进程已经完成,打印退出状态码 + print(f"Process exited with code: {retcode}") + break + else: + print("Process is still running...") + time.sleep(1) # 每隔1秒检查一次 + stdout, stderr = process.communicate() + print(f"Output: {stdout.decode()}") + print(f"Error: {stderr.decode()}") + # ######################################## + time.sleep(3) fix_region() print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') From 90783ed742eabfb8541f23c1581ef8894325a539 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sat, 11 Jan 2025 23:50:42 +0800 Subject: [PATCH 15/23] 1 --- yj_local_build/main_step1.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 61d3ef7..0429b23 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -121,6 +121,12 @@ def detect_markers(psid, pid): stdout, stderr = process.communicate() print(f"Output: {stdout.decode()}") print(f"Error: {stderr.decode()}") + print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") # ######################################## time.sleep(3) From 82dec6d40ccda0db71d9ed7c870bbb4290032449 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sat, 11 Jan 2025 23:56:17 +0800 Subject: [PATCH 16/23] 1 --- yj_local_build/main_step1.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 0429b23..43bdea0 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -108,17 +108,11 @@ def detect_markers(psid, pid): # ######################################## process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # 检查进程是否完成 - while True: - retcode = process.poll() # 返回值为None表示进程尚未结束 - if retcode is not None: - # 如果进程已经完成,打印退出状态码 - print(f"Process exited with code: {retcode}") - break - else: - print("Process is still running...") - time.sleep(1) # 每隔1秒检查一次 + # 使用 communicate() 等待进程完成 stdout, stderr = process.communicate() + # 获取进程的退出码 + exit_code = process.returncode + print(f"Process exited with code: {exit_code}") print(f"Output: {stdout.decode()}") print(f"Error: {stderr.decode()}") print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") From fadf6c300ed24cc44f040ad9c8c4b25512b39280 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sun, 12 Jan 2025 00:00:16 +0800 Subject: [PATCH 17/23] 1 --- yj_local_build/main_step1.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 43bdea0..3be70ce 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -106,15 +106,15 @@ def detect_markers(psid, pid): #res = subprocess.run(cmd) # ######################################## - - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # 使用 communicate() 等待进程完成 - stdout, stderr = process.communicate() - # 获取进程的退出码 - exit_code = process.returncode - print(f"Process exited with code: {exit_code}") - print(f"Output: {stdout.decode()}") - print(f"Error: {stderr.decode()}") + process = subprocess.Popen(cmd, shell=True) + # 获取主进程的 PID + pidddd = process.pid + + # 在等待主进程的同时,检查子进程的状态 + while process.poll() is None: + print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 进程 {pidddd} 运行中...') + # 这里可以使用 os.wait() 等待子进程的退出 + time.sleep(2) print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") From 6dcfe5a8fdd67cf1c531b67d6252d6a2cc6dfbf1 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sun, 12 Jan 2025 00:04:54 +0800 Subject: [PATCH 18/23] 1 --- yj_local_build/main_step1.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 3be70ce..926a036 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -109,6 +109,9 @@ def detect_markers(psid, pid): process = subprocess.Popen(cmd, shell=True) # 获取主进程的 PID pidddd = process.pid + + while True: + print("process",process.wait()) # 在等待主进程的同时,检查子进程的状态 while process.poll() is None: From 006eef1d948adcb928b19ecd647cf3df34ae3157 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sun, 12 Jan 2025 00:07:45 +0800 Subject: [PATCH 19/23] 1 --- yj_local_build/main_step1.py | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 926a036..90a8866 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -102,30 +102,7 @@ def detect_markers(psid, pid): -exportReconstructionRegion "{os.path.join(config["workdir"], pid, f"{pid}.rcbox")}" \ {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' print(cmd) - cmd = shlex.split(cmd) - #res = subprocess.run(cmd) - - # ######################################## - process = subprocess.Popen(cmd, shell=True) - # 获取主进程的 PID - pidddd = process.pid - - while True: - print("process",process.wait()) - - # 在等待主进程的同时,检查子进程的状态 - while process.poll() is None: - print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 进程 {pidddd} 运行中...') - # 这里可以使用 os.wait() 等待子进程的退出 - time.sleep(2) - print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - # ######################################## - + cmd = shlex.split(cmd) time.sleep(3) fix_region() print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') From 920399f4a0725f8316a8e4246fc40e97a647d917 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sun, 12 Jan 2025 00:25:49 +0800 Subject: [PATCH 20/23] 1 --- yj_local_build/main_step1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 90a8866..380da85 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -93,9 +93,9 @@ def detect_markers(psid, pid): cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ - -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]}\ - -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ - -align -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" -align -align -selectAllImages \ + -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} \ + -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ + -align -align -align -align -selectAllImages -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.1.5.draft.config.xml" \ -exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ From ee5f0247229174a3ce202fc3769c7a03619c5bb9 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Sun, 12 Jan 2025 00:29:32 +0800 Subject: [PATCH 21/23] 1 --- yj_local_build/main_step1.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 380da85..38920c3 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -103,6 +103,8 @@ def detect_markers(psid, pid): {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' print(cmd) cmd = shlex.split(cmd) + res = subprocess.run(cmd) + print("res",res) time.sleep(3) fix_region() print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') From b36d46e796e28a6d91932b75bbb37e6d3aa39c71 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Tue, 14 Jan 2025 16:04:20 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E8=80=81=E5=BD=B1=E6=A3=9A=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=9D=90=E6=A0=87=E7=94=A8lock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- old_to_new_build/get_reg_info.py | 10 ++++++++-- old_to_new_build/tools_to_xmps.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/old_to_new_build/get_reg_info.py b/old_to_new_build/get_reg_info.py index b934938..7078c6c 100644 --- a/old_to_new_build/get_reg_info.py +++ b/old_to_new_build/get_reg_info.py @@ -56,7 +56,12 @@ def get_photo2_align_info(pid,flagDoXmps=False): libs.down_from_oss(config.oss_bucket, config.workdir, pid) #判断对齐的图片数量和photo2的数量是否一致,不一致要进行通知处理 - photosNums = len(os.listdir(os.path.join(config.workdir, pid, "photo2"))) + #photosNums = len(os.listdir(os.path.join(config.workdir, pid, "photo2"))) + photosNums = 0 + for file in os.listdir(os.path.join(config.workdir, pid, "photo2")): + if file.endswith('.jpg'): + photosNums += 1 + #判断是否存在该目录 print(f"影棚号:{psid} , {config.oss_bucket.object_exists(f'xmps_rate/{psid}/')}") filename = f'xmps_rate/{psid}/{psid}.rcbox' @@ -113,7 +118,7 @@ def get_photo2_align_info(pid,flagDoXmps=False): config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/repeat_build/jpgs/{file}', os.path.join(config.workdir, pid, 'reg', file)) print(f'影棚号:{psid} , PID:{pid},照片数量:{photosNums} 对齐的图片数量:{alignNums}') - if alignNums != photosNums: + if photosNums - alignNums >= 3 and psid != 9: notify(f'影棚号:{psid} , PID:{pid},没有对齐,照片数量:{photosNums} 对齐的图片数量:{alignNums}') #删除文件夹 shutil.rmtree(os.path.join(config.workdir, pid), ignore_errors=True) @@ -121,6 +126,7 @@ def get_photo2_align_info(pid,flagDoXmps=False): #处理完成后塞入到指定的队列 r = create_redis_connection() + print("推入到重建队列") r.rpush('ai:ai_repeat_build',pid) #删除文件夹 diff --git a/old_to_new_build/tools_to_xmps.py b/old_to_new_build/tools_to_xmps.py index 073efcd..770837c 100644 --- a/old_to_new_build/tools_to_xmps.py +++ b/old_to_new_build/tools_to_xmps.py @@ -139,7 +139,7 @@ def create_rate_xmps(pid): #清除图片exif信息, 旋转图片 180度 rateImages(pid) #通过rc 计算出 xmps 文件 - exportxmp = ' -exportXMP "D:\\make2\\config\\exportXMP.config.xml" ' + exportxmp = ' -exportXMP "D:\\make2\\config\\exportXMP.config.lock.xml" ' cmd = f'{config.rcbin} {config.r2["init"]} -setInstanceName {pid} \ -save "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" \ -addFolder "{os.path.join(config.workdir, pid, "photo1")}" -selectAllImages \ From 2de4636cb180e94812d478812d456f4377226bf2 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Thu, 16 Jan 2025 18:35:12 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E4=BA=91=E7=AE=AD=E5=BB=BA=E6=A8=A1?= =?UTF-8?q?=EF=BC=8C=E5=9B=BA=E5=AE=9Arcbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yj_local_build/config.json | 3 +- yj_local_build/detectMarkers15.xml | 7 +++++ yj_local_build/main_step1.py | 45 +++++++++++++++++++++++------- yj_local_build/stand.rcbox | 13 +++++++++ 4 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 yj_local_build/detectMarkers15.xml create mode 100644 yj_local_build/stand.rcbox diff --git a/yj_local_build/config.json b/yj_local_build/config.json index 4423757..537d3fe 100644 --- a/yj_local_build/config.json +++ b/yj_local_build/config.json @@ -12,6 +12,7 @@ }, "r2": { "init": "-disableOnlineCommunication -setProjectCoordinateSystem Local:1 -setOutputCoordinateSystem epsg:4326 -set \"sfmEnableCameraPrior=False\" -set \"sfmMaxFeaturesPerMpx=20000\" -set \"sfmMaxFeaturesPerImage=200000\" -set \"sfmImagesOverlap=High\" -set \"sfmMaxFeatureReprojectionError=1\"", - "setRegion": "-setReconstructionRegionOnCPs 36h11:001 36h11:002 36h11:003 2.1 -moveReconstructionRegion 0 0 -2.1 -rotateReconstructionRegion 180 0 180 -setGroundPlaneFromReconstructionRegion -scaleReconstructionRegion 1.8 1.6 2.1 absolute center -moveReconstructionRegion 0 0 0.0025" + "setRegion": "-setReconstructionRegionOnCPs 36h11:001 36h11:002 36h11:003 2.1 -moveReconstructionRegion 0 0 -2.1 -rotateReconstructionRegion 180 0 180 -setGroundPlaneFromReconstructionRegion -scaleReconstructionRegion 1.8 1.6 2.1 absolute center -moveReconstructionRegion 0 0 0.0025", + "setRegion1": "-moveReconstructionRegion 0 0 -2.1 -rotateReconstructionRegion 180 0 180 -setGroundPlaneFromReconstructionRegion -scaleReconstructionRegion 1.8 1.6 2.1 absolute center -moveReconstructionRegion 0 0 0.0025" } } \ No newline at end of file diff --git a/yj_local_build/detectMarkers15.xml b/yj_local_build/detectMarkers15.xml new file mode 100644 index 0000000..8f436f7 --- /dev/null +++ b/yj_local_build/detectMarkers15.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/yj_local_build/main_step1.py b/yj_local_build/main_step1.py index 38920c3..950fcff 100644 --- a/yj_local_build/main_step1.py +++ b/yj_local_build/main_step1.py @@ -74,13 +74,14 @@ def filter_dark_texture_image(pid): def detect_markers(psid, pid): def fix_region(): #判断是否存在rcbox - region_filename = os.path.join(config["workdir"], pid, f"{pid}.rcbox") + region_filename = os.path.join(config["workdir"], pid, "a.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] + shutil.copyfile(os.path.join(config['workdir'], 'xmps','stand.rcbox'), os.path.join(config['workdir'], pid,f"{pid}.rcbox")) break else: time.sleep(10) @@ -90,21 +91,36 @@ def detect_markers(psid, pid): #获取当前的工作目录 dirCurr = os.getcwd() - + shutil.copyfile(os.path.join(config['workdir'], 'xmps','stand.rcbox'), os.path.join(config['workdir'], pid,f"{pid}.rcbox")) + rcboxfile = os.path.join(config["workdir"], pid, f"{pid}.rcbox") cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ - -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} \ + -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml"\ -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ - -align -align -align -align -selectAllImages -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.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")}" \ + -align -align -align -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" -align\ + -defineDistance 36h11:007 36h11:008 0.21\ + -align -align -update\ + -setReconstructionRegion "{rcboxfile}"\ + -exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml"\ + -exportReconstructionRegion "{os.path.join(config["workdir"], pid, f"a.rcbox")}" \ {textpicCmd} -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -quit' + + #{config["r2"]["setRegion1"]}\ + # cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ + # -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ + # -addFolder "{os.path.join(config["workdir"], pid, "photo1")}" {config["r"]["setTextureFalse"]} \ + # -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" \ + # -align -align -align -align -selectAllImages -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.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' + print(cmd) cmd = shlex.split(cmd) res = subprocess.run(cmd) - print("res",res) + # print("res",res) time.sleep(3) fix_region() print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') @@ -124,13 +140,22 @@ def step1(pid,headsCount): def step2(pid,headsCount): dirCurr = os.getcwd() simplify_value = 1000000 * int(headsCount) + rcboxfile = os.path.join(config["workdir"], pid, f"{pid}.rcbox") + print("rcboxfile",rcboxfile) calulate_type = 'calculateNormalModel' cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ - -load "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ + -load "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" -setReconstructionRegion "{rcboxfile}"\ -{calulate_type} \ -selectLargestModelComponent -invertTrianglesSelection -removeSelectedTriangles -simplify {simplify_value} -smooth -closeHoles -cleanModel -calculateTexture \ -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ -exportSelectedModel "{os.path.join(config["workdir"], pid, "output", f"{pid}.obj")}" "{dirCurr}\\ModelExportParams.xml" -quit' + + # cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ + # -load "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}"\ + # -{calulate_type} \ + # -selectLargestModelComponent -invertTrianglesSelection -removeSelectedTriangles -simplify {simplify_value} -smooth -closeHoles -cleanModel -calculateTexture \ + # -save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ + # -exportSelectedModel "{os.path.join(config["workdir"], pid, "output", f"{pid}.obj")}" "{dirCurr}\\ModelExportParams.xml" -quit' print(cmd) cmd = shlex.split(cmd) res = subprocess.run(cmd) diff --git a/yj_local_build/stand.rcbox b/yj_local_build/stand.rcbox new file mode 100644 index 0000000..0e9b680 --- /dev/null +++ b/yj_local_build/stand.rcbox @@ -0,0 +1,13 @@ + + 0.648424047842557 -0.144304360211365 -14.7060321261486 + 1.79999996618164 1.59999999912862 2.09999990082135 +
+ + -0.00827141292393208 -0.0999293625354767 1.07126533985138 + + + 0.999999982956009 0 0.000184629309238136 -1.97082426349412e-08 0.99999999430276 0.000106744927879323 -0.000184629308186258 -0.000106744929698683 0.999999977258769 + -0.000197899597054034 -0.000119789821979029 0.000951774884015322 + +