2
« on: September 26, 2018, 11:29:37 AM »
I am trying to create a batch process using python that automatically does the following things after that the project has been align, the correct coordinate system is set, sparse cloud optimized and any gound control oints has been pointed out. The project is also saved.
Build Dense Cloud
Build Mesh
Build DEM
Build Orthomosaic
Export DEM
Export Orthomosaic
Classify Ground Points
Build DEM (From only ground points)
Generate Report
Save Project
Decimate Mesh
Build Texture
Export model
As the project is already saved in a specified location this part is not correct:
project_path = "D:\\Processed\\"
project_name = "20171118LFF1a7RATX82_section"
The project_path should be read from the actual project path and the project_name from the already saved project name.
The have a if statement that is connected to the projects coordinate system. We want the filenames to have the coordinatesystem in text in the later exported files
Something like:
if PhotoScan.CoordinateSystem("EPSG::4326")
coordinatesystemtext = WSG 84
else if PhotoScan.CoordinateSystem("EPSG::4322")
coordinatesystemtext = WGS 72
import PhotoScan
doc = PhotoScan.app.document
#Set variables (Should be from already saved file)
[i]project_path = "D:\\Processed\\"
project_name = "20171118LFF1a7RATX82_section"[/i]
#build dense cloud
chunk.buildDenseCloud(quality = PhotoScan.High, filter = PhotoScan.AggressiveFiltering)
#build mesh
chunk.buildModel(surface = PhotoScan.HeightField, interpolation = PhotoScan.EnabledInterpolation, face_count=PhotoScan.MediumFaceCount )
#Build DEM
chunk.buildDem(source=PhotoScan.DenseCloudData, interpolation=PhotoScan.EnabledInterpolation)
#Build Ortho
chunk.buildOrthomosaic(surface=PhotoScan.ElevationData, blending=PhotoScan.MosaicBlending, color_correction=False)
chunk.exportDem(project_path + "DEM " + project_name + coordinatesystemtext + ".tif", image_format=PhotoScan.ImageFormatTIFF, format = PhotoScan.RasterFormatTiles, nodata=-32767, write_kml=False, write_world=True)
chunk.exportOrthomosaic(project_path + "Orthomosaic " + project_name + coordinatesystemtext + ".tif", image_format=PhotoScan.ImageFormatTIFF, format = PhotoScan.RasterFormatTiles, raster_transform=PhotoScan.RasterTransformNone, write_kml=False, write_world=True)
# MISSING Classify Ground Points
# MISSING Build DEM (From only ground points)
chunk.exportDem(project_path + "DTM " + project_name + coordinatesystemtext + ".tif", image_format=PhotoScan.ImageFormatTIFF, format = PhotoScan.RasterFormatTiles, nodata=-32767, write_kml=False, write_world=True)
# Missing Generate Report
#Save Project
doc.save()
# MISSING Decimate Mesh
# MISSING Build Texture
# MISSING Export model
print("Finished")