1
Python and Java API / Re: Syntax for exportRaster image compression
« on: September 06, 2023, 07:01:32 PM »
That worked! Restarting was key, since I think the previous mistake I made had broken things. Thanks!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
import Metashape
chunk = Metashape.app.document.chunk
compression = Metashape.ImageCompression
compression.tiff_compression = Metashape.ImageCompression.TiffCompressionJPEG
compression.jpeg_quality = 90
out_projection = Metashape.OrthoProjection()
out_projection.type = Metashape.OrthoProjection.Type.Planar
out_projection.crs = Metashape.CoordinateSystem("EPSG::32610")
chunk.exportRaster(path = 'D:\my\output\path\geotiff.tif',
source_data = Metashape.DataSource.OrthomosaicData,
format = Metashape.RasterFormatTiles,
image_format = Metashape.ImageFormatTIFF,
image_compression = compression,
save_alpha = True,
white_background = True,
resolution_x = 0.10,
resolution_y = 0.10,
projection = out_projection
)
TypeError: invalid value type
Error: Vertical datum missing
print('CHUNK WILL BE COPIED --AFTER-- THIS PRINT STATEMENT')
newchunk = chunk.copy()
newchunk.label = chunk.label + '_NewChunk'
2018-05-24 16:47:26 DuplicateChunk: items = (depth maps, dense cloud, model, DEM, orthomosaic, tiled model)
2018-05-24 16:47:26 Duplicating chunk...
2018-05-24 16:47:26 Finished processing in 0.016 sec (exit code 1)
2018-05-24 16:47:26 CHUNK WILL BE COPIED --AFTER-- THIS PRINT STATEMENT
import time
print('CHUNK WILL BE COPIED --AFTER-- THIS PRINT STATEMENT')
time.sleep(5)
newchunk = chunk.copy()
newchunk.label = chunk.label + '_NewChunk'
2018-05-24 16:47:54 DuplicateChunk: items = (depth maps, dense cloud, model, DEM, orthomosaic, tiled model)
2018-05-24 16:47:54 Duplicating chunk...
2018-05-24 16:47:54 CHUNK WILL BE COPIED --AFTER-- THIS PRINT STATEMENT
2018-05-24 16:47:54 Finished processing in 0.031 sec (exit code 1)
2018-05-09 10:50:07 OptimizeCameras: f, cx, cy, k1-k3, p1, p2
2018-05-09 10:50:07 Optimizing camera locations...
2018-05-09 10:50:07 adjusting: xxxxx- 0.922438 -> 0.922438
2018-05-09 10:50:07 coordinates applied in 0 sec
2018-05-09 10:50:07 Finished processing in 0.318 sec (exit code 1)
run calcOptimizeCamerasError.py
2018-05-09 10:50:20 0.4755864736517061