mfdeveloper / surface_reconstruction_python

Import a point cloud file and perform poisson 3D surface reconstruction algorithm, integrated with third-party libraries (e.g. open3d, pymeshlab...)
https://pypi.org/project/surface-reconstruction
42 stars 5 forks source link

incompatible function arguments #1

Closed rmraaron closed 2 years ago

rmraaron commented 2 years ago

Thanks very much for your great work. The SurfaceReconstruction function works when I reconstruct a mesh. If I use this function in a loop for many ply files, it shows: TypeError: estimate_normals(): incompatible function arguments. Do you know how to fix it? Thanks again!

mfdeveloper commented 2 years ago

Hi @rmraaron ! Could you give me more information about this problem to try help you properly?

PS: I didn't use this library before with so many file streams, you know? Is that called in a Desktop software where you need to see the result of only one .ply file.

  1. Could you attach the .ply files that are you using?
  2. Could share here your code snippet with the loop through those files?

Also, paste the whole error and the stack trace here, please :)

rmraaron commented 2 years ago

@mfdeveloper Thanks for your quick reply! I created a function to call the SurfaceReconstruction function as follows:

def poisson_reconstruct(input_file, output_file):
    surface = SurfaceReconstruction(method_type='open3d', point_cloud_file=input_file, output_file=output_file)

    parameters = {
        'estimate_normals': {
             'fast_normal_computation': False,
             'normals': (1, 3)
        },
        'orient_normals_consistent_tangent_plane': {
             'k': 180,
        },
        'surface_reconstruction_screened_poisson': {
             'depth': 8,
              'width': 0,
              'scale': 1.1,
              'linear_fit': False,
              'n_threads': -1
          }
        }

    surface.poisson_mesh(**{'filters': parameters})

There are 100 .ply files in a directory for example, and then I tried to read each .ply file in a loop as the input file for poisson_reconstruct() function and called poisson_reconstruct(...) function. It showed:

TypeError: estimate_normals(): incompatible function arguments"

I have solved it since I put the poisson_reconstruct(...) function in a seperate .py file, and I call the .py file each time in the loop and it worked. I guess the reason is that it exists a crash for parameters (.ply files contain different number of vertices) when SurfaceReconstruction is run several times in a process.

Thanks very much! Have a nice holiday!