Forum

Author Topic: more on Import and Export Cameras python commands  (Read 17348 times)

oto

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: more on Import and Export Cameras python commands
« Reply #15 on: November 08, 2016, 12:24:49 PM »
This script worked and result is correct, thanks. Why the exported files are not identical from both scripts?

Code: [Select]
#export cameras coordinates and orientation as omega,phi,kappa (OPK) using exportCameras function
#compatibility: Agisoft PhotoScan Professional 1.2.6

# Define: Cameras output file
CamerasOPKFile = PhotoScan.app.getSaveFileName("Please specify export path and filename/opk:")

# Define: Coordinate system
CoordinateSystemEPSG = "EPSG::32632"

# DEFINE PROCESSING SETTINGS
print("---Defining processing settings...")

# INIT ENVIRONMENT
import PhotoScan
import math

doc = PhotoScan.app.document
chunk = doc.chunk

# SET COORDINATE SYSTEM
print("---Settings coordinate system...")
# init coordinate system object
#CoordinateSystem = PhotoScan.CoordinateSystem()
#chunk.crs = PhotoScan.CoordinateSystem( CoordinateSystemEPSG)

if not(CoordinateSystem.init(CoordinateSystemEPSG)):
   app.messageBox("Coordinate system EPSG code not recognized!")
# define coordinate system in chunk
#chunk.crs = CoordinateSystem
#chunk.projection = CoordinateSystem

# EXPORT DATA:

# EXPORT CAMERAS
print("---Exporting camera positions...")
if not(chunk.exportCameras(CamerasOPKFile, "opk")):
   app.messageBox("Exporting Cameras OPK failed!")

print("exported cameras to",CamerasOPKFile)


totoromo

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: more on Import and Export Cameras python commands
« Reply #16 on: April 03, 2017, 04:23:54 PM »
Hi,

I haven't found any topic more relevant than this one for my question.
I would like to export the adjusted camera calibration through the Python API, but neither the forum nor the doc seem to treat that question. Is it possible ?

Regards

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: more on Import and Export Cameras python commands
« Reply #17 on: April 03, 2017, 05:54:56 PM »
Hello totoromo,

The following code demonstrates how to export the adjusted parameters from the first camera calibration group in the active chunk:
Code: [Select]
chunk = PhotoScan.app.document.chunk
chunk.sensors[0].calibration.save("D:/calibration.xml", format = "xml")
Best regards,
Alexey Pasumansky,
Agisoft LLC