Browse Source

云箭建模1.5rc

master
dongchangxi 12 months ago
parent
commit
19bd30acfb
  1. 6
      yj_local_build/config.json
  2. 7
      yj_local_build/detectMarkers_1.5.config.xml
  3. 8
      yj_local_build/exportXMP.1.5.draft.config.xml
  4. 8
      yj_local_build/exportXMP.1.5.lock.config.xml
  5. 53
      yj_local_build/main_step1.py

6
yj_local_build/config.json

@ -1,8 +1,8 @@
{ {
"workdir": "D://", "workdir": "D://",
"local_need_build": "/\\172.31.1.253/modeling/local_need_build", "local_need_build": "D://local_need_build",
"local_complate_build":"/\\172.31.1.253/modeling/local_complate_build", "local_complate_build":"D://local_complate_build",
"rcbin": "'C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe'", "rcbin": "'C:\\Program Files\\Epic Games\\RealityCapture_1.5\\AppProxy.exe'",
"urls": { "urls": {
"update_status_modelsuccess_url": "http://172.16.20.13:8383/update_take_photo" "update_status_modelsuccess_url": "http://172.16.20.13:8383/update_take_photo"
}, },

7
yj_local_build/detectMarkers_1.5.config.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>

8
yj_local_build/exportXMP.1.5.draft.config.xml

@ -0,0 +1,8 @@
<Configuration id="{EC40D990-B2AF-42A4-9637-1208A0FD1322}">
<entry key="xmpMerge" value="true"/>
<entry key="xmpExGps" value="true"/>
<entry key="xmpFlags" value="true"/>
<entry key="xmpCalibGroups" value="true"/>
<entry key="xmpCamera" value="1"/>
<entry key="xmpRig" value="true"/>
</Configuration>

8
yj_local_build/exportXMP.1.5.lock.config.xml

@ -0,0 +1,8 @@
<Configuration id="{EC40D990-B2AF-42A4-9637-1208A0FD1322}">
<entry key="xmpMerge" value="true"/>
<entry key="xmpExGps" value="true"/>
<entry key="xmpFlags" value="true"/>
<entry key="xmpCalibGroups" value="true"/>
<entry key="xmpCamera" value="3"/>
<entry key="xmpRig" value="true"/>
</Configuration>

53
yj_local_build/main_step1.py

@ -73,11 +73,18 @@ def filter_dark_texture_image(pid):
def detect_markers(psid, pid): def detect_markers(psid, pid):
def fix_region(): def fix_region():
region_filename = os.path.join(config['workdir'], pid, f'{pid}.rcbox') #判断是否存在rcbox
with open(region_filename, 'r') as f: region_filename = os.path.join(config["workdir"], pid, f"{pid}.rcbox")
lines = f.readlines() while True:
lines = [line.replace('"NONE" globalCoordinateSystemWkt="NONE" globalCoordinateSystemName="NONE"', '"+proj=geocent +ellps=WGS84 +no_defs" globalCoordinateSystemName="local:1 - Euclidean"') for line in lines] 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() start_time = time.time()
textpicCmd ='-selectImage "'+os.path.join(config['workdir'],pid,'photo2')+'\*" -enableTexturingAndColoring true' 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")}" \ -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"]} -align -addFolder "{os.path.join(config["workdir"], pid, "photo2")}" \
-align -selectAllImages \ -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"]} \ -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" \ -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"{pid}.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'
@ -126,18 +133,27 @@ def step2(pid,headsCount):
print(cmd) print(cmd)
cmd = shlex.split(cmd) cmd = shlex.split(cmd)
res = subprocess.run(cmd) res = subprocess.run(cmd)
print("res",res)
#阻塞判断是否导出完成 #阻塞判断是否导出完成
while True: while True:
#判断 output 目录下是否存在 三个文件 try:
files = os.listdir(os.path.join(config['workdir'], pid, "output")) #判断 output 目录下是否存在 三个文件
if len(files) >= 3: files = os.listdir(os.path.join(config['workdir'], pid, "output"))
break if len(files) >= 3:
time.sleep(5)
break
except Exception as e:
time.sleep(5)
continue
#将导出的文件移动到指定目录 #将导出的文件移动到指定目录
sourceDir = config["local_complate_build"] sourceDir = config["local_complate_build"]
#判断目录是否存在,不存在就创建 #判断目录是否存在,不存在就创建
if not os.path.exists(sourceDir): if os.path.exists(os.path.join(sourceDir,pid)):
os.makedirs(sourceDir) #删除
os.removedirs(os.path.join(sourceDir,pid))
os.makedirs(os.path.join(sourceDir,pid))
#将 output 目录里的文件移动到指定目录 #将 output 目录里的文件移动到指定目录
shutil.move(os.path.join(config['workdir'], pid, "output"),os.path.join(sourceDir,pid)) 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): def main(pid,headsCount):
step1(pid, headsCount) step1(pid, headsCount)
if __name__ == '__main__': if __name__ == '__main__':
# step1("235558",1)
# exit()
try: try:
url = config['urls']['update_status_modelsuccess_url'] url = config['urls']['update_status_modelsuccess_url']
if url == "": if url == "":
@ -191,13 +209,15 @@ if __name__ == '__main__':
try: try:
while True: while True:
time.sleep(5) 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): for pid in os.listdir(needBuildDir):
print("pid=",pid)
if not os.path.isdir(os.path.join(needBuildDir,pid)): if not os.path.isdir(os.path.join(needBuildDir,pid)):
continue continue
#判断是否存在 canDo.txt 文件,如果不存在就跳过 #判断是否存在 canDo.txt 文件,如果不存在就跳过
if not os.path.exists(os.path.join(needBuildDir,pid,"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 continue
#读取 canDo.txt 文件内容 #读取 canDo.txt 文件内容
@ -208,6 +228,7 @@ if __name__ == '__main__':
#判断文件夹里是否存在 do.txt , 如果存在就跳过,不存在就创建 #判断文件夹里是否存在 do.txt , 如果存在就跳过,不存在就创建
if os.path.exists(os.path.join(needBuildDir,pid,"do.txt")): if os.path.exists(os.path.join(needBuildDir,pid,"do.txt")):
print("存在 do.txt 。则跳过处理")
continue continue
else: else:
with open(os.path.join(needBuildDir,pid,"do.txt"),"w") as f: with open(os.path.join(needBuildDir,pid,"do.txt"),"w") as f:

Loading…
Cancel
Save