Dear all,
I am trying to use Photoscan to generate point clouds and ortho from over 1500 aerial images. The size of one image is almost 1GB, hence my plan is to divide the photos into chunks, process each chunk, allign chunks and export point clouds and orthos.
I tried to write a script to do everything, but there are some issues I cannot overcome. Below I attached what I came up so far. The script loads 2 photos only (as a test), aligns photos and creates a point cloud. The problem is that the coordinates are completely off, the whole area is upside down.
I'd appreciate any help.
import PhotoScan
app = PhotoScan.Application()
doc = PhotoScan.app.document
# Define: Camera calib file
CalibFile = "D:/cam.xml"
# Define: Orientation file
OrientationFile = "D:/Geolocation_DD_All_UTM.txt"
CoordinateSystem = PhotoScan.CoordinateSystem("EPSG::32611")
chunk = doc.addChunk()
chunk.label = "New_Chunk"
chunk.crs = CoordinateSystem
#create a list of photos to add to the chunk
AerialImageFiles = ["D:/G1505007_001_0001_rgbn.tif","D:/G1505007_001_0002_rgbn.tif"]
#add photos to chunk
chunk.addPhotos(AerialImageFiles)
cam = chunk.cameras[0]#PhotoScan.Camera()
cam.open(AerialImageFiles[0])
sensor = chunk.addSensor()
sensor.label = "MyCamera"
sensor.pixel_height=0.0056
sensor.pixel_width=0.0056
sensor.focal_length = 92
sensor.user_calib = PhotoScan.Calibration()
c = PhotoScan.Calibration()
c.load(CalibFile)
sensor.user_calib = c
sensor.fixed = True
chunk.loadReference(OrientationFile, format="csv", delimiter=",")
#align
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, keypoint_limit=80000, tiepoint_limit=80000, preselection=PhotoScan.GenericPreselection)
chunk.alignCameras()
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)