Forum

Author Topic: Poor reconstruction  (Read 948 times)

jrh87

  • Newbie
  • *
  • Posts: 12
    • View Profile
Poor reconstruction
« on: March 12, 2025, 05:49:52 AM »
I am often encountering scenarios where the reconstruction fails. For example, having taking pictures of a single building facade, the resulting reconstruction comes out with multiple parts not properly aligned / connected (see screenshot). Does anyone have any suggestions of what's going wrong? The script I use is as follows:

import Metashape
import os

img_path = '/Users/User/Desktop/Data/images/'
project_path = '/Users/User/Desktop/Data/project.psz'

# Create project
doc = Metashape.Document()
doc.save(path=project_path)
chunk = doc.addChunk()

# Get images
images = []
for root, _, files in os.walk(img_path):
    for file in files:
        if file.endswith(".JPG"):
            images.append(os.path.join(root, file))

# Processing
chunk.addPhotos(images) #, Metashape.MultiplaneLayout)
chunk.matchPhotos(downscale=4, generic_preselection=True, reference_preselection=True)
chunk.alignCameras()
chunk.buildDepthMaps(downscale=8, filter_mode=Metashape.AggressiveFiltering)
chunk.buildModel(source_data=Metashape.DepthMapsData, surface_type=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation)
chunk.buildUV(mapping_mode=Metashape.GenericMapping)
chunk.buildTexture(blending_mode=Metashape.MosaicBlending, texture_size=4096)
texture_format=Metashape.ImageFormat.ImageFormatJPEG, save_texture=True)

# Save
doc.save()

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: Poor reconstruction
« Reply #1 on: March 13, 2025, 06:19:48 PM »
Hello jrh87,

 I would suggest to disable reference_preselection option (set it to False) and use downscale=1 or at least 2.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jrh87

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Poor reconstruction
« Reply #2 on: March 14, 2025, 08:42:31 AM »
Thanks! I have done so and, even if significantly better, the reconstruction is still not ideal.

Reference preselection refers to using GPS coordinates to better find matches between images, is that right?

For downscale, using 1 or 2 should be referring to matchPhotos. I assume buildDepthMaps can be further downscaled for efficiency (e.g. 4)?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: Poor reconstruction
« Reply #3 on: March 14, 2025, 12:19:34 PM »
Hello jrh87,

Reference preselection speeds up the image matching process, but it has been mostly designed for the aerial nadir surveys. For oblique datasets, if you still want to use reference preselection, you need to input Capture distance for cameras (as distance from the camera location to the scanned surface) and load the camera orientation angles to the Reference pane.

But I think in case of small datasets (like few hundreds of images), using Generic preselection only should not take long time.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jrh87

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Poor reconstruction
« Reply #4 on: March 20, 2025, 04:31:52 PM »
I have noticed that, for building facades where there is an obstacle in the middle, such that the images can be only taken from the left and right side missing a good overlapping in the middle, but adding topdown images to cover the entire facade, Metashape tends to provide poor results (i.e. 2 different non-connected areas) as compared to other 3D engines. Are there any settings that could help improve the reconstruction?

I am using these settings:

chunk.addPhotos(images) #, Metashape.MultiplaneLayout)
chunk.matchPhotos(downscale=2, generic_preselection=True, reference_preselection=False)
chunk.alignCameras()
chunk.buildDepthMaps(downscale=4, filter_mode=Metashape.AggressiveFiltering)
chunk.buildModel(source_data=Metashape.DepthMapsData, surface_type=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation)
chunk.buildUV(mapping_mode=Metashape.GenericMapping)
chunk.buildTexture(blending_mode=Metashape.MosaicBlending, texture_size=4096)

jrh87

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Poor reconstruction
« Reply #5 on: March 22, 2025, 03:49:29 AM »
I am adding an image to better illustrate the case. It can be seen 2 vertical passes taken with little overlap in the middle. Due to obstructions, the middle area cannot be captured. But, as mentioned, I believe metashape should still be able to stitch both sides of the facades, just not sure about the best settings for this case.