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 - cvernon3

Pages: [1]
1
Python and Java API / Externally Run Agisoft PhotoScan with Python
« on: June 13, 2017, 08:47:56 PM »
Hi, I've read a few posts about doing this but haven't been able to figure it out.

I can open agisoft externally no problem importing os and can essentially run the python scripts I want by clicking on the tools menu, the run script button, and then manually selecting the path I need to run the code I want; however, I would like to be able to simply tell a python program to first open agisoft, click the tools menu, click run script, and insert the path to my other scripts. In other words I would like to make it be fully automated

I was thinking that the command line might be a way to do this (or some type of macro), but was wondering if there is a simpler solution (ie. some function that clicks menu items that has already been made without having to import PhotoScan)

Thanks for the help!

-cvernon3

2
I am running code from http://www.agisoft.com/pdf/photoscan_python_api_1_1_0.pdf which is the pdf explaining the PhotoScan class that is read by the 'run 'script' button in agisoft. However, while some of the functions seem to work while attempting to automate exporting I have ran into a few problems:

I have tried using:

import PhotoScan

doc = PhotoScan.app.document
chunk = doc.chunk

as well as:

import PhotoScan

# Below are what is needed for the main processing steps on a project

doc = PhotoScan.app.document
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.MediumAccuracy, preselection=PhotoScan.GenericPreselection)
chunk.alignCameras()
chunk.optimizeCameras(fit_f=True, fit_cxcy=True, fit_aspect=True, fit_skew=True, fit_k1k2k3=True, fit_p1p2=True, fit_k4=False)
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation)
chunk.buildUV(mapping=PhotoScan.GenericMapping)
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=4096)

followed by:

# chunk.exportModel(r"C:\Users\(rest of path I want...)", binary=False, precision=6, texture_format='tif', normals=False, colors=False, cameras=True['']['ply']['NAD83(HARN) / UTM zone 12N (EPSG::3742)'][0,0,0])

# error that string indices must be intergers (this error shows up in other locations as well)
PhotoScan.PointCloud.export(r"C:\Users\(rest of path I want...)", format='ply'['EPSG::3742'])

# comes back as unscriptable 'bool'=False
chunk.exportPoints(r'C:\Users\(rest of path I want...)', binary=False, precision=6, normals=True, colors=False ['']['']['ply']['NAD83(HARN) / UTM zone 12N (EPSG::3742)'][0,0,0])

Unless there is some easy fix, I was thinking that access to a help function or running the python without opening agisoft and using the run script button would help.

Thanks for the Help!


Pages: [1]