Forum

Author Topic: Area calculation - Only getting perimeter measure  (Read 1434 times)

wizprod

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Dronographica
Area calculation - Only getting perimeter measure
« on: April 24, 2018, 11:57:00 AM »
Hi!
I trying to measure the area of a roof, but I can only get the perimeter measurement.
I select the polygon, right-click -> Measure.

What am I doing wrong?

See screenshots

SAV

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #1 on: April 26, 2018, 10:28:50 AM »
Hi wizprod,

Perform the measurement on your DEM.
Alternatively, use the ruler to measure the width (a) and length (b) of your roof on your mesh and then calculate the area (A = a * b).

Regards,
SAV
« Last Edit: April 26, 2018, 10:32:44 AM by SAV »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 12742
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #2 on: April 27, 2018, 09:44:05 PM »
Hello wizprod,

Area and volume measurements in the Model view are not supported via Shapes. Currently the only way to measure the area on the mesh is to crop everything except the area of interest and run Tools Menu -> Measure Area&Volume function, it will sum the area of every polygon left, then you can undo the polygons removal.

DEM based measurements for area wouldn't include the roof inclination and you'll get the area in XY plane based on the input shape.
Best regards,
Alexey Pasumansky,
Agisoft LLC

toxicmag

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #3 on: April 14, 2021, 06:11:47 PM »
Hey Metashape friends,

are there any news here?

What are your smart procedures to fulfill this kind of task?
The easier the better - to also maybe have the client measure his areas himself.

Tried a lot already:

+ Metashape (and Viewer) itself (via Pointclouds, Meshes, DEMs)
+ Cloudcompare
+ Potree (would be ok)
+ Meshlab
+ exported 3D PDFs (would be awesome)

None of these options works in an easy way.

Sure, tools like Pix4D cloud, oder ArcGIS Pro can easily do it. Also QGIS can be used for it...
But nothing "simple" to give to the client yet.

What are your latest ideas on that?

Cheers and thx in advance

Alex
#multirotor #VTOL #Trinity #Quantum-Systems #a6000 #a7R #RedEdge #ALTUM #RX1II

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 12742
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #4 on: April 14, 2021, 07:06:20 PM »
Hello Alex,

Currently I can only suggest to switch the type of the polygonal shape to Outer Boundary, then duplicate the mesh model with "clip to boundary shapes" option enabled.
After that use Measure Area&Volume option in Tools menu.

This approach may require, however, to clean up the mesh faces that are below the roof level before measuring the area.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 614
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #5 on: April 14, 2021, 07:15:51 PM »
Hey Alex,

another way to look at it is to draw your polygons on the Digital Surface Model (DSM) and then develop a script that:
- divides each 3d polygon into a series of triangles;
- calculates the area of each component triangle;
- sums the areas of each component triangle to get polygon 3d area.

By the way Aklexey, wouldn`t your suggested solution give an area including the faces below the roof and thus get an area that is greater  than just roof?
Best Regards,

Paul Pelletier

toxicmag

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #6 on: April 14, 2021, 07:16:26 PM »
Hey Alexey,

thanks for this workaround   :)

To clip a mesh with the help of a polygon is a question we were considering right before i wrote.   :)

Anyway - if someone knows a more straight forward way (even though it might be outside Metashape) i would be very happy to try it.

#multirotor #VTOL #Trinity #Quantum-Systems #a6000 #a7R #RedEdge #ALTUM #RX1II

Paulo

  • Hero Member
  • *****
  • Posts: 614
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #7 on: April 14, 2021, 07:58:19 PM »
Alex,

I guess Alexey`s suggestion is the best as division of 3d polygon into triangles is not so straightforward  as result depends on the sequence in which triangle division is performed...

Any how, I did as Alexey defining 2 polygons (1 and 2) secuentially as Outer boundary and then duplicating model with clip to boundary activated. After deleting a few faces below each roof, I got 3d areas and compare them to 2d area. Note that 3d roof area will include any water tanks or air conditioners present on roof...see following:
« Last Edit: April 15, 2021, 01:20:30 AM by Paulo »
Best Regards,

Paul Pelletier

toxicmag

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #8 on: April 15, 2021, 08:54:36 AM »
... switch the type of the polygonal shape to Outer Boundary...

Hi Alexey,

currently the only option to switch that type to "outer boundary" is in DEM or Ortho, not in other views.
So one needs to generate a DEM and or Ortho first, even though it's not necessary.

Maybe an idea to create a ticket for the developers to implement this menu item in model view?

Greetings

Alex
#multirotor #VTOL #Trinity #Quantum-Systems #a6000 #a7R #RedEdge #ALTUM #RX1II

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 12742
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #9 on: April 15, 2021, 07:37:43 PM »
Hello Alex,

You can switch to Ortho view even without orthomosaic and DEM being generated and there assign the boundary type to the shape.

But we'll see, if the option can be also added to Model view mode.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 614
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #10 on: April 15, 2021, 10:15:43 PM »
Hi Alexey,

in order to automate the process of defining a roof model for each shape I wrote the following code that loops thru all relevant shapes and for each shape uses task.DuplicateAsset with clip to boundary True to duplicate the original model.

Code: [Select]
for shape in shapes:
    shape.boundary_type = Metashape.Shape.OuterBoundary
    task = Metashape.Tasks.DuplicateAsset()
    task.asset_type = Metashape.ModelData
    task.clip_to_boundary = True
    task.asset_key = chunk.models[0].key
    task.apply(chunk)
    shape.boundary_type = Metashape.Shape.NoBoundary   
    chunk.models[-1].label = shape.label

So at the end, I get a roof model for each shape. But it is not cleaned (faces below roof). It would be great if in API there would be a way to define a Rectangle Selection in front model view with top of rectangle just below the Z minimum of corresponding shape and width equal or a little more to X extent of same shape and then just removeSelection(). Is this possible?... See screen copy whre relevant Roof model of shape 2 is shown...
« Last Edit: April 16, 2021, 04:07:14 AM by Paulo »
Best Regards,

Paul Pelletier

Paulo

  • Hero Member
  • *****
  • Posts: 614
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #11 on: April 16, 2021, 12:12:13 AM »
Hi all,

i was able to modify the code that includes comparing face vertices z values to shape Zmin and if all face vertices have z less than minimum then face is selected and removed:

Code: [Select]
chunk = Metashape.app.document.chunk
shapes = [shape for shape in chunk.shapes if shape.group.label == 'Const']
T = chunk.transform.matrix
task = Metashape.Tasks.DuplicateAsset()
task.asset_type = Metashape.ModelData
task.clip_to_boundary = True
task.asset_key = chunk.models[0].key
for shape in shapes:
    zmin = 1e9
    for v in shape.vertices:
        if v.z < zmin:
            zmin = v.z
    shape.boundary_type = Metashape.Shape.OuterBoundary
    task.apply(chunk)
    shape.boundary_type = Metashape.Shape.NoBoundary   
    chunk.models[-1].label = shape.label
    model = chunk.models[-1]
    for f in model.faces:
        zval = [(chunk.shapes.crs.project(T.mulp(model.vertices[f.vertices[0]].coord))).z,(chunk.shapes.crs.project(T.mulp(model.vertices[f.vertices[1]].coord))).z,(chunk.shapes.crs.project(T.mulp(model.vertices[f.vertices[2]].coord))).z]
        zval.sort()
        if zval[-1] < zmin:
            f.selected = True
    model.removeSelection()
    print('Roof {} Area3D: {:.3f} m2 Area2D: {:.3f} m2'.format(model.label,model.area(),shape.area()))

Following capture shows result of running code on 3 roof shapes.
Hope this can be helpful,
« Last Edit: April 16, 2021, 07:09:48 AM by Paulo »
Best Regards,

Paul Pelletier

toxicmag

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Area calculation - Only getting perimeter measure
« Reply #12 on: April 16, 2021, 03:25:09 PM »
Thanks Alexey, thanks Paulo, thanks ALL...   :)

Once again this forum shows us why Agisoft is the company to go with.
Great developers, great users, open for code/console orders/scripts...

Nice one - looking forward to try out.

:)


Have a good weekend and stay healthy!

Alex
#multirotor #VTOL #Trinity #Quantum-Systems #a6000 #a7R #RedEdge #ALTUM #RX1II