Browse Source

云箭建模,固定rcbox

master
dongchangxi 11 months ago
parent
commit
2de4636cb1
  1. 3
      yj_local_build/config.json
  2. 7
      yj_local_build/detectMarkers15.xml
  3. 45
      yj_local_build/main_step1.py
  4. 13
      yj_local_build/stand.rcbox

3
yj_local_build/config.json

@ -12,6 +12,7 @@
}, },
"r2": { "r2": {
"init": "-disableOnlineCommunication -setProjectCoordinateSystem Local:1 -setOutputCoordinateSystem epsg:4326 -set \"sfmEnableCameraPrior=False\" -set \"sfmMaxFeaturesPerMpx=20000\" -set \"sfmMaxFeaturesPerImage=200000\" -set \"sfmImagesOverlap=High\" -set \"sfmMaxFeatureReprojectionError=1\"", "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"
} }
} }

7
yj_local_build/detectMarkers15.xml

@ -0,0 +1,7 @@
<Configuration id="{8D21413B-0848-49A9-BF6E-8EBCCA356BC7}">
<entry key="minMarkerMeasurements" value="0x1"/>
<entry key="generateMarkersPaperSize" value="0"/>
<entry key="generateMarkersMarkersPerPage" value="0x4"/>
<entry key="generateMarkersCount" value="0x4"/>
<entry key="detectMarkersClass" value="{FBE54CA7-788B-4E0A-BA41-F3464E51A008}"/>
</Configuration>

45
yj_local_build/main_step1.py

@ -74,13 +74,14 @@ def filter_dark_texture_image(pid):
def detect_markers(psid, pid): def detect_markers(psid, pid):
def fix_region(): def fix_region():
#判断是否存在rcbox #判断是否存在rcbox
region_filename = os.path.join(config["workdir"], pid, f"{pid}.rcbox") region_filename = os.path.join(config["workdir"], pid, "a.rcbox")
while True: while True:
if os.path.exists(region_filename): if os.path.exists(region_filename):
print("region_filename",region_filename) print("region_filename",region_filename)
with open(region_filename, 'r') as f: with open(region_filename, 'r') as f:
lines = f.readlines() 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] 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 break
else: else:
time.sleep(10) time.sleep(10)
@ -90,21 +91,36 @@ def detect_markers(psid, pid):
#获取当前的工作目录 #获取当前的工作目录
dirCurr = os.getcwd() 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} \ cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \
-save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ -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" \ -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" \ -align -align -align -align -detectMarkers "{dirCurr}\detectMarkers_1.5.config.xml" -align\
-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"]} \ -defineDistance 36h11:007 36h11:008 0.21\
-exportXMP "{dirCurr}\exportXMP.1.5.draft.config.xml" \ -align -align -update\
-exportControlPointsMeasurements "{os.path.join(config["workdir"], pid, f"{pid}.controlPoints.csv")}" "{dirCurr}\exportControlPoints.config.xml" \ -setReconstructionRegion "{rcboxfile}"\
-exportReconstructionRegion "{os.path.join(config["workdir"], pid, f"{pid}.rcbox")}" \ -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' {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) print(cmd)
cmd = shlex.split(cmd) cmd = shlex.split(cmd)
res = subprocess.run(cmd) res = subprocess.run(cmd)
print("res",res) # print("res",res)
time.sleep(3) time.sleep(3)
fix_region() fix_region()
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点检测完成, 共费时{diff_time(start_time)}') 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): def step2(pid,headsCount):
dirCurr = os.getcwd() dirCurr = os.getcwd()
simplify_value = 1000000 * int(headsCount) simplify_value = 1000000 * int(headsCount)
rcboxfile = os.path.join(config["workdir"], pid, f"{pid}.rcbox")
print("rcboxfile",rcboxfile)
calulate_type = 'calculateNormalModel' calulate_type = 'calculateNormalModel'
cmd = f'{config["rcbin"]} {config["r2"]["init"]} -setInstanceName {pid} \ 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} \ -{calulate_type} \
-selectLargestModelComponent -invertTrianglesSelection -removeSelectedTriangles -simplify {simplify_value} -smooth -closeHoles -cleanModel -calculateTexture \ -selectLargestModelComponent -invertTrianglesSelection -removeSelectedTriangles -simplify {simplify_value} -smooth -closeHoles -cleanModel -calculateTexture \
-save "{os.path.join(config["workdir"], pid, f"{pid}.rcproj")}" \ -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' -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) print(cmd)
cmd = shlex.split(cmd) cmd = shlex.split(cmd)
res = subprocess.run(cmd) res = subprocess.run(cmd)

13
yj_local_build/stand.rcbox

@ -0,0 +1,13 @@
<ReconstructionRegion globalCoordinateSystem="NONE" globalCoordinateSystemWkt="NONE" globalCoordinateSystemName="NONE"
isGeoreferenced="0" isLatLon="0">
<yawPitchRoll>0.648424047842557 -0.144304360211365 -14.7060321261486</yawPitchRoll>
<widthHeightDepth>1.79999996618164 1.59999999912862 2.09999990082135</widthHeightDepth>
<Header magic="5395016" version="2"/>
<CentreEuclid>
<centre>-0.00827141292393208 -0.0999293625354767 1.07126533985138</centre>
</CentreEuclid>
<Residual s="1.01996424140646" ownerId="{1890CBE9-7922-4474-AE3C-8C9939F0B523}">
<R>0.999999982956009 0 0.000184629309238136 -1.97082426349412e-08 0.99999999430276 0.000106744927879323 -0.000184629308186258 -0.000106744929698683 0.999999977258769</R>
<t>-0.000197899597054034 -0.000119789821979029 0.000951774884015322</t>
</Residual>
</ReconstructionRegion>
Loading…
Cancel
Save