Forum

Author Topic: Acessing calibration parameters  (Read 4512 times)

patcarbon

  • Newbie
  • *
  • Posts: 22
    • View Profile
Acessing calibration parameters
« on: June 13, 2014, 04:10:25 PM »
I have a basic .psz file and I'd like to create slightly modified versions of this project where only the camera calibration parameters change.

In this forum I've found leads on how to script and load calibration xml files.  But can a script directly access one of the calibration parameters (e.g. fx,fy,k1,k2, etc..)? 

Thanks
Patrice

P.S. I'm a python ultra-newbie

patcarbon

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Acessing calibration parameters
« Reply #1 on: June 16, 2014, 06:56:23 PM »
Minimal progress but I'm still struggling!

I have a psz file and multiple calibration files in the same folder.  I want to apply each calibration file to the psz file, create a new psz file then process the lot.  So far I can:
- Batch generate all the calibration files
- Load the calibration files
- process multiple .psz files

My problem is that I can't seem to apply a calibration file once it's loaded.  user_calib.load(CalibFile) doesn't seem to do much.  This:
Code: [Select]
user_calib = PhotoScan.Calibration()
user_calib.load(CalibFile)
sensor = PhotoScan.Sensor()
sensor.user_calib = user_calib

Doesn't seem to do anything.  But I checked in the console and print (user_calib.fx) does give me the right number.  This has to be a simple error...

Thanks
P

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Acessing calibration parameters
« Reply #2 on: June 17, 2014, 09:55:22 AM »
Hello Patrice,

If you need to access camera calibration parameters of the active chunk you need to use the following:

Code: [Select]
doc = PhotoScan.app.document
chunk = doc.activeChunk

calib_in = PhotoScan.Calibration()
calib_in.load(path)

sensor = chunk.sensors[0]
sensor.user_calib = calib_in

In your sample you just haven't applied the imported calibration to the chunk from the project and use newly created (and therefore empty and not connected to the project) sensor instance.
Best regards,
Alexey Pasumansky,
Agisoft LLC

patcarbon

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Acessing calibration parameters
« Reply #3 on: June 17, 2014, 07:37:12 PM »
Aha, Thanks!!
P