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

Pages: [1] 2
Python and Java API / Can't work in headless anymore
« on: November 07, 2023, 06:54:38 PM »

I've started working again on my automatic headless processing after a few months, but it seems nothing works anymore. When trying to open and save a document, I have several errors such as "saving disabled" and "no license found". However, the path to AGISOFT_license is set in the environment variables, and the GUI says my Professional license is indeed activated. True, recently I have made some tests with newer versions of Metashape, but I have reinstalled 1.8.4 since. Also, I have moved my script folder from C:/ to F:/, but I'm not sure why this should be a problem. Also, my Python interpreter is 3.8.

At last, inside VScode, I've tried Metashape.License.activate('key') but I have this error

Code: [Select]
    + CategoryInfo          : ObjectNotFound: (Metashape.License.activate:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

How can I fix this and set everything back as it used to work?

EDIT : I think I found the problem : I had to reinstall the proper Python wheel, because the wheel for 2.0 was still up. I'm leaving this here anyway in case someone else encounters the problem!

Thank you

General / Re: Nice results using a ring flash!
« on: October 04, 2023, 04:07:53 PM »
Hey Alexey!

Thank you for your answer, sorry I hadn't seen it before.

I'll have a look at the video (I have an indoor setting though, not oudoor, sorry I should have mentioned that before)


General / Re: Nice results using a ring flash!
« on: August 24, 2023, 12:56:32 PM »
@hengefjes hello, thank you for all this information. I've asked my company to buy me that flash, but I kind of struggle to have good results with it. I mostly have problems of fall off, with too much contrast and directional lighting on the object. I f I crank the power of the flash up, it ends up overexposed.

I was wondering what power you were setting your flash on while shooting? I mostly work around 1/16 - 1/32, with f22, ISO100-250 and shutter 1/60

Thank you and I hope you're still around 7 years later!

Python and Java API / Re: Select points according to masks
« on: June 01, 2023, 11:52:26 AM »
Hello again!

I wanted to say that your solution works great, so thank you again! However I would add a small recommendation for any who would be interested in cleaning the dense cloud automatically this way. You need to actually make a loop where you first select the points, and then delete them, then go to the next iteration of the loop.

Here's my code:

Code: [Select]
point_cloud = doc.chunk.point_cloud

            for i in doc.chunk.cameras:
      'Currently cleaning the point cloud, hang on')


                except Exception:
                    log.error('There was no point selected, moving on')

The "try except" block is there to prevent the code from crashing when, for some reason, no point is selected. I tried in the API to find a way to get a list of the points that are currently selected, but I didn't find it (if anyone can enlighten me on that point, that would be great  :) ). I do think it would be more optimized to make a list of the selected points and add a condition that checks whether the list is empty or not.

Anyway, thanks again,

Dr Popi

Python and Java API / Re: Select points according to masks
« on: May 15, 2023, 09:14:44 PM »
Hi Alexey!

Thank you very much, I'll give this a try this week and let you know  ;)

Kind regards,

Dr Popi

Python and Java API / Re: Building dense Point Cloud
« on: May 15, 2023, 10:54:45 AM »

From my humble observation, it seems that the buildPointCloud function automatically creates DepthMaps (which are High Quality by default, that is to say downscale = 1 if I'm not mistaken). I tried calling the buildDepthMaps function right before the buildPointCloud, and the result is exactly the same as if I had just called the buildDepthMaps function.

So my answer would be that calling the Depth Maps function allows you precisely to change the parameters of the depth maps that are going to be built. If you're satisfied with the default parameters, then you don't need to call it.

Hope I'm not mistaken :)

Take care,

Dr. Popi

Python and Java API / Select points according to masks
« on: May 15, 2023, 10:51:48 AM »
Hey there!

I am looking for a way to automatically extract the reconstructed model from the artefacts. I was wondering if there's a way to select points from the point cloud according to the masks generated on the images? Like for each mask, ask Metashape to select the points situated in the white part of the image, according to the camera position.

Thank you!

Dr Popi

Python and Java API / Re: Gradual selection by model confidence
« on: May 15, 2023, 10:46:43 AM »
Hello ! If I understand your need correctly, maybe you could go through the Filter by Confidence function? I used it myself through Python in order to clean Points Clouds before merging them.

I did something like this:

Code: [Select]
point_cloud = doc.chunk.point_cloud
point_cloud.setConfidenceFilter(min ,max)

In your case you might be able to set the min and max to 20.

Hope it will work :)

Dr. Popi

Hey again!

So after a bit of fumbling around, I think I have managed to find a compromise. I'm sharing the new instruction here for those interested, although I'm still not sure it will work extensively for all cases. I still need to test it further, I will update any new findings here if needed  :) However in the meantime, if any one of you has another solution pertaining the primary question, please feel free to share!

Code: [Select]
doc.alignChunks(chunks=[0, 1],method=0, downscale=1, fit_scale=True,filter_mask=True, mask_tiepoints=False, keypoint_limit=150000,generic_preselection=True)

Hi Paulo!

Thank you for your answer. :) I tried that but it doesn't seem enough. More precisely, I tried this :

Code: [Select]
doc.alignChunks(method=0, downscale=1, fit_scale=False,filter_mask=True, mask_tiepoints=False, keypoint_limit=150000,generic_preselection=True)
The manual step works well, but this code written in the console doesn't... Any other ideas? :(

Hello ! I'm developing a headless process to reconstruct and merge two parts of a shoe. In the align chunk parameters, I would like to use the "Apply Masks = Key points", but I am a bit confused by the API. The two parameters that seem to deal with that are:

• filter_mask (bool) – Filter points by mask.
• mask_tiepoints (bool) – Apply mask filter to tie points.

Must I use the filter mask? Or am I missing something?

Thank you!

Python and Java API / Export model in GLB with ALL maps
« on: April 12, 2023, 03:24:09 PM »
Hello there!

I am trying to make an automatic script that exports my model in .GLB with all the textures (diffuse, but also normal, occlusion and displacement). However, as was noticed in this post (, currently when you export a GLB model manually, it just gives you the diffuse map.

Is there a way to force it to embed the normal, occlusion and displacement as well in the GLB export?

Many thanks!

Best Regards,

General / Re: Decimation / Texture Rebake
« on: February 24, 2023, 07:19:38 PM »
Hey Alexey !

Thank you, it works perfectly!



General / Decimation / Texture Rebake
« on: February 24, 2023, 12:48:03 PM »
Hi there!

I'm currently testing the possibilities of Metashape in terms of optimization of the mesh. The decimation is very fast, but then I cannot find any other way to bake the texture other than re-building it all over again (and that can take a long time).

I saw in this post ( that there is supposed to be an option to retransfer the texture, but I can't seem to find it. I also have looked into the manual and I still can't find it.

Can anyone tell me where to find this option? Or if it doesn't exist anymore, is there another way to bake the texture after having decimated the object without having to rebuild the texture from scratch?

Thank you :)

Python and Java API / Re: Metashape module not found
« on: January 30, 2023, 07:29:48 PM »
Hi again, nevermind, I found the problem.

The problem was that I have two Python versions on my system. While my VS Code's Python interpreter is set to 3.8, the windows command console was set to Python 3.10 by default. I just had to go and add the Python 3.8 path to the system variables, and make sure it was on top of the list.

Now all works well :) For those who might struggle with this issue, this video allowed me to find the solution

All the best :)

PS : I don't know whether there's a way to indicate a problem has been solved, sorry!

Pages: [1] 2