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

Pages: [1]
1
Python and Java API / Get the document a chunk belongs to
« on: August 24, 2023, 12:47:27 PM »

I know this will sound a bit silly, but I'd like to know the document a certain chunk belongs to. I know that to get a chunk I must have got it but in my code, the document is actually not exposed in my scope.
I'm doing something like:

Code: [Select]

chunk = get_chunk_from_file(filename, chunk_type)

...
do some other stuff
...

It turns out that now I actually need a reference fo the Docuoment.

Any clues on this?

2
Python and Java API / Black texture when texturing imported model
« on: February 08, 2023, 05:05:31 AM »
Hi,

We are trying to texture an imported model in Metashape.

We import a PLY model using
Code: [Select]
chunk.importModel(transformed_filename, Metashape.ModelFormat.ModelFormatPLY)
We texture it using

Code: [Select]
chunk.buildUV(mapping_mode=Metashape.GenericMapping, page_count=1, texture_size = config.DEFAULT_TEX_SIZE*2)
chunk.buildTexture(blending_mode=Metashape.MosaicBlending, texture_size = config.DEFAULT_TEX_SIZE*2)

But the result is a dark gray color (there doesn't seem to be any error from Metashape's output)

Here, the DEFAULT_TEX_SIZE is 4096
The model has 56148 vertices and 112360 faces.

The model is correctly positioned in space it doesn't seem to be a positioning problem. Any clue on what's the problem here?

3
General / [Urgent] Older installer
« on: January 12, 2023, 02:21:55 PM »

I've noticed that Metashape 2.0 is out. It breaks our workflow scripts (which are based in MS 1.8 python API). I was surprised to see that there is no link to older installers. Please provide them! People have systems based on older versions!

In our case, the new function names (exportPoints -> exportPointClouds, etc... ) break our functionality. We run scripts in several workstations and we cannot update right now.

I currently need a MacOS 1.8.4 installer, but we run machines on Linux and Windows, so we'd like installers to be available for other platforms too.

We use both the GUI and Python API

Please!!!

4
Hi,

When I use
Code: [Select]
chunk.exportCameras I notice only the focal length is exported under the sensor element of the xml file  How to get the rest of the calibration parameters? (e.g. cx, cy, k1, etc...)
The same applies when I use
Code: [Select]
calibration.save().

I noticed that when I export from the GUI, all the parameters are written....

Best,

Sergio

5
General / Get best matching photos
« on: December 05, 2022, 03:02:36 AM »
As I understand, in the "AlignPhotos" step Metashape finds the best matching camera pairs (probably the ones the share the most SIFT points). Is it possible to get a list of these? e.g. For a given photo I'd like to have it's 10 best camera pairs (= the 10 photos that share the most SIFT points with that photo).

Is something similar to that possible in Metashape?


6
Python and Java API / Export .pts pointcloud with more decimals
« on: July 29, 2022, 10:47:24 AM »
Hi,

I'm exporting my sparse pointcloud (tie-points) with

Code: [Select]
chunk.exportPoints("/workspace/test_datasets/test_trainopts/project_files/points_dense.pts", source_data = ms.DataSource.PointCloudData)
My output file is

Code: [Select]
32610       
-0.210 0.224 -2.620 33 77 12 29
-0.240 0.193 -2.628 101 133 86 99
-0.086 0.246 -2.872 30 86 5 16
-0.178 0.210 -3.530 42 128 0 33
-0.597 0.087 -3.608 191 212 189 146
-0.514 0.079 -3.618 188 209 186 143
...

I'd like to have more decimal places in output file, but there is no option for that in the exportPoints function.
How would I go for that?

Best,

Sergio

7
Python and Java API / Depthmaps are null after BuildDepthmaps
« on: July 11, 2022, 02:44:18 PM »

In our application we copy a chunk into another chunk, modify its poses, and then build the model on both. However, on the second chunk depthmaps appear to be null (but the model is built correctly on the original chunk). Why does this happen?

Code: [Select]

if chunk.depth_maps is None:
        print("Chunk has no depthmaps, computing with default values downscale=2, filter_mode=Metashape.AggressiveFiltering ")
        chunk.buildDepthMaps(downscale=2, filter_mode=Metashape.AggressiveFiltering)
        doc.save()

    chunk.buildModel(surface_type=Metashape.Arbitrary, source_data=Metashape.DepthMapsData, interpolation=Metashape.EnabledInterpolation)
   



8
Hi,

We use Docker containers as a core part of our workflow. We often deactivate an MS license on a container, and then reactivate on another container. But, what would happen if we activate a license on a container, and then remove it without deactivating the license first? Are we doomed? This would be a very complicated issue for our product.

Best,

Sergio

9
Hi,

In our application we are running Metashape tasks in a docker container.
I noticed that every time I stop and start the docker, I get a license error (wrong host for license), so I have to deactivate and reactivate it again. This is not a problem for testing, but it will be a problem when deploying our app. What's the best way of running a containerized application? Should I activate the license in the docker before running the application and then deactivate it after the application is done? I would prefer not to include the license number in the code. Also, if we use this option, we will not be able to run our tasks in parallel (license will be limited to one docker instance).

Any advice on this?

10
Hi,

I am trying build a mesh from an imported pointcloud. I have correctly defined the bounding box so that the points are inside it (I have around 1million points). With any interpolation option, I get the "empty surface" error message. I've tried both using the GUI and by repeating this process on the python API, with no success...

Any help would be greatly appreciated.

11
Python and Java API / Proper workflow for depthmap replacement
« on: July 01, 2021, 04:18:02 AM »
Hi,

In our application we want to use Metashape with depthmaps generated externally. So far our processing is the following:

1. We build our depthmaps in the "standard" way:

addPhotos>>matchPhotos>>alignCameras>>buildDepthMaps

2. Then we change the depthmaps using:
[pseudocody...]
Code: [Select]
for cam, our_depth_image in zip(cameras, our_depths):
   
    if cam in chunk.depth_maps.keys():
        ms_dm = chunk.depth_maps[cam]

        if replace_depth:

            byte_image = our_depth_image .tobytes()
            ms_image = ms_dm.image()
            ms_dm.setImage( ms_image.fromstring(
                byte_image,
                w, h,
                channels=ms_image.channels,
                datatype=ms_image.data_type))


    else:
        print(cam)
        print("Camera has notdepthmap")   

3. Finally, we build the model:

Code: [Select]
chunk.buildModel(surface_type=Metashape.Arbitrary, source_data=Metashape.DepthMapsData, interpolation=Metashape.EnabledInterpolation)
When the model is saved to .psz we see the depthmaps have been replaced correctly, however, the model does not have the expected results. I wonder if we are missing something in the process (e.g. depth scaling, or some other processing step that should be done in this kind of workflow)

Best,

Sergio

Pages: [1]