Forum

Author Topic: Correct use of selectMaskedPoints in python  (Read 1403 times)

cwoe

  • Newbie
  • *
  • Posts: 4
    • View Profile
Correct use of selectMaskedPoints in python
« on: March 02, 2021, 09:16:21 PM »
Hi there,

I want to filter my dense point cloud with some masks (by file).

The entire workflow with adding masks before depth map & dense creation works, but I would like to create the dense cloud first.
As far as I understood, the process is to select points by mask and then export those.


I'm trying to use the method

Code: [Select]
Metashape.DenseCloud.selectMaskedPoints(camera, softness=4)

with camera being
Code: [Select]
camera = chunk.cameras
However, this gets me the following error:

Code: [Select]
TypeError: descriptor 'selectMaskedPoints' requires a 'Metashape.Metashape.DenseCloud' object but received a 'Metashape.Metashape.Camera'

Giving the argument of the dense cloud (object?) (chunk.dense_cloud) obviously returns
TypeError: selectMaskedPoints() missing required argument 'cameras' (pos 1)



Could you give me some pointers into the right direction?

Thanks!

Chris



Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Correct use of selectMaskedPoints in python
« Reply #1 on: March 03, 2021, 06:51:14 PM »
Hello Chris,

I think that the problem is related to the incorrect use of selectMaskedPoints functcion. It should be applied to the actual dense cloud instance, whereas you are trying to apply it to Metashape.DenseCloud() class.

Please try the following approach:
Code: [Select]
chunk = Metashape.app.document.chunk
chunk.dense_cloud.selectMaskedPoints(chunk.cameras)
It should select the dense cloud points that appear to be masked on any of the aligned images.
Best regards,
Alexey Pasumansky,
Agisoft LLC

cwoe

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Correct use of selectMaskedPoints in python
« Reply #2 on: March 18, 2021, 04:46:47 PM »
Thanks a lot Alexey for your explanation, that made it work. Awesome!