Forum

Author Topic: Undistort Photos  (Read 18826 times)

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Undistort Photos
« on: May 10, 2013, 05:23:48 PM »
Ability to undistort single or multiple images based on calibration results. I realise this is available within photoscan once images are aligned, but sometimes i would like to be able to remove lens distortion for other purposes on individual images that can't be aligned in photoscan.

Thanks!

James

Kiesel

  • Sr. Member
  • ****
  • Posts: 332
    • View Profile
Re: Undistort Photos
« Reply #1 on: May 14, 2013, 07:28:16 PM »
+1

Yes and aligning is time consuming too. Or the possibility to undistort images within Photoscan based on camera calibration results without prior aligning.

Thanks!

Karsten


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14796
    • View Profile
Re: Undistort Photos
« Reply #2 on: May 17, 2013, 12:06:44 PM »
Hello James and Karsten,

Thank you for the suggestion, we are considering this option.

Currently undistort procedure can be performed in PhotoScan Pro without prior alignment using Python scripts.
Best regards,
Alexey Pasumansky,
Agisoft LLC

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: Undistort Photos
« Reply #3 on: May 20, 2013, 07:25:15 PM »
That's good to know, I am just dipping into the python script side of photoscan now.

Thanks

James

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14796
    • View Profile
Re: Undistort Photos
« Reply #4 on: May 31, 2013, 03:24:37 PM »
Hello once again,

I hope we'll be able to implement undistort functionality even for NA images in PhotoScan based on initial (or refined if available) calibration.

Currently it is possible to use the following script that saves the undistorted images to the user selected folder based on the user selected .xml file:

Code: [Select]
#Compatibility PhotoScan Pro 0.9.1
#No arguments required

import PhotoScan

doc = PhotoScan.app.document
chunk = doc.activeChunk

xml_path = PhotoScan.app.getOpenFileName("Please, select valid calibration xml file")
export_path = PhotoScan.app.getExistingDirectory("Please, specify the export folder")
PhotoScan.app.messageBox("Processing started.\nPress OK.")

calib = PhotoScan.Calibration()
calib.load(xml_path)


for photo in chunk.photos:
label = photo.label
image = photo.image()

uimage = image.undistort(calib, True, True)

PhotoScan.app.messageBox("Processing finished.\nPress OK.")
print("Script finished")
Best regards,
Alexey Pasumansky,
Agisoft LLC

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: Undistort Photos
« Reply #5 on: May 31, 2013, 03:58:25 PM »
That's fantastic I shall give it a go, thanks!

ebf

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Undistort Photos
« Reply #6 on: November 20, 2016, 11:32:05 PM »
I know this thread has been dead for a while, but I am also very interested in being able to undistort photos that I have not aligned. Has any progress been made towards this goal in the newer versions of Agisoft? I attempted to modified the above script to work with version 1.2.6 (see attached). It seems to be running with one catch: I get the message "please, select valid calibration xml file." What is this xml file? Where can I find it if I haven't aligned the image I want to "undistort." I am new to Agisoft and even newer to python, so any help would be much appreciated!

Thank you!


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14796
    • View Profile
Re: Undistort Photos
« Reply #7 on: November 21, 2016, 08:42:39 AM »
Hello ebf,

You should be able to undistort photos in the latest version of PhotoScan without the script, just basing on the Initial values of the Camera Calibration window.
Best regards,
Alexey Pasumansky,
Agisoft LLC