Comments (10)
There is small example here
https://github.com/MeshInspector/MeshLib/blob/master/examples/cmake-example/main.cpp
and some usage code can be found here
https://github.com/MeshInspector/MeshLib/tree/master/source/MRCommonPlugins
https://github.com/MeshInspector/MeshLib/blob/master/source/MRMesh/MRSurroundingContour.h
https://github.com/MeshInspector/MeshLib/blob/master/source/MRMesh/MRFillContourByGraphCut.h
also please find documentation here
from meshlib.
https://meshinspector.com/MeshLib/doc/group__MeshSegmentationGroup.html this link should be helpful
from meshlib.
Hello!
What kind of segmentation do you need? Can you please show visual example?
from meshlib.
Hey,
as I saw in the readme you mentioned two segmentation methods (Semi-auto voxel segmentation, Semi-auto mesh segmentation by curvature.) I am not sure how can I apply both of them to the mesh.
I got this example from "Link" so I want something like this.
from meshlib.
Thanks for the image: you can have a look at https://github.com/MeshInspector/MeshLib/blob/master/test_python/test_segmentation.py for example of mesh segmentation, you need to specify source and sink faces for it,
also please you can try this functions:
from meshlib import mrmeshpy as mm
help(mm.surroundingContour)
help(mm.fillContourLeftByGraphCut)
the idea here is to pick 2 or 3 vertices (tincludeEdges
, vertices in the origins are used) and create contour connecting them, and then separate inside and outside parts of the contour
from meshlib.
Hey @Grantim,
thank you very much! I was trying to test the segmentation but I think that I did something wrong or didn't understand it correctly.
I followed the same code snippets from your `test_segmentation.py'. And I used it as following:
from helper import *
import shutil
from meshlib import mrmeshpy as mrmesh
mesh = mrmesh.makeTorus()
mrmesh.saveMesh(mesh, mrmeshpy.Path("mesh_original.stl"))
metric = mrmesh.edgeLengthMetric(mesh)
source = mrmesh.FaceBitSet()
sink = mrmesh.FaceBitSet()
# For mesh segmentation, one has to specify source and sink faces for it.
source.resize(mesh.topology.getValidFaces().size(),False)
sink.resize(mesh.topology.getValidFaces().size(),False)
source.set(mrmesh.FaceId(0),True)
sink.set(mrmesh.FaceId(5),True)
res = mrmesh.segmentByGraphCut(mesh.topology,source,sink,metric)
The res
object is an FaceBitSet
, I am still not sure how can I save the segmented mesh.
from meshlib.
Hello!
You can do so
from helper import *
import shutil
from meshlib import mrmeshpy as mrmesh
mesh = mrmesh.makeTorus()
mrmesh.saveMesh(mesh, mrmeshpy.Path("mesh_original.stl"))
metric = mrmesh.edgeLengthMetric(mesh)
source = mrmesh.FaceBitSet()
sink = mrmesh.FaceBitSet()
# For mesh segmentation, one has to specify source and sink faces for it.
source.resize(mesh.topology.getValidFaces().size(),False)
sink.resize(mesh.topology.getValidFaces().size(),False)
source.set(mrmesh.FaceId(0),True)
sink.set(mrmesh.FaceId(5),True)
res = mrmesh.segmentByGraphCut(mesh.topology,source,sink,metric)
bitSetToRemove = mesh.topology.getValidFaces() - res
mesh.topology.deleteFaces( bitSetToRemove )
mesh.pack()
mrmesh.saveMesh(mesh, mrmeshpy.Path("mesh_segmented.stl"))
from meshlib.
The idea is we segment out the faces and then remove them from the original mesh, so that we can store the segmented part only. Is there any way to save all segmented faces in other mesh file? And do you have examples for surroundingContour
and fillContourLeftByGraphCut
? I didn't find any documentation regarding segmentation.
Best,
from meshlib.
I have edited code sample here hope it will help you. We have more options to copy segmented part in c++ code, but it is not exposed to python yet, we will add it later! About surroundingContour
and fillContourLeftByGraphCut
unfortunately we dont have examples.
You can find some description with help(mrmesh.surroundingContour)
and help(mrmesh.fillContourLeftByGraphCut)
Basicaly:
surroundingContour
finds best closed edge loop in terms of provided metric
fillContourLeftByGraphCut
fills left part of the edge loop minimizing tonnels with provided metric.
from meshlib.
thank you very much! with C++ will work much better in my use case, as I'm trying to segment meshes completely using C++ in the first place. Is there any snippiest example for the C++ versions? basically my goal is to segment everything inside the mesh. same as here. Thank you very much for your support!
from meshlib.
Related Issues (20)
- MeshToVolume in Python HOT 6
- Expose RelaxKeepVolume HOT 5
- VSCode Autocompletion of `.so` files HOT 6
- line self-intersection HOT 2
- Local setup HOT 5
- Error while showing numpad keys in F1 menu
- Negative offsetting in offsetMesh HOT 1
- Negative offset in thickenMesh results in incorrect filling of mesh HOT 3
- Readme installation steps are incorrect for Linux HOT 4
- Installation on Linux when sudo privileges are not available HOT 1
- Python Meshlib DistanceMap Interpolation Issue HOT 2
- meshlib.mrmeshpy.uniteCloseVertices does not exist in Python HOT 4
- Plane cut HOT 2
- Minkowski Sum in python HOT 2
- Problems in refine in cylinder mesh HOT 1
- add possibility to support rectangular planes
- setup z scale as ( ScaleX + ScaleY ) / 2 for plane feature HOT 1
- Creating grid meshes based on arbitrary shape input HOT 29
- Create a 3D Mesh from a list of vertices and faces. HOT 3
- Hole & Boundary edge length in Python HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meshlib.