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

Pages: [1] 2 3
Hi there,

I'm trying to output a rendered depthmap for specific coordinates, and was hoping to achieve that with "renderdepth" pointing at the point cloud... however based on my tests it seems like this just outputs a rendered image of the colored dense cloud, with the same behavior as renderImage. Is this the expected behavior or am I doing it wrong?

my code to export a depthmap of the PC:
Code: [Select]
    depth = chunk.dense_cloud.renderDepth(t, my_sensor_calibration, point_size=1, resolution=1, cull_points=False, add_alpha=True) + str(name) +"_depth.png")

To render an image of the PC:
Code: [Select]
image = chunk.dense_cloud.renderImage(t, my_sensor_calibration, point_size=dense_pc_size_for_export, resolution=1, cull_points=True, add_alpha=True) + str(name) +".png")


Nope, my bad... I messed up the assignment of the images  ;D

Python and Java API / problem with license activation in 1.8.1
« on: February 28, 2022, 04:24:23 PM »
Hey there,

I have an installed version of 1.8.1 activated with a full license on my machine. Now I'm trying to manipulate some files without the GUI using the stand-alone python lib.
This worked previously with version 1.8.0 on the same machine.

Now since I updated the lib I get "No license found."  Ok, so I tried to activate in a python script by calling
Code: [Select]

And I get this error:

Code: [Select]
TypeError: descriptor 'activate' for 'Metashape.Metashape.License' objects doesn't apply to a 'str' object
Based on the docs it seems like I should be passing a string:

Code: [Select]
class Metashape.License
License information.
Activate software online using a license key.
Parameters key (string) – Activation key.

Any ideas what I am missing here?


Python and Java API / where is image quality stored?
« on: February 24, 2022, 04:48:29 PM »
Hi guys,

I'm looking for the metadata value that used to be stored under camera.meta["Quality"]  after calling chunk.analyzePhotos(camera) ... it seems like it's no longer there? I can't find where to look from the API docs.


Feature Requests / Lighting in "renderImage"
« on: February 23, 2022, 03:20:33 PM »
Hey there,

I'd love to have the ability to create a spot light / directional light / point light or something similar to light textured meshes, and have this light be activated / deactivated via API when calling chunk.model.renderImage()


Python and Java API / Creating virtual cameras
« on: February 15, 2022, 06:59:02 PM »
Hi there,
I'm trying to create some virtual cameras at locations specified by point coordinates over my mesh, in order to use these cameras to export images of the mesh.

To create these cameras I'm trying this:

Code: [Select]
i = 0
for point in points:
    tmp_sensor = chunk.addSensor()
    tmp_sensor.label = str(i)
    tmp_sensor.location = Metashape.Vector(point)
    tmp_sensor.location_enabled = True
    tmp_sensor.rotation = Metashape.Vector([0,0,0])
    tmp_sensor.rotation_enabled = True

However it seems I cannot assign a location to a sensor in this way:

Code: [Select]
2022-02-15 16:56:26 Error: 'Metashape.Sensor' object attribute 'location' is read-only
Does anyone know what the correct way to create such virtual sensors might be?


Bug Reports / Memory leak? in 1.8 and 1.8.1 on linux
« on: February 15, 2022, 05:07:18 PM »
Hey there,

I am running a couple of big projects right now with >50000 cameras. To complete them I first do a rough alignment of the complete system, then split the work area into smaller pieces and rung my own processing on each chunk. This is all fully automated.

I've been running into an issue however: my script seems to crash when it gets to a certain number of iterations / processed chunks, and this seems to be related to the amount of RAM available.

When I run a project on a 32Gb RAM machine it will gradually fill up the RAM available after doing maybe 20 to 30 chunks, and photoscan crashes. On a machine with 128Gb of ram I can do more than 100 chunks, but the RAM still fills up gradually with the first chunk processing the dense cloud using about 20Gb, then going up to >100Gb in the later chunks.

I am not storing any large arrays or values in RAM for my own processing, and there is nothing else running on this machine... so I suspect Photoscan is not clearing something... I will reporte here if I find out more.


Python and Java API / How to use releaseFreeMemory() on Linux
« on: January 24, 2022, 05:56:31 PM »
Hey there,

As the title implies: does anyone know how to use releaseFreeMemory() ? I'm curious what that is for.


Python and Java API / why is removing cameras so slow?
« on: January 24, 2022, 04:40:31 PM »
Hey guys,

I'm running a script that copies a chunk, then based on some calculations removes cameras from a chunk.
First the cameras are disabled.
Then the disables cameras are removed.
Something like this:

Code: [Select]

for camera in [some_list]:
    camera.enabled = False

For some reason: the "camera.enabled = False" works in 1/10th of a second, no problem.

When I add the "chunk.remove(camera)" it takes FOREEEEEVER.  Like 15 minutes to go through my chunk...

Any idea why this behaves in such a way? Or what I can do to speed it up?


Python and Java API / classifyPoints target class change in 1.80 ?
« on: January 12, 2022, 05:34:35 PM »
Hey there,

I was using this script in 1.7.5:

chunk.dense_cloud.classifyPoints(source=4, target=(5,10,11,16,6,20,15,14,19), confidence=0.01)

It seems that this fails in 1.8.0 with this error:

2022-01-12 15:31:40 RuntimeError: Unsupported target class
2022-01-12 15:31:40 Error: Unsupported target class

I don't see any changes in the API documentation... does anyone know what has changed here?


Python and Java API / Filter cameras by chunk tie points
« on: January 11, 2022, 05:15:45 PM »
Hey guys,
I'm certain that there is a smart way to do this, and I have a feeling I had solved this once before but I can't find the code anymore... What I need to to define the reconstruction area of a chunk and remove all the cameras that are not relevant for that reconstruction area (in order to save that as a sub-chunk but not duplicate the cameras). Any ideas how to do this?

Python and Java API / how to get metashape version from Python package?
« on: January 03, 2022, 05:51:57 PM »
Hey there,

This is nothing urgent, but I was wondering whether there is a way to get the version of the current version of Metashape after import in Python.

From my test (image attached) I can't find any basic variable that would be for "version", but am I missing something?


Python and Java API / catching "out of disk space" errors in pyhon API
« on: January 02, 2022, 04:29:50 PM »
Hi there,

I have a reconstruction that has been failing a few times in a row. I ended up setting up a script that logged free disk space during the process and I think this is what is failing: my computer is running out of space and Metashape crashes... however there is nothing in the python script log or shell output that would indicate this.
This is the tail of the shell output

Code: [Select]
Found 1 GPUs in 0.00085 sec (CUDA: 0.000152 sec, OpenCL: 0.000681 sec)
Using device: NVIDIA GeForce RTX 3090, 82 compute units, free memory: 23820/24267 MB, compute capability 8.6
  driver/runtime CUDA: 11040/8000
  max work group size 1024
  max work item sizes [1024, 1024, 64]
8920568 matches found in 55.5983 sec
matches combined in 1.01701 sec
filtered 1043774 out of 4918130 matches (21.223%) in 1.83047 sec
saved matches in 0.018059 sec
loaded matching data in 0.001176 sec
loaded matching partition in 0.012572 sec
loaded keypoint partition in 0.000253 sec
loaded matches in 11.8576 sec
setting point indices... 168390005 done in 22.7045 sec
generated 168390005 tie points, 3.75358 average projections
removed 5084558 multiple indices
removed 67880 tracks
removing stationary tracks...

So my question is this: in order to verify my hypothesis that disk space is killing this process, Is there are way in the Python API that I can catch an "out of space" error that is not being thrown to the shell console?


Python and Java API / Dense cloud classes to vertex colors
« on: December 13, 2021, 05:10:27 PM »
Hi guys,
I realise this workflow may sound a little exotic, but here goes... I need to find a way to convert the "classes" of my dense clouds to vertex colors of my mesh, or at least colorize my mesh based on these classes.

On way to do this would be to export the mesh, export the dense point cloud in segments based on classes, calculate distances and colorize based on proximity... but this is clunky and slow, and I was wondering whether someone might have a workflow to do this directly in Metashape...?


Python and Java API / place markers in corners of bounding box
« on: October 22, 2021, 08:10:40 PM »
Hey there,

I'm trying to do something that should be simple, but I'm messing up and I can't figure out where...

The objective is this: to automatically place a marker in the corners of the bounding box, in order to export the GPS coordinates of the 8 corners.

My basic idea is this code below:

Code: [Select]
chunk =
center =

size = chunk.region.size

corner0 = [[0]-(0.5*chunk.region.size[0]),[1]-(0.5*chunk.region.size[1]),[2]-(0.5*chunk.region.size[2])]


I get the region size & center, then find a corner by removing half the size on each axis from the center... but this fails and places markers somewhere outside of my map. I have a feeling I'm doing something stupid here but I can't figure this out!

Any help would be much appreciated!


Python and Java API / Using "sequential" preselection in the python API
« on: September 25, 2019, 10:10:51 AM »
Hi there,

Is this function not yet covered in the python API?  It looks like I can define

generic_preselection=True, reference_preselection=True,

... but as far as I can see I cannot define specifically to use "sequential mode". Is that right or am I looking in the wrong place?


Pages: [1] 2 3