Forum

Author Topic: loading calibration  (Read 2047 times)

hagorms

  • Newbie
  • *
  • Posts: 12
    • View Profile
loading calibration
« on: January 23, 2018, 01:01:23 PM »
Hello.
After i calibrated cameras with multiple frames I use this script to save calibration:

   
Quote
def exportCalibration(self, path, filename):
        self.superChunk.exportCameras(path + filename, format=PhotoScan.CamerasFormatXML)
        i = 0
        for camera in self.superChunk.cameras:
            camera.sensor.calibration.save(path +str(i)+ ".xml")
            i = i + 1

To load Calibration i use this script:

 
Quote
  def loadCalibration(self, calibrationPath, calibName, calibFilesPrefix):
       
        for frame in self.superChunk.frames:
            frame.importCameras(calibrationPath + "\\" + calibName, format=PhotoScan.CamerasFormatXML)
            cameraId = 0
            for camera in frame.cameras:
                camera.open(self.cameraFolders[0] + self.fileVec[0][cameraId])
                sensor = frame.addSensor()

                calibration = PhotoScan.Calibration()
                calibration.load(calibrationPath +"\\" + calibFilesPrefix + str(cameraId) + ".xml")
                sensor.calibration = calibration
                sensor.width = camera.sensor.width
                sensor.height = camera.sensor.height
                sensor.focal_length = calibration.f
                sensor.pixel_width = 0.0055
                sensor.pixel_height = 0.0055
                sensor.type = camera.sensor.type
                sensor.fixed = False
                camera.label = sensor.label
                camera.sensor = sensor
                cameraId = cameraId + 1
           

So my question:
When I don't see aligned cameras as on the screenshot,
,
 does it mean, that cameras were not loaded correctly?
What is the correct way to load cameras? Shall I rename images first?
 

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14846
    • View Profile
Re: loading calibration
« Reply #1 on: January 25, 2018, 05:22:00 PM »
Hello hagorms,

The labels of the cameras in the active chunk should correspond to the labels in the XML file.
Best regards,
Alexey Pasumansky,
Agisoft LLC