Forum

Author Topic: How to export orthomosaic with sqare pixel?  (Read 6091 times)

Ilya_1

  • Newbie
  • *
  • Posts: 3
    • View Profile
How to export orthomosaic with sqare pixel?
« on: August 21, 2024, 02:56:53 PM »
Hello!
I am trying to create a task to export orthomosaic with specified resolution in meters.
When do it manually (in metashape withot python), i achive it by the next steps:
1. I open "export orthomosaic" menu
2. I set resolusion in meters to 0.1
3. The pixel size (m) correspondingly changes for new resolution. If it isn't sqare, i simply copy res in X into Y. (as i see it changes te res in meterers a littlebit, but it's not a bit deal).

Now i am trying to recreate this behaviour in python code. For now  i have this:
Code: [Select]
    def export_ortho(self, export_path, resolution):
        task = Metashape.Tasks.ExportRaster()
        task.source_data = Metashape.OrthomosaicData
        task.path = export_path
        task.resolution = resolution
        return task

As far as i understand, i have to specify resolution_x and resolution_y instead of resolution, but i don't understand how to calculate them.
Note: I work in EPSG::3857

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15366
    • View Profile
Re: How to export orthomosaic with sqare pixel?
« Reply #1 on: August 21, 2024, 04:06:54 PM »
Hello Ilya,

resolution_x and resolution_y define the value in the coordinate system units. These units may be (and usually are) different from the "real" meters. For example, in UTM projections real meters are "shorter" than coordinate system units in the central meridian area and "longer" than coordinate system units by the borders of the area.

If you need to have pixels by square in terms of "real meters" then you should use "resolution" argument. And if you need to have square pixels in terms of coordinate system units, then you should specify resolution_x and resolution_y accordingly.
Best regards,
Alexey Pasumansky,
Agisoft LLC