Forum

Author Topic: Metashape Script - Export Issues  (Read 7263 times)

DenisIaq

  • Newbie
  • *
  • Posts: 8
    • View Profile
Metashape Script - Export Issues
« on: August 18, 2024, 12:04:11 PM »
Hello everyone,

Today, I encountered a strange issue that I've never experienced before. When I run the Metashape export script (available here: https://github.com/agisoft-llc/metashape-scripts/blob/master/src/export_for_gaussian_splatting.py), the export process starts as usual but ends abruptly midway. Upon checking the export folder, I noticed that the images and the sparse folder are present, but the sparse folder is completely empty, and the images folder contains approximately half of the original image set.

The console shows the following:
Code: [Select]
2024-08-18 10:40:24 C:/Users/Neo/Documents/AgisoftProjekte/Eggelhof Kirche/export/
2024-08-18 10:40:24 Cropped initial calibration due to high distortion 5184x3456 -> 4399x3456
2024-08-18 10:40:24 Calibrations:
2024-08-18 10:40:24 0 1645.53507150751 5348 3546 0.0 0.0
2024-08-18 10:40:24 1 2172.3320579628817 18446744073709547420 18446744073709545066 0.0 0.0
2024-08-18 10:40:38 Found 226087 cropped projections
2024-08-18 10:40:38 Exporting images.
2024-08-18 10:48:36 Traceback (most recent call last):
2024-08-18 10:48:36   File "C:/Users/Neo/Desktop/export_for_gaussian_splatting.py", line 883, in <lambda>
2024-08-18 10:48:36     proc = lambda : self.run_export()
2024-08-18 10:48:36   File "C:/Users/Neo/Desktop/export_for_gaussian_splatting.py", line 737, in run_export
2024-08-18 10:48:36     export_for_gaussian_splatting(params, self.pBar)
2024-08-18 10:48:36   File "C:/Users/Neo/Desktop/export_for_gaussian_splatting.py", line 689, in export_for_gaussian_splatting
2024-08-18 10:48:36     save_undistorted_images(params, frame, folder, calibs)
2024-08-18 10:48:36   File "C:/Users/Neo/Desktop/export_for_gaussian_splatting.py", line 478, in save_undistorted_images
2024-08-18 10:48:36     img = cam.image().warp(calib0, T, calib1, T1)
2024-08-18 10:48:36 MemoryError: bad allocation

I'm not an expert, but could this be related to running out of RAM? My PC has 32GB of RAM and 11GB of VRAM.

I would appreciate any help or insights. Thanks!

DenisIaq

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Metashape Script - Export Issues
« Reply #1 on: August 18, 2024, 12:10:55 PM »
Okay, I apperantly fixed it by unchecking the "export images" checkbox.

Now i have the complet sparse files and simply use my original images. Never did it this way before, but seems to be the logical way. What a waste of time to export all the images i already have ^^

Problem solved!

vineg

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Metashape Script - Export Issues
« Reply #2 on: August 19, 2024, 01:40:21 PM »
Hi, Denislaq!

We have fixed a similar problem few days ago. You may try to update the script from https://github.com/agisoft-llc/metashape-scripts/blob/master/src/export_for_gaussian_splatting.py

Regards, Egor

3create

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • 3create
Re: Metashape Script - Export Issues
« Reply #3 on: August 27, 2024, 07:48:22 PM »
Hi Egor,

I'd be grateful to know some details about your changes to the script and how they relate to Denislaq's original issue (error message)?

@ DenisIaq: I may be stating the obvious, but the export images part of the script undistorts the images, so that for Gaussian Splatting the OpenCV PINHOLE convention with zero distortions can be used (-> cameras.bin). So if the original images were distorted, using them with this script will produce subpar results.

Thanks, Guy