Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - AndrewNeubauer

Pages: [1]
1
Python and Java API / Exporting Chunks as Georeferenced Orthophotos
« on: July 16, 2014, 06:29:00 PM »
I am pretty new to python so please forgive me. What I am trying to achieve here is generate orthophotos for all chunks, generating a tif and kmz for chunks which name ends in "RGB" and just a tif for those that end in"NIR". The loop seems to be working correctly as it goes through everyone like it should but there is no file and the console says it exported at 0 x 0 pixels.

My Current Script:
Code: [Select]
from PhotoScan import *

print("This Script will export all chunks into the selected folder")

doc = PhotoScan.app.document


CoordinateSystemEPSG = "EPSG::4326"
CoordinateSystem = PhotoScan.CoordinateSystem()
CoordinateSystem.init(CoordinateSystemEPSG)

def getDir(name):
dir = PhotoScan.app.getExistingDirectory(name)
if dir == '':
print("Must provide a valid directory")
return
return dir


saveFolder = getDir("Select Save Folder")




print("---Exporting Orthoimage(s)...")

for chunk in doc.chunks:
file = saveFolder + "\\"  + chunk.label
print("File: " + file)

if chunk.label[-3:] == "RGB":
chunk.exportOrthophoto(file + ".tif", format="tif", blending="mosaic", projection=CoordinateSystem, dx=0.2, dy=0.2)
chunk.exportOrthophoto(file + ".kmz", format="kmz", blending="mosaic", projection=CoordinateSystem, dx=0.05, dy=0.05, write_kml= True)
elif chunk.label[-3:] == "NIR":
chunk.exportOrthophoto(file + ".tif", format="tif", blending="mosaic", projection=CoordinateSystem, dx=0.2, dy=0.2)
else:
app.messageBox("Exporting orthoimage failed: " + chunk.label)

The console spits out this (multiple times):
Code: [Select]
File: ****\** RGB
initializing renderer... tessellating mesh...done (335152 -> 335152 faces)
done in 0.338 sec
Raster size: 0x0
Finished processing in 0.355 sec (exit code 0)
initializing renderer... tessellating mesh...done (335152 -> 335152 faces)
done in 0.364 sec
Raster size: 0x0
Finished processing in 0.364 sec (exit code 0)
File: ****\** NIR
initializing renderer... tessellating mesh...done (342265 -> 342265 faces)
done in 0.295 sec
Raster size: 0x0
Finished processing in 0.295 sec (exit code 0)

Pages: [1]