Forum

Author Topic: Problem Importing Pyside  (Read 7543 times)

Kalel

  • Newbie
  • *
  • Posts: 7
    • View Profile
Problem Importing Pyside
« on: August 04, 2017, 09:17:01 PM »
Hi,
I was trying to run a script in order to orthorectify images based on single camera position. Script I took from a forum here and was written by Alexey. I recently downloaded Photoscan 1.3.2 (the trial version) and it seems I can't import Pyside from the console. It's weird because in the previous version I had (1.0.0) the script worked just fine. Is there a way to solve this problem?

Best regards,

Kal

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15663
    • View Profile
Re: Problem Importing Pyside
« Reply #1 on: August 05, 2017, 01:17:20 AM »
In the version 1.3 you should use PySide2 module instead.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Kalel

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Problem Importing Pyside
« Reply #2 on: August 07, 2017, 03:44:39 PM »
Hello Alexey,
Importing PySide2 works in the 1.3 version. Nevertheless, I needed to import this module in order to use one of  your scripts. I need to export every single images I use in a project as individual orthorectified images. You already answered this question in a previous post http://www.agisoft.com/forum/index.php?topic=2236.0
The problem is that with the PhotoScan's new version this script dosen't work anymore.. The module doesn't seem to be available in this version. Do you have a script with the updated version?


Best regards,

Kal

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15663
    • View Profile
Re: Problem Importing Pyside
« Reply #3 on: August 07, 2017, 03:55:13 PM »
Hello Kal,

You can use Tools Menu -> Export -> Export Orthophotos option to save individually orthorectified images. So it's not necessary to adapt the script from the version 1.0 to 1.3, since the option is available from the GUI.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Kalel

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Problem Importing Pyside
« Reply #4 on: August 07, 2017, 09:38:48 PM »
Hello Alexey,
I have got everthing to work! Thanks to your advices. I have another question. I've been trying to import a camera orientation file with the script (available in the attachments). I keep receiving the same error : Can't import cameras : path to the file. At first, I had a .txt file and then I wrote a Python Script to convert it into xml. It is still not working. Can I get more of your advices ?

Best regards,
Kal

Kalel

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Problem Importing Pyside
« Reply #5 on: August 07, 2017, 09:40:30 PM »
Here's the file to convert text file into xml if it is pertinent to anyone ;)

Best regards
Kal
Code: [Select]
from xml.dom import minidom
import os

root = minidom.Document()

xml = root.createElement('root')
root.appendChild(xml)
#Adapt the lists to the values
photo_name = ['q15167_012_rgb.tif', 'q15167_013_rgb.tif', 'q15167_014_rgb.tif', 'q15170_283_rgb.tif', 'q15170_284_rgb.tif', 'q15170_285_rgb.tif', 'q15170_286_rgb.tif']
Easting = ['338010.605', '336422.933', '334834.481', '334324.472', '335915.989', '337505.418', '339087.214']
Northing = ['5323346.835', '5323343.808', '5323362.754', '5320364.384', '5320341.928', '5320329.341', '5320343.619']
Elevation = ['4912.347', '4919.982', '4913.604', '4910.207', '4917.109', '4918.915', '4927.982']
Yaw = ['0.028428', '0.014869', '0.0239', '0.59213', '-0.070288', '-0.90509', '-0.83606']
Pitch = ['0.021636', '0.022214', '0.012952', '0.60759', '0.096207', '0.12487', '-0.40993']
Roll = ['0.41532', '0.4051 ', '0.39703', '-0.70681', '-0.94959', '-0.044628', '0.72353']

for i in range (0,len(photo_name)):
    productChild = root.createElement('product')
    productChild.setAttribute('Label', str(photo_name[i]))
    xml.appendChild(productChild)

    childOfProduct = root.createElement('Easting')
    childOfProduct.appendChild(root.createTextNode(Easting[i]))
    productChild.appendChild(childOfProduct)

    childOfProduct = root.createElement('Northing')
    childOfProduct.appendChild(root.createTextNode(Northing[i]))
    productChild.appendChild(childOfProduct)

    childOfProduct = root.createElement('Elevation')
    childOfProduct.appendChild(root.createTextNode(Elevation[i]))
    productChild.appendChild(childOfProduct)

    childOfProduct = root.createElement('Yaw')
    childOfProduct.appendChild(root.createTextNode(Yaw[i]))
    productChild.appendChild(childOfProduct)

    childOfProduct = root.createElement('Pitch')
    childOfProduct.appendChild(root.createTextNode(Pitch[i]))
    productChild.appendChild(childOfProduct)

    childOfProduct = root.createElement('Roll')
    childOfProduct.appendChild(root.createTextNode(Roll[i]))
    productChild.appendChild(childOfProduct)

xml_str = root.toprettyxml(indent="\t")
save_path_file = "test.xml"
with open(save_path_file, "w") as f:
    f.write(xml_str)