Forum

Author Topic: flipped height, width and picture orientation in exported panorama pictures  (Read 1485 times)

54teltakt

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hello

when we process horizontal images in agisoft using a python script the exported panorama's sides are flipped. It should be 8000 by 4000 but is 4000 by 8000. If we process the images by clicking in the GUI we get an exported panorama with the right sizes, yet in both scenarios the pictures are turned upside down.
We can solve this problem in the GUI by clicking on the rotation arrow 2 times but we were unable to use the parameters that Metashape.Tasks.ExportPanorama comes with. Metashape.Tasks.ExportPanorama.rotation() sounds promising but we dont know how to apply it.

How can we ensure to get the right dimensions for our panorama? So far we set .height and .width to aproximate values but it compresses/stretches the picture.
How can we get the right orientation of our pictures? So far all images are upside down
Is there a way to crop the image to the pictures extend using python code? In the GUI dialog you can check "Setup boundaries" which cuts the black away and crops the image.
The GUI dialog also offers a function to "move" your panorama picture like if you would turn to the left or right (arrows to the left/right). Is there a way to do this with a python script?

Here's our function that does the panorama
Code: [Select]
def pano(chunk  , ex_path):
   
    #process images
    chunk.matchPhotos()
    chunk.alignCameras()

    # add camera group
    chunk.addCameraGroup()
    g1 = chunk.camera_groups[0]
   
    #move cameras to new group
    for c in chunk.cameras:
        c.group = g1
    #set group type to station   
    g1.type = Metashape.CameraGroup.Type.Station
   
    #export panorama
    ko = Metashape.Tasks.ExportPanorama()
    ko.path=ex_path
    ko.height = 4250
    ko.width = 8500
       
    ko.apply(chunk)

before we use the function we initialize a new metashape document and a chunk like this
Code: [Select]
    #Metashape dokumentanlegen   
    doc = Metashape.Document()
    chunk = doc.addChunk()
   
    #photos hinzuf├╝gen
    chunk.addPhotos(paths)
   
    #panorama machen
    pano(chunk, ex)

Thanks for your help!

Johannes