Author Topic: Howto set Mapir camera calibration setting by Python?  (Read 2848 times)


  • Newbie
  • *
  • Posts: 26
    • View Profile
Howto set Mapir camera calibration setting by Python?
« on: June 14, 2017, 01:16:56 AM »

The Mapir camera needs manual setting for custom pixel size and focal length.
(There is link to instruction

How can I set it by Python script?
Can I just use this code

Code: [Select]
chunk =
camera = chunk.addCamera();
camera.sensor = chunk.addSensor();
camera.sensor.label  = 'Mapir Survey2'
camera.sensor.type = PhotoScan.Sensor.Type.Frame
camera.sensor.width = int("0.00134")
camera.sensor.height = int("0.00134")
camera.sensor.focal_length = int("3.97")
camera.sensor.fixed = True

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: Howto set Mapir camera calibration setting by Python?
« Reply #1 on: June 14, 2017, 11:15:36 AM »
Hello andrey.d,

sensor.width and sensor.height should correspond to the image dimensions in the group, so you shouldn't change them.

To change the pixel size and focal length (both in mm) parameters use the following code sample:
Code: [Select]
sensor.focal_length = 3.97
sensor.pixel_height = 0.00134
sensor.pixel_width = 0.00134

If you need to add images to the chunk, I recommend to use chunk.addPhotos() function and pass the list of paths to the images as an argument to it, rather than using addCamera() function.
Best regards,
Alexey Pasumansky,
Agisoft LLC