Forum

Author Topic: Importing camera calibration.xml (1.3.5) in PS 1.4  (Read 6825 times)

Thilo OTH-R

  • Newbie
  • *
  • Posts: 4
    • View Profile
Importing camera calibration.xml (1.3.5) in PS 1.4
« on: February 13, 2018, 08:04:08 PM »
Hi there,

I've made a Camera calibration file in Photoscan lens in 1.3.5 and want to import this .xml file in Photoscan 1.4.0 via Python script.

this is my code:

PhotoScan.Calibration.load("G:\\BA\\agisoft_code\\Funktioniert\\Zusatz\\webcam_calib_16_9.xml", format=’xml’)

but it brings this error:
File "G:/BA/agisoft_code/AutoProcess_v2/calib.py", line 5
PhotoScan.Calibration.load("G:\\BA\\agisoft_code\\Funktioniert\\Zusatz\\webcam_calib_16_9.xml", format=’xml’)                                                                                                            ^
SyntaxError: invalid character in identifier
Error: invalid character in identifier (G:/BA/agisoft_code/AutoProcess_v2/calib.py, line 5)

Can someone help me? Is it even possible to import a .xml file of an older version?

thanks alot

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15628
    • View Profile
Re: Importing camera calibration.xml (1.3.5) in PS 1.4
« Reply #1 on: February 13, 2018, 08:24:57 PM »
Hello Thilo OTH-R,

Can you change the quotes symbols for both arguments to regular "?

Also where to you are trying to load the calibration? The provided line doesn't seem to have much effect on project contents.

I would rather suggest the following:
Code: [Select]
import PhotoScan
calib = PhotoScan.Calibration()
calib.load("G:\\BA\\agisoft_code\\Funktioniert\\Zusatz\\webcam_calib_16_9.xml", format="xml")
doc = PhotoScan.app.document.chunk #active chunk
sensor = chunk.sensors[0] #first calibration group in the active chunk

sensor.calibration = calib # this will set the Adjusted values according to the XML
sensor.user_calib = calib #and this will load the XML values to the Initial values
Best regards,
Alexey Pasumansky,
Agisoft LLC

Toll

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Importing camera calibration.xml (1.3.5) in PS 1.4
« Reply #2 on: June 27, 2018, 03:01:37 AM »
Hi Alexey, I have copied this code to my own script and I receive the error,

Sensor.user_calib = calib
AttributeError: Photoscan.Sensor object attribute 'user_calib' is read-only

Any ideas?

Toll

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Importing camera calibration.xml (1.3.5) in PS 1.4
« Reply #3 on: June 27, 2018, 03:04:33 AM »
Sorry, as per another thread a restart solved the issue