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.


Messages - rananna

Pages: [1]
1
Python and Java API / Masks_From_Color.py
« on: December 13, 2017, 08:05:05 PM »
http://wiki.agisoft.com/wiki/Masks_From_Color.py
This is a great script that works very well.
One request though.
Would it be possible to add colors to the selection, each with their tolerance?
One way to do this is to preserve the existing mask when creating a new mask from color.
This would effectively allow for an additive selection.
You would run this script with one color and then run it again with another color and the mask would be additive reflecting the two pass approach.
Anyone know how to modify the script to accomplish this?
Perhaps there is another way to accomplish this?

2
General / Re: Agisoft PhotoScan 1.4.0 pre-release
« on: December 12, 2017, 01:36:36 PM »
Could you please explain what the “refine mesh” command is doing?
Ie: how is it exactly changing the mesh?

3
Python and Java API / Re: can anyone help with this error?
« on: December 04, 2017, 08:10:18 PM »
thank you!
This worked.

4
Python and Java API / can anyone help with this error?
« on: December 04, 2017, 05:21:59 PM »
I am tearing my hair out trying to get python to prompt for information.
I keep getting the following error:
2017-12-04 09:18:40 usage: batch.py [-h] -i INPUT -p PSZ -o OUTPUT -r RESOLUTION
2017-12-04 09:18:40 batch.py: error: the following arguments are required: -i/--input, -p/--psz, -o/--output, -r/--resolution
2017-12-04 09:18:40 Error: 2
>>>
here is an excerpt from my python script:

def parse_args():
   parser = argparse.ArgumentParser(description="Input/Output folder to save 3D model")
   #parser.add_argument('--inputpath', '-p', action="store", help="path to photos", required=True)
   #parser.add_argument('--outputfile', '-o', action="store", help="output file name", required=True)
   parser.add_argument('-i','--input',help='Input Photos Path',required=True)
   parser.add_argument('-p','--psz',help='psz file name',required=True)
   parser.add_argument('-o','--output',help='Output Folder Path',required=True)
   parser.add_argument('-r','--resolution',help='Output Ortho Resolution',required=True,type=float)
   return parser.parse_args()
def main():
   print("Script is starting")
   args = parse_args()
   print("args.input")
   print("args.psz")
   print("args.output")

5
Python and Java API / Re: batch python script
« on: December 03, 2017, 06:54:12 PM »
That was it!
Thank you for the prompt reply!

6
Python and Java API / Re: batch python script
« on: December 03, 2017, 06:34:38 PM »
Great! Thanks for this.
The script start to run and loads the files.
However, I am now getting this error:
Error: module 'PhotoScan' has no attribute 'PointsSource'
Any ideas?

7
Python and Java API / batch python script
« on: December 03, 2017, 04:57:03 PM »
my batch script keeps failing with "Error: module 'PySide2.QtGui' has no attribute 'QApplication'"
How can I fix this?
Here is the script:

import os,re,sys
import PhotoScan
from PySide2 import QtWidgets
from PySide2 import QtGui




def main():

   global doc
   doc = PhotoScan.app.document

   app = QtGui.QApplication.instance()
   parent = app.activeWindow()
   
   #prompting for path to photos
   path_photos = PhotoScan.app.getExistingDirectory("Specify input photo folder:")
   path_export = PhotoScan.app.getExistingDirectory("Specify EXPORT folder:")
   
   #processing parameters
   accuracy = PhotoScan.Accuracy.HighAccuracy  #align photos accuracy
   preselection = PhotoScan.Preselection.NoPreselection
   keypoints = 0 #align photos key point limit
   tiepoints = 0 #align photos tie point limit
   source = PhotoScan.PointsSource.DensePoints #build mesh source
   surface = PhotoScan.SurfaceType.Arbitrary #build mesh surface type
   quality = PhotoScan.Quality.HighQuality #build dense cloud quality
   filtering = PhotoScan.FilterMode.ModerateFiltering #depth filtering
   interpolation = PhotoScan.Interpolation.EnabledInterpolation #build mesh interpolation
   face_num = PhotoScan.FaceCount.HighFaceCount #build mesh polygon count
   mapping = PhotoScan.MappingMode.GenericMapping #build texture mapping
   atlas_size = 8196
   blending = PhotoScan.BlendingMode.MosaicBlending #blending mode
   color_corr = False


   print("Script started")

   #creating new chunk
   doc.addChunk()
   chunk = doc.chunks[-1]
   chunk.label = "New Chunk"

   #loading images
   image_list = os.listdir(path_photos)
   photo_list = list()
   for photo in image_list:
      if ("jpg" or "jpeg" or "JPG" or "JPEG") in photo.lower():
         photo_list.append(path_photos + "\\" + photo)
   chunk.addPhotos(photo_list)

   #align photos
   chunk.matchPhotos(accuracy = accuracy, preselection = preselection, filter_mask = False, keypoint_limit = keypoints,    tiepoint_limit = tiepoints)
   chunk.alignCameras()
   
   chunk.optimizeCameras()
   doc.save()

   #building dense cloud
   #PhotoScan.app.gpu_mask = 1  #GPU devices binary mask
   PhotoScan.app.cpu_enable = True  #CPU enable
   chunk.buildDenseCloud(quality = quality, filter = filtering)
   doc.save()

   #building mesh
   chunk.buildModel(surface = surface, source = source, interpolation = interpolation, face_count = face_num)
   doc.save()

   #build texture
   chunk.buildUV(mapping = mapping, count = 2)
   chunk.buildTexture(blending = blending , color_correction = color_corr, size = atlas_size)
   doc.save()

   PhotoScan.app.update()

   #export
   
   chunk.exportModel(path_export + "\\model.obj", format = "obj", texture_format='jpg')

   print("Script finished")


PhotoScan.app.addMenuItem("Custom menu/batch process", main)   

Pages: [1]