9 changed files with 265 additions and 38 deletions
@ -0,0 +1,13 @@ |
|||||||
|
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple |
||||||
|
pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn |
||||||
|
|
||||||
|
python -m pip install --upgrade pip |
||||||
|
pip install oss2 redis pillow numpy opencv-python bpy tqdm pyautogui psutil pywin32 pymysql |
||||||
|
|
||||||
|
|
||||||
|
config |
||||||
|
set bin="C:\Program Files\Capturing Reality\RealityCapture\RealityCapture.exe" |
||||||
|
%bin% -disableOnlineCommunication -setInstanceName %pid% |
||||||
|
%bin% -disableOnlineCommunication -delegateTo %pid% |
||||||
|
%bin% -set "appCacheLocation=ProjectFolder" |
||||||
|
|
||||||
@ -0,0 +1,5 @@ |
|||||||
|
old version |
||||||
|
|
||||||
|
init: |
||||||
|
|
||||||
|
'"C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe" -disableOnlineCommunication -set \"sfmEnableCameraPrior=False\" -set \"sfmMaxFeaturesPerMpx=20000\" -set \"sfmMaxFeaturesPerImage=200000\" -set \"sfmImagesOverlap=High\" -set \"sfmMaxFeatureReprojectionError=1\" -addFolder "D:\\{pid}\\photo1" -addFolder "D:\\{pid}\\photo2" -importControlPointsMeasurements "D:\\{pid}\\{pid}..controlPoints.csv" -align -save' |
||||||
@ -0,0 +1,68 @@ |
|||||||
|
import os, sys, time, shutil, subprocess, shlex, json |
||||||
|
import xml.etree.ElementTree as ET |
||||||
|
import platform |
||||||
|
if platform.system() == 'Windows': |
||||||
|
sys.path.append('e:\\libs\\') |
||||||
|
#sys.path.append('libs') |
||||||
|
else: |
||||||
|
sys.path.append('/data/deploy/make3d/make2/libs/') |
||||||
|
|
||||||
|
import config, libs, libs_db,common |
||||||
|
|
||||||
|
|
||||||
|
def old_step2(pid): |
||||||
|
cmd = f'"C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe" -disableOnlineCommunication -set \"sfmEnableCameraPrior=False\" -set \"sfmMaxFeaturesPerMpx=20000\" -set \"sfmMaxFeaturesPerImage=200000\" -set \"sfmImagesOverlap=High\" -set \"sfmMaxFeatureReprojectionError=1\" -addFolder "D:\\{pid}\\photo1" -addFolder "D:\\{pid}\\photo2" -importControlPointsMeasurements "D:\\{pid}\\{pid}.controlPoints.csv" -align -save "D:\\{pid}\\{pid}.rcproj" -quit' |
||||||
|
|
||||||
|
cmd = shlex.split(cmd) |
||||||
|
res = subprocess.run(cmd) |
||||||
|
time.sleep(2) |
||||||
|
|
||||||
|
#修改rcproj文件 |
||||||
|
flag = common.changeRcprojControlpointsFile(pid) |
||||||
|
if flag == False: |
||||||
|
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} point文件不存在') |
||||||
|
exit() |
||||||
|
|
||||||
|
simplify_value = 1000000 * libs.getHeadCount(pid) |
||||||
|
|
||||||
|
cmd = f'"C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe" -load "D:\\{pid}\\{pid}.rcproj" -set "sfmEnableCameraPrior=True" -align -set "sfmEnableCameraPrior=False" -align -setReconstructionRegion "D:\\{pid}\\{pid}.rcbox" -mvs -modelSelectMaximalConnectedComponent -modelInvertSelection -modelRemoveSelectedTriangles -closeHoles -clean -simplify {simplify_value} -smooth -unwrap -calculateTexture -renameModel {pid} -save "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" -quit' |
||||||
|
|
||||||
|
cmd = shlex.split(cmd) |
||||||
|
res = subprocess.run(cmd) |
||||||
|
|
||||||
|
time.sleep(3) |
||||||
|
#修改rcproj文件 |
||||||
|
flag = common.changeRcprojFile(pid) |
||||||
|
if flag == False: |
||||||
|
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} rcproj文件不存在') |
||||||
|
exit() |
||||||
|
|
||||||
|
#创建指定文件夹 |
||||||
|
if not os.path.exists(os.path.join(config.workdir, pid, "output")): |
||||||
|
os.makedirs(os.path.join(config.workdir, pid, "output")) |
||||||
|
#执行导出 |
||||||
|
cmd = f'{config.rcbin} -load "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}"\ |
||||||
|
-exportModel "{pid}" "{os.path.join(config.workdir, pid, "output", f"{pid}.obj")}" "d:\\make2\\config\\ModelExportParams102.xml" -quit' |
||||||
|
print(cmd) |
||||||
|
cmd = shlex.split(cmd) |
||||||
|
res = subprocess.run(cmd) |
||||||
|
|
||||||
|
#阻塞判断是否导出完成 |
||||||
|
while True: |
||||||
|
#判断 output 目录下是否存在 三个文件 |
||||||
|
files = os.listdir(os.path.join(config.workdir, pid, "output")) |
||||||
|
if len(files) >= 3: |
||||||
|
break |
||||||
|
#暂时 step2 step3 一起连续执行 |
||||||
|
print('step2 执行完,开始执行step3') |
||||||
|
os.system(f'python d:\\make2\\main_step3.py {pid}') |
||||||
|
|
||||||
|
if __name__ == '__main__': |
||||||
|
pid = '0' |
||||||
|
if len(sys.argv) == 1: |
||||||
|
exit() |
||||||
|
else: |
||||||
|
pids = sys.argv[1].split(',') |
||||||
|
for pid in pids: |
||||||
|
old_step2(str(pid)) |
||||||
|
exit() |
||||||
Loading…
Reference in new issue