All Projects → pyvista → Pymeshfix

pyvista / Pymeshfix

Licence: gpl-3.0
Python Wrapper for MeshFix: easily repair holes in PyVista surface meshes

Projects that are alternatives of or similar to Pymeshfix

3d Machine Learning
A resource repository for 3D machine learning
Stars: ✭ 7,405 (+9773.33%)
Mutual labels:  3d, 3d-reconstruction, mesh
Pixel2meshplusplus
Pixel2Mesh++: Multi-View 3D Mesh Generation via Deformation. In ICCV2019.
Stars: ✭ 188 (+150.67%)
Mutual labels:  3d, 3d-reconstruction, mesh
Meshlab
The open source mesh processing system
Stars: ✭ 2,619 (+3392%)
Mutual labels:  3d, 3d-reconstruction, mesh
Nerf pl
NeRF (Neural Radiance Fields) and NeRF in the Wild using pytorch-lightning
Stars: ✭ 362 (+382.67%)
Mutual labels:  3d-reconstruction, mesh
Point2Mesh
Meshing Point Clouds with Predicted Intrinsic-Extrinsic Ratio Guidance (ECCV2020)
Stars: ✭ 61 (-18.67%)
Mutual labels:  mesh, 3d-reconstruction
SkeletonBridgeRecon
The code for CVPR2019 Oral paper "A Skeleton-bridged Deep Learning Approach for Generating Meshes of Complex Topologies from Single RGB Images"
Stars: ✭ 72 (-4%)
Mutual labels:  mesh, 3d-reconstruction
Tf flame
Tensorflow framework for the FLAME 3D head model. The code demonstrates how to sample 3D heads from the model, fit the model to 2D or 3D keypoints, and how to generate textured head meshes from Images.
Stars: ✭ 193 (+157.33%)
Mutual labels:  3d, 3d-reconstruction
Tsdf Fusion
Fuse multiple depth frames into a TSDF voxel volume.
Stars: ✭ 426 (+468%)
Mutual labels:  3d, 3d-reconstruction
Curated List Of Awesome 3d Morphable Model Software And Data
The idea of this list is to collect shared data and algorithms around 3D Morphable Models. You are invited to contribute to this list by adding a pull request. The original list arised from the Dagstuhl seminar on 3D Morphable Models https://www.dagstuhl.de/19102 in March 2019.
Stars: ✭ 375 (+400%)
Mutual labels:  3d, 3d-reconstruction
Tsdf Fusion Python
Python code to fuse multiple RGB-D images into a TSDF voxel volume.
Stars: ✭ 464 (+518.67%)
Mutual labels:  3d, 3d-reconstruction
Pyvista
3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)
Stars: ✭ 734 (+878.67%)
Mutual labels:  3d, mesh
Vedo
A python module for scientific analysis of 3D objects based on VTK and numpy
Stars: ✭ 741 (+888%)
Mutual labels:  3d, mesh
findpeaks
The detection of peaks and valleys in a 1d-vector or 2d-array (image)
Stars: ✭ 121 (+61.33%)
Mutual labels:  mesh, 3d-reconstruction
Genre Shapehd
Code and Data Release for GenRe (NeurIPS 2018) and ShapeHD (ECCV 2018)
Stars: ✭ 241 (+221.33%)
Mutual labels:  3d, 3d-reconstruction
Intrinsic3d
Intrinsic3D - High-Quality 3D Reconstruction by Joint Appearance and Geometry Optimization with Spatially-Varying Lighting (ICCV 2017)
Stars: ✭ 297 (+296%)
Mutual labels:  3d, 3d-reconstruction
Delatin
A fast JavaScript terrain mesh generation tool based on Delaunay triangulation
Stars: ✭ 207 (+176%)
Mutual labels:  3d, mesh
Hmm
Heightmap meshing utility.
Stars: ✭ 403 (+437.33%)
Mutual labels:  3d, mesh
Meshcnn
Convolutional Neural Network for 3D meshes in PyTorch
Stars: ✭ 1,032 (+1276%)
Mutual labels:  3d, mesh
Dicomtomesh
A command line tool to transform a DICOM volume into a 3d surface mesh (obj, stl or ply). Several mesh processing routines can be enabled, such as mesh reduction, smoothing or cleaning. Works on Linux, OSX and Windows.
Stars: ✭ 191 (+154.67%)
Mutual labels:  3d, mesh
Sdf
Simple SDF mesh generation in Python
Stars: ✭ 683 (+810.67%)
Mutual labels:  3d, mesh

PyMeshFix

.. |azure| image:: https://dev.azure.com/pyvista/PyVista/_apis/build/status/pyvista.pymeshfix?branchName=master :target: https://dev.azure.com/pyvista/PyVista/_build?definitionId=5

.. |pypi| image:: https://img.shields.io/pypi/v/pymeshfix.svg?logo=python&logoColor=white :target: https://pypi.org/project/pymeshfix/

Python/Cython wrapper of Marco Attene's wonderful, award-winning MeshFix <https://github.com/MarcoAttene/MeshFix-V2.1>__ software. This module brings the speed of C++ with the portability and ease of installation of Python.

This software takes as input a polygon mesh and produces a copy of the input where all the occurrences of a specific set of "defects" are corrected. MeshFix has been designed to correct typical flaws present in raw digitized mesh models, thus it might fail or produce coarse results if run on other sorts of input meshes (e.g. tessellated CAD models).

The input is assumed to represent a single closed solid object, thus the output will be a single watertight triangle mesh bounding a polyhedron. All the singularities, self-intersections and degenerate elements are removed from the input, while regions of the surface without defects are left unmodified.

C++ source last updated 1 Jul 2020

Installation

From PyPI <https://pypi.python.org/pypi/pymeshfix>__

.. code:: bash

pip install pymeshfix

From source at GitHub <https://github.com/pyvista/pymeshfix>__

.. code:: bash

git clone https://github.com/pyvista/pymeshfix
cd pymeshfix
pip install .

Dependencies

Requires numpy and pyvista

If you can't or don't want to install vtk, you can install it without pyvista with:

.. code:: bash

pip install pymeshfix --no-dependencies

You'll miss out on some of the cool features from pyvista, but it will still function.

Examples

Test installation with the following from Python:

.. code:: python

from pymeshfix import examples

# Test of pymeshfix without VTK module
examples.native()

# Performs same mesh repair while leveraging VTK's plotting/mesh loading
examples.with_vtk()

Easy Example

This example uses the Cython wrapper directly. No bells or whistles here:

.. code:: python

from pymeshfix import _meshfix

# Read mesh from infile and output cleaned mesh to outfile
_meshfix.clean_from_file(infile, outfile)

This example assumes the user has vertex and faces arrays in Python.

.. code:: python

from pymeshfix import _meshfix

# Generate vertex and face arrays of cleaned mesh
# where v and f are numpy arrays or python lists
vclean, fclean = _meshfix.clean_from_arrays(v, f)

Complete Examples with and without VTK

One of the main reasons to bring MeshFix to Python is to allow the library to communicate to other python programs without having to use the hard drive. Therefore, this example assumes that you have a mesh within memory and wish to repair it using MeshFix.

.. code:: python

import pymeshfix

# Create object from vertex and face arrays
meshfix = pymeshfix.MeshFix(v, f)

# Plot input
meshfix.plot()

# Repair input mesh
meshfix.repair()

# Access the repaired mesh with vtk
mesh = meshfix.mesh

# Or, access the resulting arrays directly from the object
meshfix.v # numpy np.float array
meshfix.f # numpy np.int32 array

# View the repaired mesh (requires vtkInterface)
meshfix.plot()

# Save the mesh
meshfix.write('out.ply')

Alternatively, the user could use the Cython wrapper of MeshFix directly if vtk is unavailable or they wish to have more control over the cleaning algorithm.

.. code:: python

from pymeshfix import _meshfix

# Create TMesh object
tin = _meshfix.PyTMesh()

tin.LoadFile(infile)
# tin.load_array(v, f) # or read arrays from memory

# Attempt to join nearby components
# tin.join_closest_components()

# Fill holes
tin.fill_small_boundaries()
print('There are {:d} boundaries'.format(tin.boundaries())

# Clean (removes self intersections)
tin.clean(max_iters=10, inner_loops=3)

# Check mesh for holes again
print('There are {:d} boundaries'.format(tin.boundaries())

# Clean again if necessary...

# Output mesh
tin.save_file(outfile)

 # or return numpy arrays
vclean, fclean = tin.return_arrays()

Algorithm and Citation Policy

To better understand how the algorithm works, please refer to the following paper:

M. Attene. A lightweight approach to repairing digitized polygon meshes.
The Visual Computer, 2010. (c) Springer. DOI: 10.1007/s00371-010-0416-3

This software is based on ideas published therein. If you use MeshFix for research purposes you should cite the above paper in your published results. MeshFix cannot be used for commercial purposes without a proper licensing contract.

Copyright

MeshFix is Copyright(C) 2010: IMATI-GE / CNR

All rights reserved.

This program is dual-licensed as follows:

(1) You may use MeshFix as free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

In this case the program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (http://www.gnu.org/licenses/gpl.txt) for more details.

(2) You may use MeshFix as part of a commercial software. In this case a proper agreement must be reached with the Authors and with IMATI-GE/CNR based on a proper licensing contract.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].