Agisoft Metashape

Agisoft Metashape => Camera Calibration => Topic started by: Saulzar on January 09, 2020, 03:59:01 PM

Title: Camera rig import extrinsics
Post by: Saulzar on January 09, 2020, 03:59:01 PM
Hi!

I've been trying to import the extrinsics (intrinsics works fine) of a camera rig which we calibrate externally, using a python script. However, my attempt shown below does not seem to have any effect on the output.  Is there something I'm missing here? I've tried a few things, setting the location_accuracy etc... nothing seems to have much effect? Any tips on how to achieve this?

Thanks!
Oliver


        for camera, sensor in zip (calib['cameras'], chunk.sensors):
            sensor.fixed_calibration=True

            sensor_calib = import_calibration(camera)
            sensor.user_calib = sensor_calib

            sensor.fixed_rotation = False
            sensor.fixed_location = False

           if 'location' in camera and 'rotation' in camera:
             sensor.reference.location = camera['location']
             sensor.reference.location_enabled = True
         
            #sensor.reference.rotation = Metashape.utils.mat2ypr(Metashape.Matrix(camera['rotation']))
            #sensor.reference.rotation_enabled = True
Title: Re: Camera rig import extrinsics
Post by: Alexey Pasumansky on January 09, 2020, 04:58:36 PM
Hello Oliver,

Do you have multi-camera system (with Master and Slave sensors) or just a fixed rigs with N cameras (and only N images in the project)?
Title: Re: Camera rig import extrinsics
Post by: Saulzar on January 10, 2020, 02:50:03 AM
Hi Alexey,

Sorry I should have clarified - I have a multi-camera system of 6 cameras which all move rigidly together. So I capture some images and end up with 6*image_frames and import them with Metashape.MultiplaneLayout.

I've been using Metashape for a while with them configured this way and allowing Metashape to calibrate the extrinsics between them (Just by using sensor.fixed_location=False and sensor.fixed_rotation=False). However I have a desire to use an external calibration so that the reconstructions are in real world units!


I should add that I tried setting the location and rotation directly, which seems to always fail to align, even when the location and rotation are the exact same outputs from a previous Metashape reconstruction on the same images...

          if 'location' in camera and 'rotation' in camera:
                sensor.location = camera['location']
                sensor.fixed_location = True

                sensor.rotation = Metashape.Matrix(camera['rotation'])
                sensor.fixed_rotation = True


Thanks,
Oliver

Title: Re: Camera rig import extrinsics
Post by: Saulzar on October 23, 2020, 02:54:30 PM
Any idea on what is wrong with this approach? I still haven't found anything which works.

For what it's worth setting the intrinsic calibration works fine.

sensor.user_calib = my_calibration
sensor.fixed_calibration = True

After setting the extrinsics, after alignment sensor.location and sensor.rotation are  both 'None' however.