Forum

Author Topic: impor a calibration camera in a new window  (Read 3139 times)

leobrenes2

  • Newbie
  • *
  • Posts: 3
    • View Profile
impor a calibration camera in a new window
« on: May 04, 2016, 04:44:19 AM »
Hi , Im really new using the program and Im generating scrips in python, I was wondering if it is posible to import the calibration camera (xml file) but opening a new window and searching for it in my computer.
Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: impor a calibration camera in a new window
« Reply #1 on: May 04, 2016, 10:30:36 AM »
Hello leobrenes2,

You can use the following line:
path = PhotoScan.app.getOpenFileName("Specify XML location:")
to locate the XML file and them pass path as an argument to calibration open function.
Best regards,
Alexey Pasumansky,
Agisoft LLC

leobrenes2

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: impor a calibration camera in a new window
« Reply #2 on: May 05, 2016, 02:31:03 AM »
Thanks !

right know im using this code ,but at the end the calibration camera is 0 .  And there is no message error


import os
import PhotoScan
global doc
doc = PhotoScan.app.document
   
#Especificar el directorio donde se encentran las imágenes
print("Especificar el nombre del archivo donde se encuentran las  fotos:")
PhotoScan.app.messageBox("Especificar el nombre de la carpeta  donde se encuentran las  fotos:")
path_photos = PhotoScan.app.getExistingDirectory("Especificar el nombre del archivo donde se encuentran las  fotos:")
   

#Creación de nuevo set de imágenes o  chunk
doc.addChunk()
chunk = doc.chunks[-1]
chunk.label = "Grupo de Cámaras"


print("Escribir el nombre del archivo y la dirección donde guardar el proyecto:")
PhotoScan.app.messageBox("Escribir el nombre del archivo y la dirección \n donde guardar el proyecto:")
project_path = PhotoScan.app.getSaveFileName("Especificar el nombre del archivo para guardar el proyecto:")
if not project_path:
   print("Abortado por el usuario")
   
if project_path[-4:].lower() != ".psz":
   project_path += ".psz"
      
#Cargar imágenes
image_list = os.listdir(path_photos)
photo_list = list()
for photo in image_list:
   if (".jpg" or ".jpeg" or ".tiff" or ".TIF") in photo.lower():
      photo_list.append(path_photos + "\\" + photo)
chunk.addPhotos(photo_list)

doc.save(project_path)

PhotoScan.app.update()
print("Carga de imágenes finalizada")

PhotoScan.app.messageBox("Especificar la ruta del archivo XML:")
photo_list =PhotoScan.app.getOpenFileName("Specify XML location:")
calib_path = PhotoScan.Calibration(photo_list)
calib_path.load(photo_list)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: impor a calibration camera in a new window
« Reply #3 on: May 05, 2016, 11:56:24 AM »
Hello leobrenes2,

You are loading calibration to the isolated variable that is not connected to the original images.

If you've got only one camera calibration group, you need to load the calibration via sensor instance:

Code: [Select]
path = PhotoScan.app.getOpenFileName("Specify XML location:")
sensor = chunk.sensors[0]
calib = PhotoScan.Calibration()
calib.load(path, "xml")
sensor.user_calib = calib
Best regards,
Alexey Pasumansky,
Agisoft LLC

leobrenes2

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: impor a calibration camera in a new window
« Reply #4 on: May 06, 2016, 01:59:24 AM »
Hello Alexey

Thank you  very  much.
 
Have a good day.