littlewing

人間とコンピューターとメディアの接点をデザインするために考えたこと

逆引きMeshLab

MeshLabの使い方をすぐ忘れるのでメモ

ウインドウ操作

操作内容 操作方法
レイヤーパネル On/Off Ctrl +L
全画面表示 Alt +Enter
Quick ヘルプの表示 F1

カメラ/視点の操作

操作内容 操作方法
カメラの回転 ドラッグ
カメラの移動 Ctrl+ドラッグ or 中ボタンドラッグ
カメラのズーム Shift+ドラッグorマウスホイール
カメラの中心を移動 ダブルクリック
カメラのリセット Ctrl+H
パースの強弱 Shift+マウスホイール
光源の移動 Ctrl+Shift+ドラッグ
Near Clipの変更 Ctrl+ドラッグ

3Dモデル操作

操作内容 操作方法
モデルのインポート Ctrl +i
個別のモデル(レイヤー)の移動 Filters > [Normals,Curvatures and Orientation] > [Transform : Translate,Center, set Origin]
個別のモデル(レイヤー)の回転 Filters > [Normals,Curvatures and Orientation] > [Transform : Rotate]
個別のモデル(レイヤー)の拡縮 Filters > [Normals,Curvatures and Orientation] > [Transform : Scale,Normalize]

メッシュ編集

Merge(結合)

操作内容 操作方法
Mesh のレイヤーを結合する Layerの上で右クリック > Flatten visible layers

Filter (スキャンデータをきれいにする)

操作内容 操作方法
穴埋め Filters > [Remeshing simpleification and Reconstruction] > [Close Holoes]
Manifoldのエラーが出る場合は事前に、[Cleaning and Repairing] > [Remove faces from Non Manifold Edges]などを実施
孤立したMeshを除去 Filters > Cleaning and Repairing > Remove Isolated Pieces (Diameter)
形状を保ったままメッシュの数を減らす Filters > [Remeshing, Simplification and Reconstruction]-[Simplification: Quadric Edge Collapse Decimation] を実行
詳細1
詳細2
頂点と法線からMeshを生成する Filters > [Remeshing simpleification and Reconstruction] > [Surface Reconstruction : Ball Pivoting]
Scale変更 Filters > [Normals,Curvatures and Orientation] > [Transform : Scale] ※1

※1 ScaleはXの値だけ変えれば倍率が変わる。Measure Tool の単位はUnityでいうと1 Unity( メートル)っぽい。

MeshLabで点群データ処理

位置合わせ

"Global Registration" というのが、MeshLab 2020.07から増えている。openGRを利用しているっぽい。


コマンドラインで利用する

  • ply から daeへ変換
meshlabserver -i input.ply -o output.dae
  • 変換時には含めるデータをオプションで指定可能
meshlabserver -i input.ply -o output.dae -m vc #頂点カラー付きで出力

 [-m <opt>]  the name of the file where to write the current mesh of the MeshLab document.
 If -m is specified  the specified mesh attributes will be saved in the output file. the param <opt> can be a
 space separated list of the following attributes:
     vc -> vertex colors,  vf -> vertex flags,
     vq -> vertex quality, vn-> vertex normals,
     vt -> vertex texture coords,
     fc -> face colors,  ff -> face flags,
     fq -> face quality, fn-> face normals,
     wc -> wedge colors, wn-> wedge normals,
     wt -> wedge texture coords
  • Windowsのバッチで連続して処理する(事前に作成したフィルター処理 filter.mlx をかける)
set PATH=%PATH%;C:\Program Files\VCG\MeshLab

  for %%V in (*.ply) do (
    meshlabserver -i %%V -o %%~nV.obj  -s filter.mlx
  )
  pause
  • コマンドのヘルプ全文
C:\Program Files\VCG\MeshLab>meshlabserver

Usage:
meshlabserver [logargs] [args]
  where logargs can be:
    -d filename             dump on a text file a list of all the
                            filtering functions
    -l filename             log of the filters is ouput on a file
  where args can be:
    -p filename             meshlab project (.mlp) to be loaded
    -w filename [-x]        output meshlab project (.mlp) to be saved.
                            If -x flag is specified a 3D model meshfile.ext
                            contained in the input project will be overwritten,
                            otherwise it will be saved in the same directory of
                            input mesh as a new file called meshfile_out.ext.
                            All the mesh attributes will be exported in the
                            saved files
    -i filename             mesh that has to be loaded
    -o filename [-m <opt>]  the name of the file where to write the current mesh
                            of the MeshLab document.
                            If -m is specified  the specified mesh attributes will
                            be saved in the output file. the param <opt> can be a
                            space separated list of the following attributes:
                                vc -> vertex colors,  vf -> vertex flags,
                                vq -> vertex quality, vn-> vertex normals,
                                vt -> vertex texture coords,
                                fc -> face colors,  ff -> face flags,
                                fq -> face quality, fn-> face normals,
                                wc -> wedge colors, wn-> wedge normals,
                                wt -> wedge texture coords
    -s filename                   the script to be applied

   Examples:

    'meshlabserver -i input.obj -o output.ply -m vc fq wt -s meshclean.mlx'
           the script contained in file 'meshclean.mlx' will be applied to the
           mesh contained into 'input.obj'. The vertex coordinates and the
           per-vertex-color, the per-face-quality and the per-wedge-texture
           attributes will be saved into the output.ply file

    'meshlabserver -i input0.obj -i input1.ply -w outproj.mlp -x -s meshclean.mlx'
           the script file meshclean.mlx will be applied to the document
           composed by input0.obj and input1.ply meshes.
           The mesh input1.ply will become the current mesh of the document
           (e.g. the mesh to which the filters operating on a single model will
           be applied). A new output project outproj.mlp file will be generated
           (containing references to the input0.obj an input1.ply).
           The files input0.obj and input1.ply will be overwritten.

    'meshlabserver -l logfile.txt -p proj.mlp -i input.obj -w outproj.mlp -s meshclean.mlx'
           the mesh file input.obj will be added to the meshes referred by the
           loaded meshlab project file proj.mlp. The mesh input.obj will become
           the current mesh of the document, the script file meshclean.mlx will
           be applied to the meshes contained into the resulting document.
           the project file outproj.mlp will be generated
           A 3D model meshfile.ext contained in the input project proj.mlp will
           be saved in a new file called meshfile_out.ext
           (if you want to overwrite the original files use the -v flag after
           the outproject filename) all the attributes of the meshes will be
           saved into the output files; the log info will be saved into the
           file logfile.txt.

   Notes:
   There can be multiple meshes loaded and the order they are listed matters because
   filters that use meshes as parameters choose the mesh based on the order.
   The format of the output mesh is guessed by the used extension.
   Script is optional and must be in the xml format saved by MeshLab.

参考

【OpenFOAM】点群処理や点群の編集をするには・・MeshLab、Meshmixerなどを使う【3D】

MeshLabのスクリプトについてのメモ: メモブログ

MeshLab

http://keisawada.com/MeshLab/meshlab.html

MeshLab の基本的な操作 - XSim

Meshlab スクリプトによるメッシュフィルター操作を自動化する方法