MeshLab+Python常用處理

1. 模型格式轉(zhuǎn)換

modelnameoutputname里面修改后綴名即可钞啸,相當(dāng)于【另存為+格式轉(zhuǎn)換+重命名】

def meshlab_resave(modelname, outputname):
    modelname = Path(modelname)
    meshlabserver = "D:\\MeshLab\\meshlabserver.exe"
    cmd = meshlabserver + " -i " + str(modelname) + " -o " + str(outputname) +" -m vc vn" 
    #vc, vn 分別表示保存點(diǎn)的顏色和法向
    print(cmd)
    os.system(cmd)

2. 運(yùn)行腳本

def meshlab_wscript(modelname, outputname):
    modelname = Path(modelname)
    meshlabserver = "D:\\MeshLab\\meshlabserver.exe"
    scriptname = " -s meshlab_script.mlx"
    cmd = meshlabserver + " -i " + str(modelname) + " -o " + outputname +" -m vc vn"  + scriptname
    print(cmd)
    os.system(cmd)

2.1泊松融合 meshlab_poisson.mlx

<!DOCTYPE FilterScript>
<FilterScript>
 <xmlfilter name="Screened Poisson Surface Reconstruction">
  <xmlparam value="0" name="cgDepth"/>
  <xmlparam value="false" name="confidence"/>
  <xmlparam value="8" name="depth"/>
  <xmlparam value="5" name="fullDepth"/>
  <xmlparam value="8" name="iters"/>
  <xmlparam value="4" name="pointWeight"/>
  <xmlparam value="false" name="preClean"/>
  <xmlparam value="1.5" name="samplesPerNode"/>
  <xmlparam value="1.1" name="scale"/>
  <xmlparam value="false" name="visibleLayer"/>
 </xmlfilter>
 <filter name="Delete Current Mesh"/>
</FilterScript>

2.2 刪除重復(fù)點(diǎn) meshlab_removedup.mlx

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Remove Duplicate Vertices"/>
</FilterScript>

2.3 加密點(diǎn)云meshlab_dense.mlx

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Subdivision Surfaces: Butterfly Subdivision">
  <Param value="3" name="Iterations" type="RichInt" description="Iterations" tooltip="Number of time the model is subdivided."/>
  <Param min="0" value="0.32162" name="Threshold" type="RichAbsPerc" description="Edge Threshold" max="32.1624" tooltip="All the edges &lt;b>longer&lt;/b> than this threshold will be refined.&lt;br>Setting this value to zero will force an uniform refinement."/>
  <Param value="false" name="Selected" type="RichBool" description="Affect only selected faces" tooltip="If selected the filter affect only the selected faces"/>
 </filter>
</FilterScript>

2.4 簡(jiǎn)化模型meshlab_simple.mlx

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Simplification: Quadric Edge Collapse Decimation">
  <Param description="Target number of faces" value="30000" type="RichInt" tooltip="The desired final number of faces." name="TargetFaceNum"/>
  <Param description="Percentage reduction (0..1)" value="0" type="RichFloat" tooltip="If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size." name="TargetPerc"/>
  <Param description="Quality threshold" value="0.3" type="RichFloat" tooltip="Quality threshold for penalizing bad shaped faces.&lt;br>The value is in the range [0..1]&#xa; 0 accept any kind of face (no penalties),&#xa; 0.5  penalize faces with quality &lt; 0.5, proportionally to their shape&#xa;" name="QualityThr"/>
  <Param description="Preserve Boundary of the mesh" value="false" type="RichBool" tooltip="The simplification process tries to do not affect mesh boundaries during simplification" name="PreserveBoundary"/>
  <Param description="Boundary Preserving Weight" value="1" type="RichFloat" tooltip="The importance of the boundary during simplification. Default (1.0) means that the boundary has the same importance of the rest. Values greater than 1.0 raise boundary importance and has the effect of removing less vertices on the border. Admitted range of values (0,+inf). " name="BoundaryWeight"/>
  <Param description="Preserve Normal" value="false" type="RichBool" tooltip="Try to avoid face flipping effects and try to preserve the original orientation of the surface" name="PreserveNormal"/>
  <Param description="Preserve Topology" value="false" type="RichBool" tooltip="Avoid all the collapses that should cause a topology change in the mesh (like closing holes, squeezing handles, etc). If checked the genus of the mesh should stay unchanged." name="PreserveTopology"/>
  <Param description="Optimal position of simplified vertices" value="true" type="RichBool" tooltip="Each collapsed vertex is placed in the position minimizing the quadric error.&#xa; It can fail (creating bad spikes) in case of very flat areas. &#xa;If disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. " name="OptimalPlacement"/>
  <Param description="Planar Simplification" value="false" type="RichBool" tooltip="Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh." name="PlanarQuadric"/>
  <Param description="Weighted Simplification" value="false" type="RichBool" tooltip="Use the Per-Vertex quality as a weighting factor for the simplification. The weight is used as a error amplification value, so a vertex with a high quality value will not be simplified and a portion of the mesh with low quality values will be aggressively simplified." name="QualityWeight"/>
  <Param description="Post-simplification cleaning" value="true" type="RichBool" tooltip="After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)" name="AutoClean"/>
  <Param description="Simplify only selected faces" value="false" type="RichBool" tooltip="The simplification is applied only to the selected set of faces.&#xa; Take care of the target number of faces!" name="Selected"/>
 </filter>
</FilterScript>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末琼梆,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌碰煌,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,122評(píng)論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異验夯,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)摔刁,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,070評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門挥转,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人共屈,你說我怎么就攤上這事扁位。” “怎么了趁俊?”我有些...
    開封第一講書人閱讀 164,491評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵域仇,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我寺擂,道長(zhǎng)暇务,這世上最難降的妖魔是什么泼掠? 我笑而不...
    開封第一講書人閱讀 58,636評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮垦细,結(jié)果婚禮上择镇,老公的妹妹穿的比我還像新娘。我一直安慰自己括改,他們只是感情好腻豌,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,676評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著嘱能,像睡著了一般吝梅。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上惹骂,一...
    開封第一講書人閱讀 51,541評(píng)論 1 305
  • 那天苏携,我揣著相機(jī)與錄音,去河邊找鬼对粪。 笑死右冻,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的著拭。 我是一名探鬼主播纱扭,決...
    沈念sama閱讀 40,292評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼儡遮!你這毒婦竟也來了乳蛾?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,211評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤峦萎,失蹤者是張志新(化名)和其女友劉穎屡久,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體爱榔,經(jīng)...
    沈念sama閱讀 45,655評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡被环,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,846評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了详幽。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片筛欢。...
    茶點(diǎn)故事閱讀 39,965評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖唇聘,靈堂內(nèi)的尸體忽然破棺而出版姑,到底是詐尸還是另有隱情,我是刑警寧澤迟郎,帶...
    沈念sama閱讀 35,684評(píng)論 5 347
  • 正文 年R本政府宣布剥险,位于F島的核電站,受9級(jí)特大地震影響宪肖,放射性物質(zhì)發(fā)生泄漏表制。R本人自食惡果不足惜健爬,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,295評(píng)論 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望么介。 院中可真熱鬧娜遵,春花似錦、人聲如沸壤短。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,894評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽久脯。三九已至纳胧,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間桶现,已是汗流浹背躲雅。 一陣腳步聲響...
    開封第一講書人閱讀 33,012評(píng)論 1 269
  • 我被黑心中介騙來泰國(guó)打工鼎姊, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留骡和,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,126評(píng)論 3 370
  • 正文 我出身青樓相寇,卻偏偏與公主長(zhǎng)得像慰于,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子唤衫,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,914評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • 機(jī)器學(xué)習(xí)術(shù)語表 本術(shù)語表中列出了一般的機(jī)器學(xué)習(xí)術(shù)語和 TensorFlow 專用術(shù)語的定義婆赠。 A A/B 測(cè)試 (...
    yalesaleng閱讀 1,966評(píng)論 0 11
  • 晴,27℃佳励。 今天沒下雨休里,太陽終于上班,媽媽還把紅瓜子洗了拿到陽臺(tái)上曬赃承。曬一天還不夠干妙黍,天氣預(yù)報(bào)說明天不下雨是多云...
    公子菠閱讀 645評(píng)論 0 0
  • 利息高反駁話術(shù): 1.優(yōu)勢(shì)對(duì)比:放款速度快 節(jié)省時(shí)間 短期周轉(zhuǎn) 用三個(gè)月或者半年提前結(jié)清沒有違約金,如果你用兩年或...
    耿小冬閱讀 2,362評(píng)論 0 1
  • 遇見最好的自己 以前覺得女生就要有自己的白馬王子瞧剖,及時(shí)沒有也要有幻想的雛形拭嫁。可惜年輕的時(shí)候我沒有抓于!后來我結(jié)婚了做粤,婚...
    異鄉(xiāng)素人閱讀 123評(píng)論 0 0
  • 愛的反語 有一條路通向南方 你說不喜歡 我轉(zhuǎn)身向北 候鳥歸巢 松子油冰凍的清冽 湛...
    兔子小姐的怪獸口袋閱讀 332評(píng)論 0 0