Forum

Author Topic: Camera Calibration Via Python?  (Read 5241 times)

Toast

  • Newbie
  • *
  • Posts: 3
    • View Profile
Camera Calibration Via Python?
« on: April 18, 2017, 07:07:03 AM »
Hi all,

There are quite a few gaps in my knowledge for PhotoScan as I am extremely new. I tried to read up and do my best to search as to not bother the forum, but I still can't piece together exactly how to achieve camera calibration via the Python API.

I have one folder with about 1000 checkerboard images and want to programmatically generate a camera calibration that then gets dumped into a reconstruction script (that part I have solid).

I am using the

chunk.addPhotos(...)


method to add photos into the chunk, but it seems to be creating a new camera for each photo.

Am I correct in understanding that I need to bind all of the photos in the chunk to the same camera?

Once I do that and align my photos, how can I figure out camera calibration from there?

Sorry if I had made an erroneous assumption somewhere in that post.

Thank you!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Camera Calibration Via Python?
« Reply #1 on: April 18, 2017, 12:10:55 PM »
Hello Toast,

Camera instances in PhotoScan represent the different positions where from the photos were taken.

What you are speaking about can be found in Tools Menu -> Camera Calibration window and is called as camera calibration groups. From Python these are "sensor" instances.

If you have all 1000 images taken by the same digital camera with the constant focal length, then you'll have 1000 camera instances and one sensor instance. The calculated calibration in this case can be taken from chunk.sensors[0].calibration.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Toast

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Camera Calibration Via Python?
« Reply #2 on: April 18, 2017, 12:43:22 PM »
Thank you ton for the speedy reply!

So a Camera == Image?

Lets say I have 5 cameras that each take one photo per chunk from different angles for reconstruction. I just assign a sensor per camera which loads a photo?

Best and thank you!
This software is pretty mind blowing!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Camera Calibration Via Python?
« Reply #3 on: April 18, 2017, 01:04:05 PM »
Hello Toast,

If you wish to calibrate all the cameras (images) with the separate parameters, then you need to create sensor for each camera (or Split calibration groups from the GUI).
Best regards,
Alexey Pasumansky,
Agisoft LLC

Toast

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Camera Calibration Via Python?
« Reply #4 on: April 19, 2017, 02:23:30 AM »
Last question,

Is there a way to generate an XML file from camera the sensor.calibration?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Camera Calibration Via Python?
« Reply #5 on: April 19, 2017, 11:31:25 AM »
Hello Toast,

Code: [Select]
sensor.calibration.save("file.xml")
Best regards,
Alexey Pasumansky,
Agisoft LLC