Import Agisoft PhotoScan / Metashape Cameras

Import Agisoft PhotoScan / Metashape Cameras

Import cameras from Agisoft PhotoScan xml. Works with xml version 1.4.0 which is exported from PhotoScan 1.4.x versions and xml versions 1.5.0 from Agisoft Metashape 1.5.x versions. If you want to have images actually aligned with model, undistort images first. This is done in PhotoScan by Export > Undistort Photos.. . Because you can’t in Blender set resolution for cameras independently, xml with different cameras or image resolutions might not work well.

Import Agisoft PhotoScan Cameras


  1. go to Properties > Scene > Import Agisoft PhotoScan Cameras panel
  2. Cameras XML : set path to xml
  3. set import options:
  • Camera Display Size : size of imported cameras in viewport
  • Load Camera Images : load images or not
  • Images Directory : path to directory with undistorted images
  • Image Extension : images extension, they all should be the same (currently)
  • Alpha : camera image alpha, 0.0 - 1.0
  • Depth : camera display depth, front / back
  1. there are some more optional properties:
  • Create Chunk Region Borders
  • Align to Active Object : if you import mesh from PhotoScan first, the transform it to correct size and orientation, this option will copy transformation from that mesh if it is active
  1. hit Import
  2. import done…
  3. now you can quickly swap cameras in alphabetical order in PhotoScan Cameras Utilities panel


  • 0.1.1 first release

get it here:


Hi, This looks amazing - thank you!

Just tried it using Blender 2.8 and Metashape 1.5.2 and am getting an error …

location: :-1

checking file version: (1, 5, 0): ok
loading and parsing xml from: C:\Users\Woody\Desktop\cams.xml
Traceback (most recent call last):
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 873, in execute
o = PSCXMLImport(**d)
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 673, in init
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 696, in _make
self.psc = PSCMakeCameras(self.xml_path, self.matrix, self.camera_draw_size, do_planes, self.chunk_regions, self.correct_principal_point, )
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 371, in init
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 376, in _make
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 409, in _load_parse_xml
ch = PSCChunk(chunk, “chunk-{0}”.format(i))
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 335, in init
cam = PSCCamera(c, sensor)
File “C:\Users\Woody\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\”, line 286, in init
if(xml.attrib[“enabled”] == “true”):
KeyError: ‘enabled’

location: :-1

Any Ideas? Thanks in advance.

xml structure has changed, redownload addon it is fixed now, just tried it with metashape 1.5.3

1 Like


Thanks for reply - that has fixed the error, now cameras import - should it be normal to have lines protruding from them all to the zero datum?

these are Relationship Lines (all cameras are parented to an empty). you can turn them off in 3d viewport overlays

1 Like

Awesome - thanks.

One last thing, I don’t seem to be able to get the cameras to align to the exported/imported mesh, could it be a scale/rotation related issue? Should I be importing agisoft mesh in any particular scale/rotation or file type etc?

Thanks again.

what i do, i import mesh as obj, default settings, reset rotation, rotate / scale / move as it should be, and then when i import cameras with align to active mesh selected it should match.
if somewhere along process that initial transformation is lost it won’t align. for example if you apply transformation, or if you process mesh somewhere else with different coordinate system, then you could try rotate +90/-90 along X axis, it might match, some software works in Z up, some in Z as depth…
if you can’t get it to work, would you send me some lowres sample to try

1 Like

Hi, awesome advice. Thanks.

I did get it to all align. With no problem in the end. I think the original model I was trying I had edited elsewhere to re topo and this must have been causing coordinate issues.

All good now though. Thanks for the awesome set of tools.

Love your work on your site by the way!

Seem to be having issues. Using the official 2.8 release, and Metashape 1.5.3
Here’s a screenshot of the error Blender threw.

I did not import any images with the cameras, and I aligned the images with the selected export from Metashape.

hi, can you send me the xml file? it looks like in you xml the calibration element of sensor is missing center x (and y), something i would say very important… do you have cameras aligned in Metashape?
and if you go Tools > Camera Calibration… do you have in Adjusted (not Initial) tab some values? f, cx, cy, k1 etc.?


I’m trying to use your addon but with no luck. I propably know where the issue comes from but I don’t know how to fix it.

I was able to import properly cameras from metashape to blender when I was using photos made by Canon 5D mk2
I was not able to import cameras when I made photos using Xiaoyi MI Y1 mirorless camera.

I checked EXIF version. The same. Of course there is some information missing from Xiaoyi camera like brand, lens, focal length etc but the most important so image size is correct. Of course aligment was sucesfull. The camera showis itself in Metashape as uncalibrated but during processing I’m getting corect calibration values. When I save it, it becomes “calibrated” but it changes nothing. The import is not possible.

I made a video with my canon 5d mk2. Imported to metashape as frames. Align corectly but cannot import to Blender via your addon.

Does metashape erase some data during extraction video to key frames?
What should be added and if it is possible by edditing an exif file?

hi, error is related to missing sensor center x,y values. after calibration it should be present. can you send me the xml? images are not needed at all. i don’t read exif in addon. all is taken from metashape xml. i have used it only with canon 5d, nikon d800 and fuji x100s, no problems, but never used any other camera…


Anyway, I would like to thank you for making cool addons :).

strange, how many cameras did you use? there are 4 sensors, one spherical 3456x1728 (unused anywhere), 1920x1080, 3902x5200 and 5200x3902 (possibly those last two is the same camera, but one portrait, one landscape). that spherical sensor is not calibrated and therefore it is failing. but if i remove that sensor, it fails again on something else. pixel_width and pixel_height properties are missing, no idea why, i always had it. it is used for calculating back sensor physical size and calibrated focal length. those are essential, no idea if i can do some workaround. i’ll have a look.

sadly i’ve never seen some specs for cameras xml, so it is all reverse engineered and unless you use single camera, some standard full frame it may not work at all

and also, blender can’t have different resolution for each camera, so mixing them won’t work anyway, or some cameras will be stretched

This project is a bit messed up as I wanted to have full calibration of video frames so I needed some reference. The only exported cameras are 1920x1080 and this is video from 5d mk2. The others are disabled or erased.

Behaviour doesn’t change if I use only 5Dmk2 video frames in the project. Still the same issue.

Video frames are not the same size and ratio as photo frames, and I’m not sure if this fact is taken under consideration by Metashape (that is why it displays them as uncalibrated). So I assume here is the issue. Is there any chance to give manually values to your addon? That would be great because the most interesting use of this addon is camera solving.

not quite, there are two groups, one foto and one wideo dla bugtracera, it tries to read both. but deleting it won’t help because those missing props in sensor i mentioned.

i will have a look what i can do… still, i have no idea why sometimes values are there and sometimes not…

oh, what I mean is that I have disabled or erased other camras than 5dmk2 so “wideo dla bugrtracera” but “foto” gorup is still part of the reconstruction as I used these point as best reference to calibrate wideo. I don’t know wnat Metashape really did :slight_smile: maybe they are not disabled at all.

Do you have any confirmed use of the frames from the video?

i just pushed quick and dirty fix. try it and tell me the result. better to export xml again, this time try somehow delete all but video frames everywhere. because for your camera there is no pixel real size value so i can’t recalculate it to something blender understands, like mm :slight_smile: and therefore it results in really strange values, but it will make something, but i am not sure if it is right or not…

Alright, so:

I was able to import successfully cameras into Blender.
I have matched them with mesh
The image imported doesn’t set background images for the cameras. But it can be solved by importing sequence to animated camera.
When importing video Metashape names the files 1 2 3 4 5 etc… your addon reads files 1 10 100 101 102 as it assumes different enumeration type.

It is very close! Do you have an idea how to change camera positions into one aminate camera track (i know only manual way…)?

I have some misalignment but it is probably problem with my project. When I’ll solve issue with animating a camera I’ll do a proper test. It has potential to be the one of the most useful addons ever :slight_smile:

does not? it should.

maybe that is why images are not set, it tries to load image from name specified in xml, with photographs it match with image file name without extension, with video i have no idea, but it looks like this in your xml: <camera id="1926" sensor_id="1" label="frame67">, so it will search for frame67.EXT

animating camera to move along curve? but i think you would need every frame from video, not a subset, wouldn’t blender camera tracking be better suited for it? (never used it so i don’t know)