Im2mesh (2D image to finite element mesh)

バージョン 2.2.0 (14.5 MB) 作成者: Jiexian Ma
Generate finite element mesh based on 2D multi-phase image, with polyline and smoothing and simplification features.
ダウンロード: 1.3K
更新 2025/2/15
GUI version of Im2mesh is now available: Im2mesh_GUI (https://www.mathworks.com/matlabcentral/fileexchange/179684-im2mesh_gui-2d-image-to-finite-element-mesh). Please check the tutorial of Im2mesh_GUI.
Im2mesh is a MATLAB/Octave package for generating finite element mesh based on 2D segmented multi-phase image. It provides a robust workflow capable of processing various input images, such as microstructure images of engineering materials. Due to its generalized framework, Im2mesh can handle segmented image with more than 10 phases.
News
  • Version 2.2.0 can use Gmsh as mesh generator (unstructured quad mesh) !
  • Version 2.1.6 updates the DOI. Im2mesh is now citable!
  • Version 2.1.5 fixes bugs for quadratic elements.
  • Version 2.1.0 is a huge update. Im2mesh package can run on GNU Octave.
Features
  • Accurately preserve the contact details between different phases.
  • Incorporates polyline smoothing and simplification
  • Able to avoid sharp corners when simplifying polylines.
  • Support phase selection before meshing.
  • 3 mesh generators are available for selection: MESH2D, and generateMesh, and Gmsh
  • Generated mesh can be exported as inp file (Abaqus) and bdf file (Nastran bulk data, compatible with COMSOL). Mesh can be exported as many formats via Gmsh, such as STL.
  • Graphical user interface (GUI) version is available as a MATLAB app.
How to start
After downloading Im2mesh, I suggest you start with "Im2mesh_GUI app" in the folder, which will help you understand the workflow and parameters of Im2mesh. A detailed tutorial is provided in "Im2mesh_GUI Tutorial.pdf".
Then, you can learn to use Im2mesh package in the folder "Im2mesh_Matlab" or "Im2mesh_Octave". 13 examples are provided. If you're using MATLAB , examples are live script mlx files (demo1.mlx ~ demo13.mlx). If you're using Octave, examples are m files (demo1.m ~ demo10.m). Examples are also available as html files in the folder "demo_html".
Examples
  • demo01 - Demonstrate function im2mesh, which use MESH2D as mesh generator.
  • demo02 - Demonstrate function im2meshBuiltIn, which use MATLAB built-in function generateMesh as mesh generator.
  • demo03 - Demonstrate how to export mesh as inp, bdf, and node/ele file
  • demo04 - Demonstrate what is inside function im2mesh.
  • demo05 - Demonstrate parameter tf_avoid_sharp_corner
  • demo06 - Demonstrate thresholds in polyline smoothing
  • demo07 - Demonstrate parameter grad_limit for mesh generation
  • demo08 - Demonstrate parameter hmax for mesh generation
  • demo09 - Demonstrate how to select phases for meshing
  • demo10 - Demonstrate different polyline smoothing techniques
  • demo11 - Demonstrate how to find node sets at the interface and boundary
  • demo12 - Demonstrate function pixelMesh (pixel-based quadrilateral mesh)
  • demo13 - Demonstrate how to use Gmsh as mesh generator
Notes
  • Im2mesh program identifies different phases in a image by their grayscales. Different grayscales correspond to different phases. If you have 4 level of grayscales in a image, the resulted meshes will contain 4 phases.
  • You need to do pre-processing to your image before you put the image into Im2mesh program. For example, convert to 8-bit grayscale image, noise removal, and image segmentation (e.g., Otsu's method). What Im2mesh needs is a segmented grayscale image. For those fellows who don't have any experience in digital image processing, please refer to the following information: https://www.mathworks.com/matlabcentral/fileexchange/71772-im2mesh-2d-image-to-finite-element-mesh?tab=discussions#discussions_1692673
If you have any questions or suggestions, feel free to send me an email.
mjx0799@gmail.com, Jan 2025.
Acknowledgments
Great thanks Dr. Yang Lu providing valuable advice on this tool.

引用

Ma, J., & Li, Y. (2025). Im2mesh: A MATLAB/Octave package for generating finite element mesh based on 2D multi-phase image (2.1.5). Zenodo. https://doi.org/10.5281/zenodo.14847059

MATLAB リリースの互換性
作成: R2021b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersConvert Image Type についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Im2mesh_Matlab

Im2mesh_Matlab/mesh2d-master

Im2mesh_Matlab/mesh2d-master/aabb-tree

Im2mesh_Matlab/mesh2d-master/geom-util

Im2mesh_Matlab/mesh2d-master/hfun-util

Im2mesh_Matlab/mesh2d-master/hjac-util

Im2mesh_Matlab/mesh2d-master/mesh-ball

Im2mesh_Matlab/mesh2d-master/mesh-cost

Im2mesh_Matlab/mesh2d-master/mesh-file

Im2mesh_Matlab/mesh2d-master/mesh-util

Im2mesh_Matlab/mesh2d-master/poly-test

Im2mesh_Matlab/printGeo

Im2mesh_Matlab/test_script

Im2mesh_Octave

Im2mesh_Octave/mesh2d-master

Im2mesh_Octave/mesh2d-master/aabb-tree

Im2mesh_Octave/mesh2d-master/geom-util

Im2mesh_Octave/mesh2d-master/hfun-util

Im2mesh_Octave/mesh2d-master/hjac-util

Im2mesh_Octave/mesh2d-master/mesh-ball

Im2mesh_Octave/mesh2d-master/mesh-cost

Im2mesh_Octave/mesh2d-master/mesh-file

Im2mesh_Octave/mesh2d-master/mesh-util

Im2mesh_Octave/mesh2d-master/poly-test

バージョン 公開済み リリース ノート
2.2.0

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.2.0

2.1.9

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.9

2.1.8

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.8

2.1.6

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.6

2.1.5

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.5

2.1.1

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.1

2.1.0

See release notes for this release on GitHub: https://github.com/mjx888/im2mesh/releases/tag/2.1.0

1.88

Update Description

1.87

Update Description

1.86

add note

1.85

Add comments & description

1.84

Revise Description

1.83

Revise summary

1.82

Update description

1.81

Update description

1.80

Add im2meshBuiltIn.m, poly2meshBuiltIn.m
Update examples

1.76

improve getCtrlPnts
faster

1.75

Add new parameter 'select_phase'

1.71

Revise description

1.7

Add two new parameters for mesh generation

1.6

make im2Bounds() more readable using getExactBounds()

1.5

improve im2Bounds.m and getCtrlPnts.m
significantly faster

1.1.1

update description

1.1

revise demo(), add examples
add several functions, like printInp_multiPart(), printInp_multiSect(), printBdf()

0.9

Improve time efficiency of getCtrlPnts(). Faster. Add new parameter - tf_avoid_sharp_corner. Able to avoid non-convergence when meshing.
Rewrite getNodeEle(). Using global numbering.
Revise printInp(). Add new parameter - precision_nodecoor.

0.8.2

new image for cover

0.8.1

revise getCtrlPnts() for time efficiency

0.8.0

debug
revise printInp(), support linear element and quadratic element
revise im2Bounds() and bwperimtrace(), for 4-connected neighbourhood
able to clear up redundant vertices that are brought about by delZeroAreaPoly

0.7.0

debug
reorganize part of the code, increase readability
revise some comments
add calculation of polygon's area, polygon with zero area will be deleted automatically
update examples

0.6.2

update description

0.6.1

update description

0.6.0

この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。
この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。