Agisoft Metashape
Agisoft Metashape => Bug Reports => Topic started by: wdimmit on August 24, 2022, 12:32:45 AM
-
I have an drone flight of 218 images that I can align and build a dense cloud without issues using an interactive Metashape session. When I try to process this same set of images via a python script, buildDepthMaps fails with the following message: "Assertion 239101010894 failed. Image size mismatch: 19009f89-7f2e-42a4-90fa-f9cb8c57855b".
The alignment and depth map generation settings are as identical as I can make them between the interactive and automated processing runs. I've attached the output of the python script starting at the buildDepthMaps step. The full call to the method is:
self.ms_chunk.buildDepthMaps(downscale=16,
filter_mode=dict(Metashape.FilterMode.values)['AggressiveFiltering'],
progress=progress_callback
)
I'm using Metashape 1.8.4 in both cases.
Thanks!
-
Hello wdimmit,
Usually such assertions arise when one of the source images has been replaced by the image of different dimensions or when the calibration is not properly defined, for example, if you are assigning the calibration via Python, make sure that calibration.width and calibration.height are properly assigned according to the target sensor dimensions.
-
In this script, the sensor dimensions are applied based on the information on the first image:
camera = self.ms_chunk.cameras[0]
self.ms_chunk.addSensor()
sensor = self.ms_chunk.sensors[0]
sensor.width = camera.image().width
sensor.height = camera.image().height
sensor.type = Metashape.Sensor.Type.Frame
When I open the project after the depth map generation failure, I can see the single sensor type defined properly and all the images listed have the correct dimensions.
-
Hello wdimmit,
Can you check, if using camera.photo.image() instead of camera.image() in your case does change anything in the script behavior?
-
No change using camera.photo.image() instead of camera.image(). The information reported in an interactive session after opening the failed project run all appears normal, and as expected. I've attached a screenshot
-
Hello wdimmit,
Maybe you can send to support@agisoft.com chunk.zip and frame.zip archives from the project.files folder structure related to the project created by the Python script (without any modification applied through Metashape GUI)?
Also please provide the code lines that you are using for setting up (or import) of the preclibrated distortion parameters.
-
Hello wdimmit,
It appears that the width/height in the calibration file that you are using are flipped compared to the sensor dimensions in Metashape project:
sensor.width = 11664
sensor.height= 8750
calibration.width = 8750
calibration.width = 11664
And this causes the exception during the processing.