31
Python and Java API / Re: Export Undistort cameras to new folder
« on: December 08, 2017, 07:20:48 PM »
I figured it out :-)
thats works
Code: [Select]
import PhotoScan
import os, sys
os.mkdir("F:\\Ps\\res_photo\\undisorted_done")
os.mkdir("F:\\Ps\\res_photo\\undisorted_done\\HD") #creation new directory 1st-undisorted_done, 2nd HD
my_dir = ("F:\\Ps\\res_photo\\undisorted_done\\HD")
chunk = doc.chunk #active chunk
for camera in chunk.cameras:
#camera = chunk.cameras[0]
currentCameraImage = camera.photo.image()
calibration = camera.sensor.calibration
undistortedCameraImage = currentCameraImage.undistort(calibration, True, True)
undistortedFullImageName = os.path.split(camera.photo.path)[-1]
undistortedImageName = os.path.splitext(undistortedFullImageName)[0]
save_img = os.path.join(my_dir,os.path.basename(undistortedImageName) + '_.jpg')
undistortedCameraImage.save(save_img)
thats works