Forum

Author Topic: Format for "projection" parameter in 1.6 Python API  (Read 2410 times)

ashalota

  • Jr. Member
  • **
  • Posts: 93
  • Forest orthomosaics, long transects (300m agl)
    • View Profile
    • NASA: G-LiHT (Public orthomosaics)
Format for "projection" parameter in 1.6 Python API
« on: February 21, 2020, 01:11:14 AM »
What is the new format for the projection paramter used in "exportRaster" ?

Previously I had set it as: Metashape.CoordinateSystem("EPSG::"+str(epsgCode)) , when using "exportOrthomosaic" in 1.5


I can't figure out how to translate this to the 1.6 API

ashalota

  • Jr. Member
  • **
  • Posts: 93
  • Forest orthomosaics, long transects (300m agl)
    • View Profile
    • NASA: G-LiHT (Public orthomosaics)
Re: Format for "projection" parameter in 1.6 Python API
« Reply #1 on: February 21, 2020, 01:26:50 AM »
I'm also having trouble understanding hwat happened to jpeg_compression.

Could you translate this 1.5 code into 1.6 please?

Code: [Select]
curChunk.exportOrthomosaic(path=orthoDirAndFilename,
                             region=regionBounds,
                             format=Metashape.RasterFormat.RasterFormatTiles,
                             image_format=Metashape.ImageFormat.ImageFormatTIFF,
                             projection=Metashape.CoordinateSystem("EPSG::"+str(epsgCode)),
                             tiff_compression=Metashape.TiffCompressionJPEG,
                             jpeg_quality=20)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14846
    • View Profile
Re: Format for "projection" parameter in 1.6 Python API
« Reply #2 on: February 22, 2020, 02:20:19 PM »
Hello ashalota,

Output coordinate system definition in 1.6 for export raster:
Code: [Select]
export_proj=Metashape.CoordinateSystem("EPSG::"+str(epsgCode))
projection = Metashape.OrthoProjection()
projection.crs=export_proj
chunk.exportRaster(projection = projection)

Image compression definition:
Code: [Select]
compression = Metashape.ImageCompression()
compression.jpeg_quality = 20
compression.tiff_compression = Metashape.ImageCompression.TiffCompressionJPEG
chunk.exportRaster(image_compression = compression)
Best regards,
Alexey Pasumansky,
Agisoft LLC

ashalota

  • Jr. Member
  • **
  • Posts: 93
  • Forest orthomosaics, long transects (300m agl)
    • View Profile
    • NASA: G-LiHT (Public orthomosaics)
Re: Format for "projection" parameter in 1.6 Python API
« Reply #3 on: February 25, 2020, 10:26:07 PM »
How does the region BBox argument get created? Looks like the old format: (xmin,ymin,xmax,max) does not work anymore.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14846
    • View Profile
Re: Format for "projection" parameter in 1.6 Python API
« Reply #4 on: February 26, 2020, 09:22:40 PM »
Hello ashalota,

Please check the following example:
Code: [Select]
region = Metashape.BBox()
region.min = Metashape.Vector([x0, y0])
region.mфч = Metashape.Vector([x1, y1])
chunk.buildOrthomosaic(region = region)
Best regards,
Alexey Pasumansky,
Agisoft LLC