Forum

Author Topic: Pixel size of orthomosaic depending on coordinate system  (Read 299 times)

Seboon

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Pixel size of orthomosaic depending on coordinate system
« on: September 09, 2021, 09:15:50 PM »
Hi everyone, especially our dear Alexey for whom this message is primarily addressed!


I'm currently working on a custom script that allows user to export orthomosaic at desired scale. It takes the  orthomosaic export dialog of Metashape and add a little option for that.

My issue, if it's really one, is that I don't get the same result for the pixel size as the native dialog of Metashape. It can be seen on the attachments (cap1).

This leads me to some questions regarding  how the software calculate pixel size of an orthomosaic, whether to build or to export.

My orthomosaic has been generated with the same CRS's project ( WGS84/UTM 36N with EGM 2008 , see bottom of cap1 in the console pane)

The command line "Metashape.app.document.chunk.orthomsaic.resolution" matches with my custom dialog but not with the native one. Why??

Thanks to this topic https://www.agisoft.com/forum/index.php?topic=8162.0, the result of the coordinates conversion from meter to degree finally matched the Metashape calculation of pixel size (see cap2)

The CRS I used to generate the orthomosaic is not a geographic system, but a projected one (see cap6.png), so why  I need to convert coordinates from meter to degree to get the same result as the one proposed by the software?

On cap3, I used the native dialog, and switched to the geographic WGS84. When checking the conversion button in meters,  this time it gave me the same result as mine. 

Surely  I'm missing something, but it seems to be inverted, no?
Or does Metashape consider orthomosaic built in geographic mode to use only degree for orthomosaic resolution, only Geographic CRS and not Projected ?

You'll  also find my scipt in attachments ; even it's not yet complete, it can helps!

Thanks in advance for your time and your anwer,

Best regards
S.Poudroux
Archaeologist - Topographer - Drone remote pilot

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13142
    • View Profile
Re: Pixel size of orthomosaic depending on coordinate system
« Reply #1 on: September 09, 2021, 10:24:27 PM »
Hello S├ębastien,

You can try to get the desired value for projected coordinate systems using the following command:
Code: [Select]
res = (chunk.orthomosaic.top - chunk.orthomosaic.bottom) / (chunk.orthomosaic.height)
#or
res = (chunk.orthomosaic.right - chunk.orthomosaic.left) / (chunk.orthomosaic.width)
Best regards,
Alexey Pasumansky,
Agisoft LLC

Seboon

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: Pixel size of orthomosaic depending on coordinate system
« Reply #2 on: September 10, 2021, 10:20:35 AM »
Ok Alexey, got it!!

The difference between pixel size and ortmosaic.resolution was quite confusing...

Tank you!

Best regards
S.Poudroux
Archaeologist - Topographer - Drone remote pilot

Seboon

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: Pixel size of orthomosaic depending on coordinate system
« Reply #3 on: September 10, 2021, 03:14:21 PM »
Hi again,

I have another question regarding  the region export option in the export orthomosaic dialog. Please see attachments.

Generated orthomosaic is 48190 * 41393 px.

If 'setup boundaries' is unchecked total pixel size calculated for the export is 48189*41393 px (No_region.jpg).

On the opposite, if it's checked the result is 48190*41392 px (Region.jpg)

My guess is that the difference between generated ortho and export is dealing with the origin of orthomosaic ( I don't remember if it's top-left or bottom-left?) and the origin of pixel (center or top-left?)

If it's right, why only one pixel is added or removed  from orthomosaic.witdth  OR orthomosaic.height and not from orthomosaic.witdth  AND orthomosaic.height , depending on whether setup boundaries is checked or unchecked?

Also,  switching to another CRS sometimes lead to change just the orthomosaic.witdth (otherCRS_NoRegion.jpg & otherCRS_Region.jpg)

Would you mind explaining me how Metashape compute the total pixel size with or without region boundaries,  and how to get the same result by script?

Thanks in advance!

Best regards,
« Last Edit: September 10, 2021, 03:25:40 PM by Seboon »
S.Poudroux
Archaeologist - Topographer - Drone remote pilot