Forum

Author Topic: Generate Ortho - Big Tiff Error  (Read 5122 times)

freetec1

  • Newbie
  • *
  • Posts: 7
    • View Profile
Generate Ortho - Big Tiff Error
« on: May 09, 2022, 03:37:43 PM »
Hello,

i am getting an error when exporting an orthomosaic of an large dataset. I build up a pipeline for the whole process. The part which fails is the following:
Code: [Select]
tasks = []

    task = Metashape.Tasks.ExportRaster()
    task.path = str(Path(*maps_path.parts[3:]).joinpath('dem.tif'))
    task.source_data = Metashape.ElevationData
    task.save_world = True
    tasks.append(task)

    task = Metashape.Tasks.ExportRaster()
    task.path = str(Path(*maps_path.parts[3:]).joinpath('orthomosaic.tif'))
    task.source_data = Metashape.OrthomosaicData
    task.raster_transform = Metashape.RasterTransformType.RasterTransformNone
    task.save_world = True
    task.image_compression = Metashape.ImageCompression.TiffCompressionNone
    task.image_compression.jpeg_quality = 99
    task.image_compression.tiff_big = True
    task.image_compression.tiff_overviews = True
    task.image_compression.tiff_tiled = True
    task.save_alpha = True
    tasks.append(task)

    network_tasks = []
    for task in tasks:
        if task.target == Metashape.Tasks.DocumentTarget:
            network_tasks.append(task.toNetworkTask(_doc))
        else:
            network_tasks.append(task.toNetworkTask(_chunk))

    client = Metashape.NetworkClient()
    client.connect(settings.SERVER_IP)
    batch_id = client.createBatch(project_path, network_tasks)
    client.setBatchPaused(batch_id, False)

Up till around 3000 images everything works fine, but on a project with more than 3000 images it fails on the exporting part of the orthomosaic with the error:

ExportRaster: TIFFWriteTile: unexpected error:...

libtiff error: Maximum TIFF file size exceeded
libtiff error: Maximum TIFF file size exceeded

Is there some way of fixing this with different settings while exporting the orthomosaic? Because on manuel exporting the moasic with the same settings works fine.

Kind regards

Moritz

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15067
    • View Profile
Re: Generate Ortho - Big Tiff Error
« Reply #1 on: May 10, 2022, 12:27:40 PM »
Hello Moritz,

Can you please send the log related to the export operation from the processing node? Should be something like that:
Code: [Select]
2022-05-10 12:19:48 Exporting orthomosaic...
2022-05-10 12:19:48 generating 68400 x 82085 raster in 1 x 1 tiles
2022-05-10 12:26:27 Finished processing in 399.705 sec (exit code 1)

Also please specify the input data format: number of channels and bit depth.
Best regards,
Alexey Pasumansky,
Agisoft LLC

freetec1

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Generate Ortho - Big Tiff Error
« Reply #2 on: May 10, 2022, 06:14:14 PM »
Hello Alexey,

the log looks like this:

Code: [Select]
2022-05-09 03:29:36 Exporting orthomosaic...                                                                                                                                     
2022-05-09 03:29:36 generating 57394 x 49445 raster in 1 x 1 tiles                                                                                                               
2022-05-09 03:31:39 libtiff error: Maximum TIFF file size exceeded                                                                                                               
2022-05-09 03:31:39 libtiff error: Maximum TIFF file size exceeded                                                                                                               
2022-05-09 03:31:39 Error: TIFFWriteTile: unexpected error: /mnt/departments/photogrammetry/20220429_001_01_BEAVX_12_Dreyer/maps/orthomosaic.tif                                 
2022-05-09 03:31:39 processing failed in 123.227 sec

over and over again.

it is an 8 bit jpeg image, rgb, so 3 channels.

weirdly enough, when i am exporting it manualy it works fine

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15067
    • View Profile
Re: Generate Ortho - Big Tiff Error
« Reply #3 on: May 10, 2022, 08:17:02 PM »
Hello Moritz,

I think the problem is caused by incorrect task.image_compression assignment. You need to make an assignment to Metashape.ImageCompression() class variable:
Code: [Select]
compression = Metashape.ImageCompression()
compression.tiff_compression = Metashape.ImageCompression.TiffCompressionNone
compression.jpeg_quality = 99 #will be only used, if TiffCompressionJPEG is selected#
compression.tiff_big = True
compression.tiff_overviews = True
compression.tiff_tiled = True
task.image_compression = compression
Best regards,
Alexey Pasumansky,
Agisoft LLC

freetec1

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Generate Ortho - Big Tiff Error
« Reply #4 on: May 12, 2022, 10:14:31 PM »
Thank you Sir,

worked like a charm