|
|
|
|
@ -74,13 +74,14 @@ def filter_dark_texture_image(pid):
@@ -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):
@@ -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" \ |
|
|
|
|
-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"{pid}.rcbox")}" \ |
|
|
|
|
-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):
@@ -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) |
|
|
|
|
|