Forum

Acessing calibration parameters

Started by patcarbon, June 13, 2014, 05:10:25 PM

Previous topic - Next topic

patcarbon

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

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: 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

Hello Patrice,

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

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