cnr-isti-vclab / pymeshlab Goto Github PK
View Code? Open in Web Editor NEWThe open source mesh processing python library
License: GNU General Public License v3.0
The open source mesh processing python library
License: GNU General Public License v3.0
Thanks for resolving #54 , but now after applying 'parameterization__texturing_from_registered_rasters', output texture file is either all black or erroneous + very dark.
The first two files are the output of pymeshlab and the third is the correct file when the standalone meshlab is used.
The code I'm using is smth like this:
ms = ml.MeshSet()
ms.load_new_mesh('stairs_dense.0.ply')
ms.load_new_raster('1.jpg')
ms.load_new_raster('2.jpg')
ms.load_new_raster('3.jpg')
ms.load_new_raster('4.jpg')
ms.load_new_raster('5.jpg')
ms.load_new_raster('6.jpg')
ms.apply_filter('import_cameras_for_active_rasters_from_file', importfile = 'cameras.out')
ms.apply_filter('compute_normals_for_point_sets')
ms.apply_filter('surface_reconstruction_screened_poisson')
ms.apply_filter('parameterization__texturing_from_registered_rasters', texturesize = 1024, texturename = 'test.png')
Hi, I found that .fbx file import and export is asymmetric. Now i want to export .fbx file by add an export plugin for MeshLab, could you please give me some hints? And what should I pay attention to when dealing with uv and uv2 about .fbx? https://github.com/cnr-isti-vclab/PyMeshLab/issues/98#issuecomment-824503589Thanks!
Hi, currently, I am trying to "translate" the steps in MeshLab to PyMeshLab. My codes are:
import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh('xxxx.ply')
ms.apply_filter('point_cloud_simplification',samplenum=10000)
ms.apply_filter('compute_normals_for_point_sets')
ms.apply_filter('surface_reconstruction_ball_pivoting')
ms.apply_filter('parametrization_trivial_per_triangle',textdim=2048)
All the above codes work well.
Then, in MeshLab, the SAVE method is File---Save Project As....
I think, in PyMeshLab, it may be
ms.save_current_mesh('third.obj')
However, when I finish the saving method, I run:
ms.apply_filter('transfer_vertex_color_to_texture', textname='104-1.png')
The feedback is
---------------------------------------------------------------------------
PyMeshLabException Traceback (most recent call last)
<ipython-input-19-a7f980b148b7> in <module>
----> 1 ms.apply_filter('transfer_vertex_color_to_texture', textname='104-1.png')
PyMeshLabException: Failed to apply filter: transfer_vertex_color_to_texture
Details: Save the mesh before creating a texture
In fact, I have saved the texture successfully in MeshLab, however, when I finish the last step to transfer to the PyMeshLab, I meet the above error and cannot fix it by myself.
Thanks for the great project you give and look forward to your reply.
Hi
I am using version: PyMeshLab 0.1.9 based on MeshLab 2020.12d
When I try to apply the filter "select_small_disconnected_component" it sometimes seg faults on my Linux box (Opensuse 15.2).
The filter does not crash in the GUI. It also runs fine on my Macbook using the same version of PyMeshLab.
I can provide an example model.
Cheers
Ed
hi,
py meshlab crashes when applying Texture Map Defragmentation to sample mesh via pymeshlab
to reproduce:
use pymeshlab like this...
ms.load_filter_script("TexDefrag.mlx")
ms.apply_filter_script()
on sample mesh, pymeshlab crashes without an error-message, simply quits...
verbose on in python :--- > error message:
LOG: 2 Defragmenting atlas... [ 20% ]
LOG: 2 Packing new atlas... [ 70% ]
QObject::connect: Cannot connect (nullptr)::destroyed(QObject*) to QOffscreenSurface::screenDestroyed(QObject*)
after installing through
pip3 install git+https://github.com/cnr-isti-vclab/PyMeshLab
it successfully installed as shown:
Collecting git+https://github.com/cnr-isti-vclab/PyMeshLab
Cloning https://github.com/cnr-isti-vclab/PyMeshLab to c:\users\mutiargob\appdata\local\temp\pip-req-build-m2q5hdi7
Requirement already satisfied: numpy in c:\users\mutiargob\anaconda3\lib\site-packages (from pymeshlab==0.1.7) (1.19.2)
Building wheels for collected packages: pymeshlab
Building wheel for pymeshlab (setup.py) ... done
Created wheel for pymeshlab: filename=pymeshlab-0.1.7-cp38-cp38-win_amd64.whl size=28179766 sha256=84af19fa76c051e10d072246e0ac132723e9f9263b0d8b108ed8a64e08319da2
Stored in directory: C:\Users\mutiargob\AppData\Local\Temp\pip-ephem-wheel-cache-koxwy2vs\wheels\74\72\3e\dde001df05a3c88b2bdbad8c37cb1b791906c5a4f991b0ae2e
Successfully built pymeshlab
Installing collected packages: pymeshlab
Successfully installed pymeshlab-0.1.7
however when try to import
import pymeshlab
it prompts this error
Traceback (most recent call last):
File "C:\Users\mutiargob\untitled0.py", line 8, in <module>
import pymeshlab
File "C:\Users\mutiargob\Anaconda3\lib\site-packages\pymeshlab\__init__.py", line 1, in <module>
from .pmeshlab import *
ImportError: DLL load failed while importing pmeshlab: The specified procedure could not be found.
did I do something wrong?
This feature is available when exporting a mesh in matlab but not in pymeshlab. But that's missing here.
Running PyMeshLab on Windows Subsystem for Linux. Had some initial problems with dependencies (see here #41 (comment)) but now successfully installed and passes all 18 pytests.
However I am running into some troubles with the ambient occlusion filter with one of the testing meshes (cow.obj) that throws a segfault
PyMeshLab 0.1.7 based on MeshLab 2020.12d
>>> ms = ml.MeshSet()
>>> ms.load_new_mesh('cow.obj')
>>> ms.apply_filter('ambient_occlusion')
----------AngleRad 0.523599 Angledeg 30.000000 ratio 0.066987 vn 128 vn2 1910
asked 1910 got 1910 (expecting 127 instead of 128)
Segmentation fault (core dumped)
Are there any more dependencies that this filter relies upon that I may be missing?
Thanks!
Hi, it's not so much of an issue but more of a question.
I couldn't find a forum dedicated to pymeshlab, so I posted this here. Forgive me if it's not the right place.
I wanted to know if there was an ongoing work for a basic snapshot possibility in pymeshlab ?
I read some people were using that filter : "gpu_filter_example_" in meshlabserver
But I couldn't find or make anything work to get the snapshot going.
I keep getting the following error:
AttributeError: module 'pymeshlab' has no attribute 'MeshSet'
get this when running the pytest as well as the following:
import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh('keystone.stl')
ms.save_current_mesh('keystone.obj')
Source code generating warnings
ms = pymeshlab.MeshSet()
ms.print_filter_parameter_list('surface_reconstruction_screened_poisson')
ms.apply_filter('noisy_isosurface', visiblelayer=False, depth=8, fulldepth=5,
cgdepth = 0, scale = 1.1, samplespernode = 1.5, pointweight = 4,
iters = 8, confidence = False, preclean = True)
ms.load_mesh("myFile.ply")
ms.save_mesh("myFile.obj")
Here is the output from the code:
surface_reconstruction_screened_poisson filter - list of parameter names:
visiblelayer : bool = false
depth : int = 8
fulldepth : int = 5
cgdepth : int = 0
scale : float = 1.1
samplespernode : float = 1.5
pointweight : float = 4
iters : int = 8
confidence : bool = false
preclean : bool = false
[MARCHING CUBES] Building mesh...Warning: parameter visiblelayer not found
Warning: parameter depth not found
Warning: parameter fulldepth not found
Warning: parameter cgdepth not found
Warning: parameter scale not found
Warning: parameter samplespernode not found
Warning: parameter pointweight not found
Warning: parameter iters not found
Warning: parameter confidence not found
Warning: parameter preclean not found
Process finished with exit code 0
I want to use the same filter for a lot of .obj files and now that meshlabserver.exe was replaced I installed python (so I'm still really new to it).
When I call pip3 install pymeshlab
in cmd (which was started as admin), it just throws two errors:
ERROR: Could not find a version that satisfies the requirement pymeshlab
ERROR: No matching distribution found for pymeshlab
I also downloaded the whl file but when I cd to the folder it's in, then call pip install pymeshlab-0.1.9-cp39-cp39-win_amd64.whl
, I only get this error:
pymeshlab-0.1.9-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.
Do I have to download anything else or cd to a specific folder to make pip3 install pymeshlab
work?
I'm using Win 10 with python version 3.9.1 (python --version
works) - both the 32bit and the 64bit version show up in PATH
.
SO: Windows 10
Pyymeshlab version: 0.1.9
Hello @alemuntoni !
First of all, thank you so much for this binding!! It's awesome use Meshlab with Python π
So, sadly I've got a similar problem reported by @KeithT in issue #28. I'm using pymeshlab: 0.1.9
installed with pip.
To reproduce that, follow the steps below:
point-cloud.ply
with a Point Cloud vertices. You should see a model like the picture below:RESULT: You will see a 3D model with faces like the picture below:
meshlabserver.exe
meshlabserver.exe -i point-cloud.ply -o ./terrain.ply -m vc vn -s filter-script.mlx
RESULT: You will see a 3D model like the picture above
pymeshlab
.mlx
scriptimport pymeshlab
meshset = pymeshlab.MeshSet()
meshset.load_new_mesh('list-vertex.ply')
meshset.load_filter_script('filter-script.mlx')
meshset.apply_filter_script()
meshset.save_current_mesh('files/complex_terrain/terrain.ply', save_vertex_color=True, save_vertex_normal=True, save_face_color=True, binary=False) # I tried with `binary=True` too, but the exported .ply is the same
apply_filter
methodsmeshset.apply_filter('point_cloud_simplification', samplenum=1000000, radius=radius_percentage, bestsampleflag=True, bestsamplepool=10, exactnumflag=False)
meshset.apply_filter('compute_normals_for_point_sets', k=10, smoothiter=0, flipflag=False, viewpos=point)
meshset.apply_filter('surface_reconstruction_screened_poisson', visiblelayer=False, fulldepth=5, depth=8, cgdepth=0, scale=1.0, samplespernode=1.5, pointweight=4, iters=8, confidence=False, preclean=False)
meshset.apply_filter('delete_current_mesh')
RESULT: The exported .ply
not contains any faces like the picture below:
I think that the Surface Reconstruction: Screened Poisson filter wasn't applyied. But, this happens only using pymeshlab
Can you help me? The files .ply
and .mlx
are in attached .zip file
Thanks a lot for your attention
I run the example code (test_save_filter_script.py), but got an error
Error details: Bad vertex index in face
I use MacOS, btw.
Python 3.6.9
Hello! Lately we have acquired a Jetson Xavier preinstalled with Ubuntu 18.04 and tried to install pymeshlab.
We tried to install it as in the instruction stated with pip, and tried to download the wheel file.
We are always encoutering the error:
ERROR: No matching distribution found for pymeshlab
Is it possible that we can't install pymeshlab on an ARM architecture?
python 3.7.6
pymeshlab 0.1.8
filter: compute_normals_for_point_sets
reproduce code:
ms = ml.MeshSet()
ms.load_new_mesh('longdress_vox10_1051.ply')
ms.apply_filter('compute_normals_for_point_sets', k=30)
ms.save_current_mesh('longdress_vox10_1051_normal.ply')
Attached is the model I used.
longdress_vox10_1051.zip
The process is done perfectly in MeshLab (GUI).
I have also tried to save the filter script and load it into python code, but still failed.
When manually creating a Mesh
with normals I get now thid error dump in v0.2 but not in v0.18.5:
PyMeshLab 0.2 based on MeshLab 2020.12d
using cached file: /tmp/bunny.obj
(2503, 3) (2503, 3)
Traceback (most recent call last):
File "examples/other/pymeshlab1.py", line 18, in <module>
print("Can convert back to pymeshlab.MeshSet:\n\t", vedo_mesh.to_meshlab())
File "/home/musy/dolfx/vedo/vedo/pointcloud.py", line 3240, in to_meshlab
return utils.vedo2meshlab(self)
File "/home/musy/dolfx/vedo/vedo/utils.py", line 1554, in vedo2meshlab
v_normals_matrix=vmesh.normals(cells=False, compute=False),
pymeshlab.pmeshlab.PyMeshLabException: Error while creating mesh: the number of vertex normals is different from the number of vertices.
where indeed the number is the same.
Also has MeshLab.print_filter_parameter_list()
changed name?
Hi there,
Is there a way to see the time progression of the computation, when applying a filter? For example something similar to the meshlab GUI version (the % bar bottom right of the screen) or the python tqdm package?
In my specific case I am using the filter uniform_mesh_resampling.
Thanks in advance!
giulio
Hi,
After printing the filter list it seems that the "surface_reconstruction_screened_poisson" filter is not available to apply on meshes despite being listed on the readthedocs webpage. Is there any chance this filter could be re-added?
Thanks
Is it possible that print_filter_list is not available as MeshSet method in 0.2.0 (is working in my 0.1.9 install)?
Also filter_parameter_values seems available but causes a crash at each instance (again working fine if I work with 0.1.9)?
I attach a screenshot of ipython shell
thanks in advance
Giulio
I applied the same filter with default parameters both using pymeshlab (python script) and Meshlab, obtaining different results.
Resulting meshes had different number of vertices and triangulation. I also tried different parameters configuration but I can't obtain the same result.
Sketchfab plugin does not correctly link to Qt5Qml.dll when loaded from pymeshlab, therefore the filter is missing.
Saving a mesh both with and without color to the idtf
format results in the same file. Specifically,
ms.save_current_mesh('my_mesh.idtf')
and
ms.save_current_mesh('my_mesh.idtf', save_vertex_color=True)
result identical idtf
files. The save_vertex_color
parameter taken from the docs and the idtf
files were compared with the Unix diff
utility.
This behavior is in contrast to that of Meshlab
where selecting Color
in the Vert
list while exporting a mesh as idtf
results in a file with actual color information.
I get non deterministic segfaults after repeatedly creating several MeshSets and loading STL meshes. I do something similiar to:
import pymeshlab
def load_meshes_and_calc_distance(path0, path1):
ms = pymeshlab.MeshSet()
ms.load_new_mesh(path0)
ms.load_new_mesh(path1)
return ms.hausdorff_distance()
for path0, path1 in get_mesh_paths():
load_meshes_and_calc_distance(path0, path1)
After about 98 iterations I get a segfault. I don't run out of memory or anything else tho. The files exist and are valid stls. If i change the order of the loaded meshes, the mesh in question loads just fine and the code crashes when loading a different mesh.
Here is the rather uninformative stacktrace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7c910c1 in __GI__IO_fread (buf=0x7fffffffb047, size=1, count=80, fp=0x0) at iofread.c:37
37 iofread.c: No such file or directory.
(gdb) bt
#0 0x00007ffff7c910c1 in __GI__IO_fread (buf=0x7fffffffb047, size=1, count=80, fp=0x0) at iofread.c:37
#1 0x00007fffe9bca28b in vcg::tri::io::ImporterSTL<CMeshO>::IsSTLColored(char const*, bool&, bool&) ()
from /home/aurel/.local/lib/python3.9/site-packages/pymeshlab/lib/plugins/libio_base.so
#2 0x00007fffe9bc59a9 in BaseMeshIOPlugin::open(QString const&, QString const&, MeshModel&, int&, RichParameterList const&, bool (*)(int, char const*), QWidget*) ()
from /home/aurel/.local/lib/python3.9/site-packages/pymeshlab/lib/plugins/libio_base.so
#3 0x00007ffff72c3f05 in ?? () from /home/aurel/.local/lib/python3.9/site-packages/pymeshlab/pmeshlab.cpython-39-x86_64-linux-gnu.so
#4 0x00007ffff72c04d6 in ?? () from /home/aurel/.local/lib/python3.9/site-packages/pymeshlab/pmeshlab.cpython-39-x86_64-linux-gnu.so
#5 0x00007ffff72cb587 in ?? () from /home/aurel/.local/lib/python3.9/site-packages/pymeshlab/pmeshlab.cpython-39-x86_64-linux-gnu.so
#6 0x00007ffff72aa7bc in ?? () from /home/aurel/.local/lib/python3.9/site-packages/pymeshlab/pmeshlab.cpython-39-x86_64-linux-gnu.so
#7 0x000000000053f350 in ?? ()
#8 0x000000000051d89b in _PyObject_MakeTpCall ()
#9 0x000000000053bf25 in ?? ()
#10 0x0000000000516e76 in _PyEval_EvalFrameDefault ()
#11 0x0000000000528b63 in _PyFunction_Vectorcall ()
#12 0x0000000000512192 in _PyEval_EvalFrameDefault ()
#13 0x0000000000528b63 in _PyFunction_Vectorcall ()
#14 0x0000000000512192 in _PyEval_EvalFrameDefault ()
#15 0x0000000000528b63 in _PyFunction_Vectorcall ()
#16 0x0000000000512192 in _PyEval_EvalFrameDefault ()
#17 0x0000000000528b63 in _PyFunction_Vectorcall ()
#18 0x0000000000511fb5 in _PyEval_EvalFrameDefault ()
#19 0x00000000005106ed in ?? ()
#20 0x0000000000510497 in _PyEval_EvalCodeWithName ()
#21 0x00000000005f5be3 in PyEval_EvalCode ()
#22 0x0000000000619de7 in ?? ()
#23 0x0000000000615610 in ?? ()
#24 0x0000000000619d79 in ?? ()
#25 0x0000000000619816 in PyRun_SimpleFileExFlags ()
#26 0x000000000060d4e3 in Py_RunMain ()
#27 0x00000000005ea6e9 in Py_BytesMain ()
#28 0x00007ffff7c42d0a in __libc_start_main (main=0x5ea6b0, argc=5, argv=0x7fffffffe1a8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe198)
at ../csu/libc-start.c:308
#29 0x00000000005ea5ea in _start ()
I would like to union a mesh, but i got a runtime error instead.
My example code:
import pymeshlab as ml
ms=ml.MeshSet()
ms.load_new_mesh('test.stl')
ms.apply_filter('transform_rotate',rotaxis=0,rotcenter=0,angle=33)
ms2=ml.MeshSet();
ms2.load_new_mesh('test.stl')
ms2.apply_filter('csg_operation',firstmesh=ms,secondmesh=ms2,operator=1)
ms2.save_current_mesh('union.stl')
When saving a file in binary ply format, it can't be read by meshlab: given error is "bad vertex index in face".
I`m interested in getting the values of quality histogram. How can I get this values? Or it will be possible in the next version of pymeshlab? All the other filters work well
mesh_set.apply_filter('distance_from_reference_mesh', measuremesh = 1, refmesh = 0, signeddist = False)
mesh_set.apply_filter('colorize_by_vertex_quality')
mesh_set.apply_filter('vertex_color_invert')
mesh_set.apply_filter('per_vertex_quality_histogram')
Thank you very much for PyMeshLab!
I have a question about mesh representation. Is there any possibility to get mesh attributes like triangle area per face?
I found only whole surface area attribute.
I have a simple script that just tries to load an STL and save it as X3d.
import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh('teapot.stl')
ms.save_current_mesh('teapot.x3d')
It crashes when I run it
% python pymesh-test.py
PyMeshLab 0.1.6 based on MeshLab 2020.09d
QWidget: Must construct a QApplication before a QWidget
zsh: abort python pymesh-test.py
This happens both on Mac OS X and Linux.
Am I doing something wrong? Thanks.
I'm trying to apply a filter script generated in MeshLab2020.12 but it crashes with:
PyMeshLab 0.2 based on MeshLab 2020.12d
Traceback (most recent call last):
File "convert.py", line 11, in <module>
ms.apply_filter_script()
pymeshlab.pmeshlab.PyMeshLabException: Failed to apply filter: remeshing_isotropic_explicit_remeshing
Details: Missing Component
My script just loops over some files and applies a filter script:
import pymeshlab
import os
for fname in os.listdir('../'):
if not fname.endswith('.stl'):
continue
ms = pymeshlab.MeshSet()
ms.load_new_mesh(f'../{fname}')
ms.load_filter_script('remesh_simplify.mlx')
ms.apply_filter_script()
new_name = fname[:-4] + '_rs.ply'
ms.save_current_mesh(new_name)
and the corresponding filter script looks like:
<!DOCTYPE FilterScript>
<FilterScript>
<filter name="Remeshing: Isotropic Explicit Remeshing">
<Param tooltip="Number of iterations of the remeshing operations to repeat on the mesh." value="3" type="RichInt" description="Iterations" name="Iterations"/>
<Param tooltip="Toggles adaptive isotropic remeshing." value="true" type="RichBool" description="Adaptive remeshing" name="Adaptive"/>
<Param tooltip="If checked the remeshing operations will be applied only to the selected faces." value="false" type="RichBool" description="Remesh only selected faces" name="SelectedOnly"/>
<Param tooltip="Sets the target length for the remeshed mesh edges." value="0.48958" max="48.9576" type="RichAbsPerc" description="Target Length" name="TargetLen" min="0"/>
<Param tooltip="Minimum angle between faces of the original to consider the shared edge as a feature to be preserved." value="30" type="RichFloat" description="Crease Angle" name="FeatureDeg"/>
<Param tooltip="If toggled each local operation must deviate from original mesh by [Max. surface distance]" value="true" type="RichBool" description="Check Surface Distance" name="CheckSurfDist"/>
<Param tooltip="Maximal surface deviation allowed for each local operation" value="0.48958" max="48.9576" type="RichAbsPerc" description="Max. Surface Distance" name="MaxSurfDist" min="0"/>
<Param tooltip="If checked the remeshing operations will include a refine step." value="true" type="RichBool" description="Refine Step" name="SplitFlag"/>
<Param tooltip="If checked the remeshing operations will include a collapse step." value="true" type="RichBool" description="Collapse Step" name="CollapseFlag"/>
<Param tooltip="If checked the remeshing operations will include a edge-swap step, aimed at improving the vertex valence of the resulting mesh." value="true" type="RichBool" description="Edge-Swap Step" name="SwapFlag"/>
<Param tooltip="If checked the remeshing operations will include a smoothing step, aimed at relaxing the vertex positions in a Laplacian sense." value="true" type="RichBool" description="Smooth Step" name="SmoothFlag"/>
<Param tooltip="If checked the remeshing operations will include a step to reproject the mesh vertices on the original surface." value="true" type="RichBool" description="Reproject Step" name="ReprojectFlag"/>
</filter>
</FilterScript>
I am using the GitHub release version of pymeshlab 0.2 for Python 3.7 on Ubuntu 18.04. MeshLab version to generate the filter script:
EDIT: I tried pymeshlab-0.2-1-cp37-cp37m-manylinux1_x86_64.whl
from pip but it crashes with the same error
Hi,
May I ask if there is a way to use PyMeshLab to interact with the meshes that are loaded in the MeshLab GUI?
So far I have only discovered load_project() and save_project(), but didn't find a way to interface with a MeshLab GUI application that is running. I am curious because I want to use the Align Tool in the GUI application before executing PyMeshlab scripts.
I am mainly looking for a way to visualize the meshes loaded from PyMeshlab.
Thanks,
Joshua
The steps in MeshLab:
File->Import Test0001.asc
Filters->Normals, Curv....->Compuete normals for points sets (with default settings)
Filters ->Remeshing..->Surface Reconstruction Screen Poisson (with default settings)
File - Export Mesh Test0001.ply
Generates a .ply without issues.
Doing the same from PyMeshLab by saving the filter script and then running the following python code generates a .ply that can't be opened. Meshlab reports. "Bad vertex index in face"
ms = ml.MeshSet()
ms.set_versbosity(True)
ms.load_new_mesh(filename)
ms.load_filter_script('D:\MeshLab\PointsToMesh.mlx')
ms.apply_filter_script()
tempMeshName = filename[-12:]
newMeshName = tempMeshName[0:8]
newPath = path + newMeshName + '.ply'
ms.save_current_mesh(newPath)
.asc and .mlx in attached .zip
(It's great to be able to access meshlab from python, thank you for this π₯
Hi, i find your meshLab is very powerful. And now i have three question.
Firstly, I load a .fbx model which includes UV coordinates. I want to get uv in numpy array. Code like this:
but it seems can not work well.
What should i do?
About model's normals after simplification. Code like this:
the result is:
The normals of the edge of the model seem not right.
The last one, if model includes uv and uv2, how can i get uv coords numpy array and uv2 coords numpy array respectively. Thank you!
The attachment is a fbx model:
hasSubModel.zip
Hi,
I have a problem with surface_reconstruction_screened_poisson filter on windows 10.
When I run:
ms.print_filter_list()
surface_reconstruction_screened_poisson filter exist on list:
subdivision_surfaces_midpoint surface_reconstruction_ball_pivoting **surface_reconstruction_screened_poisson** surface_reconstruction_vcg taubin_smooth
,
but when i run:
ms.print_filter_parameter_list('surface_reconstruction_screened_poisson')
I get response:
Filter surface_reconstruction_screened_poisson not found.
When I use this filter in Meshlab, I will get the expected result:
but when I run script with this same parameters:
ms.apply_filter('surface_reconstruction_screened_poisson', cgdepth = 0, confidence = False, depth = 8, fulldepth = 5, iters = 8, pointweight = 4, preclean = True, samplespernode = 1.5, scale = 1.1, visiblelayer = False)
I get response:
Depth[0/0]: Evaluated / Got / Solved in: 0.000 / 0.000 / 0.000 (89.043 MB) Nodes: 1
and I get empty mesh, which after saving have 1Kb size.
My plugins:
MeshSet class - list of loaded plugins (48):
FilterAmbientOcclusion
FilterCamera
FilterClean
FilterColorProjection
FilterColorProc
FilterCreate
FilterCreateIso
FilterCSG
FilterDirt
FilterFractal
FilterFunc
FilterGeodesic
FilterImagePatchParametrization
FilterIsoParametrization
FilterLayer
FilterMeasure
FilterMeshing
FilterMLS
FilterMutualGlobal
FilterMutualInfo
FilterPlyMC
FilterQHull
FilterQuality
FilterSample
FilterSampleDyn
FilterSampleGPU
FilterSampling
FilterScreenedPoisson
FilterSDFGPU
FlterSelect
FilterSSynth
FilterTexture
FilterTriOptimize
FilterUnsharp
FilterVoronoi
FilterGlobalRegistration
IO3DS
IOBase
IOBRE
IOCollada
IOCTM
IOExpe
IOJson
IOPDB
IOTRI
IOTXT
IOU3D
IOX3D
Python 3.6.9
PyMeshLab 0.2 based on MeshLab 2020.12d
Error: Segmentation fault (core dumped)
Reproduce Code:
import pymeshlab as pml
ms = pml.MeshSet()
mesh = ms.load_new_mesh("./mesh.obj")
ms.set_current_mesh(0)
ms.per_vertex_texture_function()
Mesh Properties:
I have MeshLab 2020.12 installed and the per_vertex_texture_function filter works on the GUI for the same .obj file.
I am sure that the segmentation fault occurs when per_vertex_texture_function filter is executed.
I am guessing that this is due to the file being too large or something?
Is there a way to increase the maximum memory size usable by pymeshlab in order to avoid this error?
already setup the xorg server running
pymeshlab.pmeshlab.PyMeshLabException: Failed to apply filter: ambient_occlusion
Details: Fatal error: glContext not initialized
Hello! I am having a go at getting PyMeshLab installed on Windows Subsystem for Linux
python3 -m pip install git+https://github.com/cnr-isti-vclab/PyMeshLab
Collecting git+https://github.com/cnr-isti-vclab/PyMeshLab
Cloning https://github.com/cnr-isti-vclab/PyMeshLab to /tmp/pip-req-build-0rtmh9ms
Requirement already satisfied: numpy in ./miniconda3/lib/python3.7/site-packages (from pymeshlab==0.1.7) (1.19.5)
Building wheels for collected packages: pymeshlab
Building wheel for pymeshlab (setup.py) ... done
Created wheel for pymeshlab: filename=pymeshlab-0.1.7-cp37-cp37m-manylinux1_x86_64.whl size=42164894 sha256=57b54d26ae2d71d39f8e11f7354b5ef47a2bed3a73bb900e816a0ec4a65483f2
Stored in directory: /tmp/pip-ephem-wheel-cache-hwq1h23n/wheels/3d/56/5b/3748b9bd933db981a8d029588cc6efdd11ed37fb00906abf6b
Successfully built pymeshlab
Installing collected packages: pymeshlab
Successfully installed pymeshlab-0.1.7
Everything seems to install fine - however when I try to load the module I get the following error:
python3
>>> import pymeshlab as ml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/matt/miniconda3/lib/python3.7/site-packages/pymeshlab/__init__.py", line 1, in <module>
from .pmeshlab import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
and here is a test example of the errors using pytest
pytest --pyargs pymeshlab
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.3, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/matt
collected 0 items / 18 errors
===================================================================================================== ERRORS ======================================================================================================
___________________________________________________ ERROR collecting miniconda3/lib/python3.7/site-packages/pymeshlab/tests/test_colorize_geodesic_distance.py ____________________________________________________
ImportError while importing test module '/home/matt/miniconda3/lib/python3.7/site-packages/pymeshlab/tests/test_colorize_geodesic_distance.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
miniconda3/lib/python3.7/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
miniconda3/lib/python3.7/site-packages/pymeshlab/__init__.py:1: in <module>
from .pmeshlab import *
E ImportError: libGL.so.1: cannot open shared object file: No such file or directory
Do you have any suggestions for how I can get this running?
Thanks!
I want import bundle file with camera matrices by using 'import_cameras_for_active_rasters_from_file', but ms.apply_filter('import_cameras_for_active_rasters_from_file', importfile='.out') gives an error by saying "No file to open"
According to the documentation, I should "Open the layer dialog to see the results.", but as I understand this is part of MeshLab's GUI as in other section of the documentation it is said to click on it.
Am I missing something? Is there a way to access those results from a Python script?
Thank you.
Hi,
This issue is based on this question in Stack Overflow
The documentation on save_current_mesh() method is not very helpful about the options you can use, so here is a small help you can use:
These arguments can be set to True o False.
binary -> For formats that admit ascii or binary (for example, PLY)
save_vertex_quality
save_vertex_flag
save_vertex_color -> RGBA color per vertex
save_vertex_coord -> Texture coordinates per vertex!!!
save_vertex_normal
save_vertex_radius
save_face_quality
save_face_flag
save_face_color
save_face_normal
save_wedge_color -> RGBA color per wedge
save_wedge_texCoord -> Texture coordinates per wedge
save_wedge_normal
save_polygonal -> If the format admit polygonal faces (not triangular).
Hi,
first of all great library really makes things easier! I am trying to get the inertia tensor from a mesh (the mesh is a convex hull) directly in python. Unfortunately if I run:
out_dict = ms.apply_filter('compute_geometric_measures')
the out_dict does not contain any inertia entry. Computing the inertia for the same mesh in the Meshlab GUI works fine.
So I've been working on creating a 3d pipeline using PyMeshLab to dramatically reduce the amount of faces of a photo scanned .obj while still keeping the textures. I use the reconstruction as a starting point from where to reduce using the quadratic edge collapse and afterwards 'baking' or transferring the textures from the original to the reconstructed mesh.
This method worked fine for me when not baking the textures, so only having the model reconstructed and reduced, doing the texturing in blender.
Although everything worked so far, it now suddenly won't run through the reconstruction step.
When having the 'preclean' parameter set to False
the Error I get is:
Traceback (most recent call last):
File "Main.py", line 434, in <module>
main()
File "Main.py", line 415, in main
mesh.apply_filter(
pymeshlab.pmeshlab.PyMeshLabException: Failed to apply filter: surface_reconstruction_screened_poisson
Details: Filter requires correct per vertex normals.<br>E.g. it is necessary that your <b>ALL</b> the input vertices have a proper, not-null normal.<br> Try enabling the <i>pre-clean<i> option and retry.<br><br>To permanently remove this problem:<br>If you encounter this error on a triangulated mesh try to use the <i>Remove Unreferenced Vertices</i> filterIf you encounter this error on a pointcloud try to use the <i>Conditional Vertex Selection</i> filterwith function '(nx==0.0) && (ny==0.0) && (nz==0.0)', and then <i>delete selected vertices</i>.<br>
When the 'preclean' parameter is set to True
the resulting reconstruction step does this:
Depth[0/7]: Evaluated / Got / Solved in: 0,000 / 0,000 / 0,000 (927,133 MB) Nodes: 1
Depth[1/7]: Evaluated / Got / Solved in: 0,000 / 0,000 / 0,015 (927,148 MB) Nodes: 8
Depth[2/7]: Evaluated / Got / Solved in: 0,000 / 0,001 / 0,001 (927,152 MB) Nodes: 64
Depth[3/7]: Evaluated / Got / Solved in: 0,000 / 0,004 / 0,002 (927,504 MB) Nodes: 512
Depth[4/7]: Evaluated / Got / Solved in: 0,000 / 0,021 / 0,027 (933,512 MB) Nodes: 4096
Depth[5/7]: Evaluated / Got / Solved in: 0,000 / 0,085 / 0,054 (958,969 MB) Nodes: 32768
Depth[6/7]: Evaluated / Got / Solved in: 0,000 / 0,007 / 0,023 (958,969 MB) Nodes: 0
Depth[7/7]: Evaluated / Got / Solved in: 0,000 / 0,013 / 0,041 (958,969 MB) Nodes: 0
The reconstruction still finishes until the program exits because it cannot find the file after saving it. (Its being saved after simplification and then should be reloaded to bake the textures onto the new mesh).
Since I didn't change a thing concerning the reconstruction I'm kind of dumbfounded as to why this would happen.
Hi,
I'm trying to apply the colorize_curvature_apss
filter with curvaturetype=K1, K2
on a sample mesh, but it crashes.
This is the error I get:
*** Error in `python': double free or corruption (out): 0x000055f146d82bf0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7fd94a9a27f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7fd94a9ab38a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd94a9af58c]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/lib/plugins/libfilter_mls.so(_ZNSt6vectorIdSaIdEE17_M_default_appendEm+0xcf)[0x7fd9136bc0db]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/lib/plugins/libfilter_mls.so(_ZN3vcg9HistogramIdE8SetRangeEddid+0x6a)[0x7fd9136cbf78]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/lib/plugins/libfilter_mls.so(_ZN3vcg3tri4StatI6CMeshOE32ComputePerVertexQualityHistogramERS2_RNS_9HistogramIdEEbi+0x2a5)[0x7fd9136cc310]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/lib/plugins/libfilter_mls.so(_ZN9MlsPlugin11applyFilterEPK7QActionR12MeshDocumentRSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8QVariantSt4lessISB_ESaISt4pairIKSB_SC_EEERjRK17RichParameterListPFbiPKcE+0xdb3)[0x7fd9136c242d]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/pmeshlab.cpython-38-x86_64-linux-gnu.so(+0x34ffc)[0x7fd949dfbffc]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/pmeshlab.cpython-38-x86_64-linux-gnu.so(+0x33488)[0x7fd949dfa488]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/pmeshlab.cpython-38-x86_64-linux-gnu.so(+0x1e28b)[0x7fd949de528b]
/root/miniconda3/lib/python3.8/site-packages/pymeshlab/pmeshlab.cpython-38-x86_64-linux-gnu.so(+0x14019)[0x7fd949ddb019]
python(PyCFunction_Call+0x56)[0x55f1455fba76]
python(_PyObject_MakeTpCall+0x22f)[0x55f1455b950f]
python(+0x18bca1)[0x55f145607ca1]
python(+0x100de6)[0x55f14557cde6]
python(_PyFunction_Vectorcall+0x10b)[0x55f14560756b]
python(+0x100689)[0x55f14557c689]
python(_PyEval_EvalCodeWithName+0x2d2)[0x55f1456066a2]
python(PyEval_EvalCodeEx+0x44)[0x55f145607454]
python(PyEval_EvalCode+0x1c)[0x55f145695bbc]
python(+0x219c64)[0x55f145695c64]
python(+0x24bd14)[0x55f1456c7d14]
python(PyRun_FileExFlags+0xa1)[0x55f145590625]
python(PyRun_SimpleFileExFlags+0x3b4)[0x55f145590a0a]
python(+0x1158cf)[0x55f1455918cf]
python(Py_BytesMain+0x39)[0x55f1456ca829]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fd94a94b840]
python(+0x1deb33)[0x55f14565ab33]
======= Memory map: ========
55f14547c000-55f1454db000 r--p 00000000 08:01 10630130 /root/miniconda3/bin/python3.8
55f1454db000-55f1456cb000 r-xp 0005f000 08:01 10630130 /root/miniconda3/bin/python3.8
55f1456cb000-55f1457b1000 r--p 0024f000 08:01 10630130 /root/miniconda3/bin/python3.8
55f1457b1000-55f1457b6000 r--p 00334000 08:01 10630130 /root/miniconda3/bin/python3.8
55f1457b6000-55f1457ee000 rw-p 00339000 08:01 10630130 /root/miniconda3/bin/python3.8
Here's the link to the mesh: https://drive.google.com/file/d/1x0Ui0_zpOO8abvuzt3_jb3VA-sCNUjP7/view?usp=sharing
I would really appreciate it if you can help me fix this problem.
Thanks in advance.
Thanks for providing this library.
I'd like to upsample pointcloud color by meshlab and ran the following code.
import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh('test.obj')
ms.apply_filter('texel_sampling', recovercolor=True)
ms.save_current_mesh('pytest.ply', binary=False, save_vertex_color=True, save_face_color=False)
and I got the following error. Do you know what's wrong with this?
PyMeshLab 0.1.6 based on MeshLab 2020.09d
Similar Triangles face sampling
Floating point exception
FYI, here is the issue from meshlab repo.
cnr-isti-vclab/meshlab#272
Given the messy and definitely non-dynamic library load system of the external u3d exporter, the call
ms.save_current_mesh('file.u3d')
fails raising a PyMeshLabException.
See #25
In [1]: import pymeshlab
PyMeshLab 0.2 based on MeshLab 2020.12d
In [2]: ms = pymeshlab.MeshSet()
In [3]: ms.remeshing_isotropic_explicit_remeshing(targetlen=0.3)
fish: βipythonβ terminated by signal SIGSEGV (Address boundary error)
It'd be nice if it just threw an exception instead when no mesh is loaded
I am getting crashes of both select_by_face_quality() select_by_vertex_quality() sometimes, but not always. I have the parameters set low (minq 0, maxq .1), but I don't think this has anything to do with it. I suspect what is happening is that it is failing when a zero value is returned? Not sure how to provide a minimal example, as it does not happen every time. I'll spend some time seeing if I can figure this out, but has anyone else encountered it? I haven't had this happen in GUI Meshlab.
Hi,
I've installed the library via pip install on windows 10. My Python version is 3.7.9. When I use the library through windows powershell, it works fine. But when I want to run a script, the modules cannot be found.
for example: python myscript.py
--> AttributeError: module 'pymeshlab' has no attribute 'MeshSet'
I don't understand what the problem is. Do you know how to solve this? I really would like to run the functions via script.
Thank you in advance.
Hi!
Every-time I try calling the shape_diameter_function (with any parameters, any mesh), I get a core dumped error
I skimmed through the documentation, but I couldn't find this feature.
Some meshlab filters output a log after execution. "Close Holes" filter displays the following message "Closed 14 holes and added 28 new faces", for example.
In meshlab this filter just return None. Is it possible to get this information?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.