Forum

Author Topic: How to get a BBox from a DenseCloud?  (Read 2587 times)

dyoung

  • Newbie
  • *
  • Posts: 32
    • View Profile
How to get a BBox from a DenseCloud?
« on: January 18, 2020, 09:53:59 PM »
Hello -- I would like to constrain the extent of an orthomosaic that is exported by the exportRaster method. I see the method has a region parameter, which takes a BBox object. I would like to constrain the exported extent of the orthomosaic to be the same as the extent of my dense point cloud. How can I get a BBox object that contains the extent (region) of my dense cloud? I checked the documentation, but there is little information on BBox objects.

Thank you!

khedar012

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to get a BBox from a DenseCloud?
« Reply #1 on: January 29, 2020, 12:29:01 AM »
Hi, I am also looking for similar function but for exportPoints(). I looked at the Documentation and tried the following code:
Code: [Select]
import Metashape as ms

doc = ms.app.document
chunk = doc.chunks[0]

region1 = ms.BBox()
x0, y0, z0 = long_0, lat_0, chunk.elevation.min # Some values i define somewhere else.
x1, y1, z1 = long_1, lat_1, chunk.elevation.max # Some values i define somewhere else.
region1.min = ms.Vector([x0, y0, z0])
region1.max = ms.Vector([x1, y1, z1])
chunk.exportPoints(path="test.las", region=region1)
but it gives me the error:
Code: [Select]
2020-01-28 22:21:34 ValueError: Invalid argument value: region
2020-01-28 22:21:34 Error: Invalid argument value: region

It seems somehow the python module is not recognising the "region" argument of the function exportPoints(). I also check this with the exportRaster() but same problem.

Please help :)

khedar012

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to get a BBox from a DenseCloud?
« Reply #2 on: January 29, 2020, 01:24:46 AM »
Some more information, I tried the above example from this post on the forum:
https://www.agisoft.com/forum/index.php?topic=11547.msg51875#msg51875

It may be that the "region" expects a Metashape.Region object and i am passing it the newly introduced Metashape.Bbox object. But the documentation says that the "region" should take Bbox object. Maybe some bug in the current release?

I am using Agisoft metashape 1.6.1 on windows 64 machine.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: How to get a BBox from a DenseCloud?
« Reply #3 on: January 29, 2020, 12:17:26 PM »
Hello khedar012,

Min and max values should be a two-component vector (X, Y) without Z component.
Best regards,
Alexey Pasumansky,
Agisoft LLC

khedar012

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to get a BBox from a DenseCloud?
« Reply #4 on: January 29, 2020, 12:28:55 PM »
Hi Alexey, thanks for quick reply. Does the vector need to be only in the Local Coordinate System? Thanks