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 - Alexey Pasumansky

Pages: [1] 2 3 ... 856
1
Hello eastonmbio,

If you need to apply some custom operation, which cannot be defined via Tasks/NetworkTasks classes, you should use RunScript task and integrate it to the workflow.

I have just posted an example of such pipeline, when it is necessary to open the project and configure the raster transformation, prior to the export operation, please check the code example here:
https://www.agisoft.com/forum/index.php?topic=13390.msg59677#msg59677

In the RunScript task you should open the project, perform the required operations and save the project.

2
Python and Java API / Re: Console output and stdout
« on: June 12, 2021, 04:16:28 PM »
Hello marg,

I think that the easiest way would be redirecting the script output from the OS command-line directly (providing that the script is started in headless mode):
Code: [Select]
metashape.exe -r script.py > output.txt 2>&1

3
Hello Adam,


I have prepared the script prototype for the processing workflow + export operations, assuming that the project with the added images and coordinate information already exists.
Code: [Select]
import Metashape, sys
SERVER_IP = "192.168.10.10"

root = "//NAS1/datasets" # can be passed as a script argument if required #root = sys.argv[1]
Metashape.app.settings.network_path = "//NAS1/datasets"
project_path = "/processing/temp/project.psx" #relative path to project #project_path = sys.argv[2] #can be defined as script argument
output_folder = root + "/processing/export/" #absolute path to output folder for exports
doc = Metashape.Document()
doc.open(root + project_path) #loading existing project using relative path from the root
chunk = doc.chunk #active chunk of the project

tasks = []
#processing tasks
task = Metashape.Tasks.MatchPhotos()
task.downscale = 1
task.keypoint_limit = 40000
task.tiepoint_limit = 10000
task.generic_preselection = True
task.reference_preselection = True
tasks.append(task)

task = Metashape.Tasks.AlignCameras()
tasks.append(task)

task = Metashape.Tasks.OptimizeCameras()
tasks.append(task)

task = Metashape.Tasks.BuildDepthMaps()
task.downscale = 4
task.filter_mode = Metashape.MildFiltering
tasks.append(task)

task = Metashape.Tasks.BuildDenseCloud()
tasks.append(task)

task = Metashape.Tasks.BuildDem()
task.source_data = Metashape.DenseCloudData
tasks.append(task)

task = Metashape.Tasks.BuildOrthomosaic()
task.surface_data = Metashape.ElevationData
tasks.append(task)

#export tasks
task = Metashape.Tasks.ExportRaster()
task.path = output_folder + '/dem.tif'
task.source_data = Metashape.ElevationData
tasks.append(task)

task = Metashape.Tasks.ExportRaster()
task.path = output_folder + '/orthomosaic_default.tif'
task.source_data = Metashape.OrthomosaicData
task.raster_transform = Metashape.RasterTransformType.RasterTransformNone
task.save_alpha = False
tasks.append(task)

task = Metashape.Tasks.RunScript() #switching raster transformation in the project
task.code = 'import Metashape\ndoc = Metashape.Document()\ndoc.open(Metashape.app.settings.network_path + "' + project_path + '", ignore_lock = True)\nchunk = doc.chunk\nchunk.raster_transform.formula = ["(B4-B2)/(B4+B2)"]\nchunk.raster_transform.enabled = True\ndoc.save()\n'
tasks.append(task)

task = Metashape.Tasks.ExportRaster()
task.path = output_folder + '/orthomosaic_NDVI.tif'
task.source_data = Metashape.OrthomosaicData
task.raster_transform = Metashape.RasterTransformType.RasterTransformValue
task.save_alpha = False
tasks.append(task)


#converting tasks to network tasks
network_tasks = []
for task in tasks:
if task.target == Metashape.Tasks.DocumentTarget:
network_tasks.append(task.toNetworkTask(doc))
else:
network_tasks.append(task.toNetworkTask(chunk))

client = Metashape.NetworkClient()
client.connect(SERVER_IP) #
batch_id = client.createBatch(doc.path, network_tasks)
client.resumeBatch(batch_id)

Upon working on the script we have figured out that it would be helpful, that toNetworkTask and createBatch calls could automatically consider root path, this has been implemented in the version 1.7.4 build 12511 (pre-release), therefore I suggest to use the pre-release version when checking the script:
http://download.agisoft.com/metashape-pro_1_7_4_x64.msi
http://download.agisoft.com/metashape-pro_1_7_4.dmg
http://download.agisoft.com/metashape-pro_1_7_4_amd64.tar.gz
If the script is used with 1.7.3 release version, the script requires modification in the parts related to the paths.

4
Hello ppant,

The specified message "Unsupported format: .tif" could be related to export points or export tiled model operations only, so I suggest to check, that in those operations correct file extension is used. As it seems, that the error appears in another block of code.

5
Hello danimlk,

For buildModel operation which uses depth maps data as a source, I suggest to add the following lines for the vertex colors calculation:

Code: [Select]
colorizeModel = Metashape.Tasks.ColorizeModel()
colorizeModel.source_data =Metashape.DataSource.ImagesData
colorizeModel.apply(chunk)

6
Hello ppant,

The same code worked fine in 1.6.6 version as well.

Do you observe the same behavior on any project or if the issue is specific to the certain project only? Do you observe the same problem after re-starting Metashape instance and using only the lines that you have provided for any multispectral project?

7
Hello ppant,

I've just copied your code to the Console pane for the random multispectral project (had to perform chunk variable initialization, though), and it worked as expected without the reported error.

I have used 1.7.3 release version. Please check, if you observe the error on your side in the latest release version. I can also suggest to check, if the problem persists after Metashape re-start.

8
Python and Java API / Re: exportPoints() deletes cloud
« on: June 10, 2021, 08:46:23 PM »
Hello forumname,

Does it help, if you add the following line to the final loop before the export line:
Code: [Select]
doc.save()

9
Python and Java API / Re: exportPoints() deletes cloud
« on: June 10, 2021, 02:05:12 PM »
Hello forumname,

I am not observing such behavior on random project with the dense point cloud.

Please specify, which Metashape version you are using and whether you observe similar behavior if you try to export point using application GUI?

10
General / Re: project loading error
« on: June 09, 2021, 07:41:38 PM »
Hello Maxime,

Can you please provide the information from the Console pane related to the error (if there's any sensible part in the paths, you can manually remove it before posting)?

I would assume that the problem could be related to the corrupted information related to the shapes, but cannot say for sure, based on the provided screenshot only.

Additionally please specify, if there's any specific reason, why you are using very old PhotoScan Pro version.

11
Hello belinda,

I suggest to check the latest release version (or at least 1.6.6 version), as the issue seems to be related to the already fixed bug.

12
General / Re: build mesh from depth maps vs dense cloud
« on: June 07, 2021, 09:11:56 PM »
Hello JJ,

Which settings you are using for the both approaches (parameters in Build Dense Cloud and Build Mesh dialog)?

I think that the extrapolated parts could be filtered out and removed by the confidence filter for the depth maps based mesh generation approach.

13
Hello JJ,

For fisheye lens it is strongly suggested to switch the camera type for the related camera calibration groups in Tools Menu -> Camera Calibration dialog to Fisheye prior to the camera alignment procedure.

14
General / Re: How to update tiled model coordinates ?
« on: June 07, 2021, 02:59:26 PM »
Hello cyrilp,

Yes, it should work in that way.

15
Hello kirk,

If you shrink the bounding box to the area of interest, you would be able to run Build Mesh operation with "reuse depth maps" option enabled. Mesh will be generated only within the selected region.

Pages: [1] 2 3 ... 856