Hi Alexey,
I have a small problem again Alexey, my script for undistorted cameras works well, and now iv added second one to Resize
and save in new directory undistorted cameras and PhotoScan crashed , and do this each time when i put my script to the console.
My new script works well in python console but dsnt works in PhotoScan, could You check it for me please why , whats wrong with , did is a PhotoScan python library problem ??
Iv added Pilllow module to main python PhotoScan Library.
import os, sys
import PhotoScan
from PIL import Image
from os import listdir
from os.path import isfile, join
from PySide2 import QtCore, QtGui, QtWidgets
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)
mypath = "F:\\Ps\\res_photo\\undisorted_done\\HD"
os.mkdir("F:\\Ps\\res_photo\\undisorted_done\\LT")
noveaux_dir = "F:\\Ps\\res_photo\\undisorted_done\\LT"
dirs = os.listdir( mypath )
basewidth = 256
for im in dirs:
img = Image.open(join(mypath, im))
src_fname, ext = os.path.splitext(mypath + im)
wpercent = (basewidth / float(img.size[0]))
hsize = int((float(img.size[1]) * float(wpercent)))
img = img.resize((basewidth, hsize), Image.ANTIALIAS)
save_fname = os.path.join(noveaux_dir, os.path.basename(src_fname)+'_res.jpg')
img.save(save_fname)
Fast explication: my script work till last save (
im2.save(save_fname)), iv used print to debug it and he do all actions , but dont like SAVE mode, whats i can do Alexey

?