Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: lmg on April 22, 2014, 07:58:01 PM

Title: importCameras problems
Post by: lmg on April 22, 2014, 07:58:01 PM
I am trying to import cameras using a python script.
The part of the code used in the script is this one:
path_cal="M:/D40"  #path for the calibration files
chunk = PhotoScan.Chunk()
starting_frame = iframe
chunk.label = "Frame_" + "{0:04d}".format(iframe)
path_cam=path_cal+"/c01_c04.xml"
chunk.importCameras(path_cam, "xml")


When I run the script, and the processing arrives to these lines, in the log on the console I have:
Loading project...
can't load project


and the cameras calibrations and positions are not imported.
How it is possible to solve this problem?
Title: Re: importCameras problems
Post by: Alexey Pasumansky on April 22, 2014, 08:17:58 PM
Hello lmg,

The console output looks like PhotoScan is trying to load the project and not camera calibration. Are there any lines above the code provided with doc.open() or anything similar involving PhotoScan.Document() class variables?
Title: Re: importCameras problems
Post by: lmg on April 24, 2014, 06:46:30 PM
I have moved chunk.importCameras(path_cam, "xml") at the end, and now it works. Thank you.
Bye