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 + +