Forum

Author Topic: Problem with buildTexture  (Read 659 times)

SamuelPATE

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem with buildTexture
« on: January 03, 2025, 02:25:21 PM »
Hello

I try to build a tiled model from a colored point cloud. I use this process :
   - import point cloud
   - build mesh
   - build texture from mesh
   - build tiled model from mesh with transfer model texture

The process works when I use the app but crashes when I use the python module (even in the app).

Here is my script :

Code: [Select]
chunk.importPointCloud(
    path="point_cloud.ply",
    format=Metashape.PointCloudFormatPLY,
    crs=Metashape.CoordinateSystem("EPSG:4978"),
    shift=Metashape.Vector(shift)
)

chunk.importShapes(
    path="outline.geojson",
    replace=False,
    boundary_type=Metashape.Shape.OuterBoundary,
    format=Metashape.ShapesFormatGeoJSON,
)

chunk.buildModel(
    source_data=Metashape.PointCloudData,
    vertex_colors=True,
    vertex_confidence=False,
    clip_to_boundary=True,
    build_texture=True
)

chunk.buildTexture(
   source_model=0,
   transfer_texture=False
)

...

It crashes on the buildTexture instruction.

I noticed than the parameters are different when I launch the buildTexture from the app :
Code: [Select]
BuildTexture: mapping_mode = GenericMapping, page_count = 1, texture_size = 8192, pixel_size = 0.20326334238052399, texture_size = 8192, fill_holes = off, texture_type = Diffuse map, source_model = 0, transfer_texture = off, anti_aliasing = 1These parameters are a blend of buildUV and buildTexture api instructions.

How can I manage to build the texture to build the tiled model only with python module ?

Thank you

Paulo

  • Hero Member
  • *****
  • Posts: 1384
    • View Profile
Re: Problem with buildTexture
« Reply #1 on: January 03, 2025, 07:26:11 PM »
Hello Samuel,

before buildTexture you should first buildUV and then in buildTexture, change source_model attribute to source_asset...

Hope it works,
Best Regards,
Paul Pelletier,
Surveyor

SamuelPATE

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Problem with buildTexture
« Reply #2 on: January 06, 2025, 10:54:15 PM »
Thank you very much Paulo !
It works but only if I keep the source_model attribute...

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15246
    • View Profile
Re: Problem with buildTexture
« Reply #3 on: January 07, 2025, 06:28:17 PM »
Hello Samuel,

Texture blending in most cases assumes projecting of the images on the mesh surface.

 Since you have only imported point cloud, what kind of texture do you want to get? Using source_model argument means that you are baking colors of the mesh vertices (colored by the source point cloud colors) to the texture.
Best regards,
Alexey Pasumansky,
Agisoft LLC