When calling compute_texcoord_parametrization_and_texture_from_registered_rasters, I get "Aborted (core dumped)"
Hey there! As the title says, when I call compute_texcoord_parametrization_and_texture_from_registered_rasters, I get "Aborted (core dumped)", It does take some time until I get it though - so it doesn't happen immediately.
Also, I am on Linux (Arch to be exact), using Python 3.11.6, and pymeshlab 2022.2.post4, and this is the line of code that causes the issue:
ms.compute_texcoord_parametrization_and_texture_from_registered_rasters(texturesize=10240,colorcorrection=True,colorcorrectionfiltersize=1,usedistanceweight=True,useimgborderweight=True,usealphaweight=False,cleanisolatedtriangles=True,stretchingallowed=False,texturegutter=4)
I did already try to reduce the texture size 1024, but It still happens.
Am doing anything wrong, or is this a bug? Thanks in advance!
PS. Thank you so much for this amazing tool - I'm using it as a part of my opensource photogrammetry software, and without it, I think I would have gone crazy :-)
So, I've done some more digging, and the latest version that the error does not happen on is 2021.10 (I had to downgrade to python 3.9.18 to install 2021.10 - but If I use pymeshlab 2022.2.post4 on that python version the error happens as well) - Oh and the error also happens with the latest 2023.12. Is there anything I can do to fix this?
This issue has been automatically marked as stale because it has not had recent activity. The resources of the VCLab team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the last release of PyMeshLab, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
Sorry for the late reply. Could you please help me reproduce the issue? Could you share the input meshes/rasters and the script you run? The filter you are using requires an opengl context to be executed, therefore the problem could be caused by the system setup... Although it is strange that it was working as expected on an old pymeshlab version.
Hey there - It's no problem, thank you for replying! - yeah sure so the script I am running is this one:
import os
import pymeshlab
import optparse
parser = optparse.OptionParser()
parser.add_option("-m","--mesh",action="store",help="To be textured mesh")
parser.add_option("-p","--project",action="store",help="Project")
parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored")
options, args = parser.parse_args()
output_folder = options.output_folder
project = options.project
mesh = options.mesh
ms = pymeshlab.MeshSet()
print("opening project...")
ms.load_project(project)
print('reading...')
ms.load_new_mesh(mesh)
print('repair non manifold...')
ms.meshing_repair_non_manifold_edges()
print('texturing...')
ms.compute_texcoord_parametrization_and_texture_from_registered_rasters(texturesize=10240,colorcorrection=True,colorcorrectionfiltersize=1,usedistanceweight=True,useimgborderweight=True,usealphaweight=False,cleanisolatedtriangles=True,stretchingallowed=False,texturegutter=4)
print('saving')
ms.save_current_mesh(os.path.join(output_folder,"textured.obj"))
and the mesh, images and project file I will send in a bit
So I ran the script like this (with the working folder being in the image folder):
/path/python/venv/bin/python /path/to/script/textureMesh/textureMesh.py -m '/drive/path/3dscanning/SmallPlastic/out/temp/model_surface.ply' -p '/drive/path/3dscanning/SmallPlastic/Images/project.nvm' -o '/drive/path/3dscanning/SmallPlastic/out'
(I just used the test set from reality capture)
and the image, project file, and mesh I uploaded here: https://mega.nz/file/5msHQTiD#qdKIrE0ED4AkqRHudU72VtHh5MwlpJ3PTuDgF1AqEB8
I met the same case, waiting for a solution
This problem occurs to me too.
I think that in my case the issue is that I am running the compute_texcoord_parametrization_and_texture_from_registered_rasters function on a system that does not have a monitor (offscreen mode). The system is Ubuntu but I think it doesn't matter.
pymeshlab 2022.2
Trying to deal with the problem of running a python script via
xvfb-run -a python3 my_awesome_pymeshalb_script.py - did not help. Maybe someone have solution? @edin45 @seekever @alemuntoni Thanks alot of any information how to fix this!
I have the same issue, compute_texcoord_parametrization_and_texture_from_registered_rasters still triggers abort (core dumped).
I tried changing pymeshlab version (2021, 2022, 2023) but nothing changes, I tried doing the parametrization via GUI (seeing from this other issue) and actually it worked (without using the set_raster_camera (ms.set_camera_per_raster()) filter. It's really hard to get any insight about the failure.. What can it be done to get some information about what is causing the error?
@freerafiki Did you managed how to avoid this error? Facing the same issue here:
import pymeshlab
def save_textured_plane(bundle_out, images_list_txt, plane_ply, output_ply):
# Load project and mesh, apply filters, and save mesh
try:
ms = pymeshlab.MeshSet()
ms.load_project([bundle_out, images_list_txt])
ms.load_new_mesh(plane_ply)
ms.apply_filter("set_camera_per_raster")
ms.apply_filter("compute_texcoord_parametrization_and_texture_from_registered_rasters")
ms.save_current_mesh(output_ply)
except Exception as e:
print(f"An error occurred: {e}")
@heronsaba not, but I managed to get more information setting verbosity to a higher level (you can use ms.set_verbosity(True)) and I got a message that the Qt plugin could not be initialized, and some reference to xcb. I had qt libraries but not where pymeshlab was expecting them and when I tried to link them manually (adding a symbolic link to Qt5 library I got another error telling me that there was a mismatch between the version of Qt which the code was compiled with and the one I linked it with, which makes sense, since I brutally linked the only one I found). I am not sure about how to solve it (reinstall Qt completely? Dig more into this xcb?), but I manually used the GUI to do the retexturing for a few meshes which was very urgent and left it by side for now, I will try to solve it next week. If you have any news or update, will be happy to hear/follow!
@freerafiki I was able to solve doing the steps below, please verifiy if it works for you!
pip uninstall opencv-python opencv-python-headless
pip install opencv-python-headless
@heronsaba in my case opencv-python opencv-python-headless was not installed (in the environment I used, I created one ad-hoc only for the code), I tried to install it, but it did not change anything.
可以重新编译pymeshlab。我之前写过一个程序,调用了"compute_texcoord_parametrization_from_registered_rasters"和“compute_color_and_texture_from_active_rasters_projection”。这两个函数怎么都无法运行,也没有任何提示信息。没办法,我只能clone了pymeshlab的源码自己编译试试。我的系统是Ubuntu 18.04,用的是系统默认的Qt版本。没用anaconda或者其他的qt。然后make再make install。注意一开始指定一个install的路径。然后我把我原来在anaconda里的pymeshlab文件夹内容都删掉,把我自己install后的东西复制过去就行了。
可以重新编译pymeshlab。我之前写过一个程序,调用了"compute_texcoord_parametrization_from_registered_rasters"和“compute_color_and_texture_from_active_rasters_projection”。这两个函数怎么都无法运行,也没有任何提示信息。没办法,我只能clone了pymeshlab的源码自己编译试试。我的系统是Ubuntu 18.04,用的是系统默认的Qt版本。没用anaconda或者其他的qt。然后make再make install。注意一开始指定一个install的路径。然后我把我原来在anaconda里的pymeshlab文件夹内容都删掉,把我自己install后的东西复制过去就行了。
Ubuntu 18.04 python 3.9