Forum

Author Topic: Questions about the capabilities and limitations of Metashape  (Read 1641 times)

siweisun

  • Newbie
  • *
  • Posts: 2
    • View Profile
Questions about the capabilities and limitations of Metashape
« on: October 05, 2021, 07:18:43 PM »
Hello,

My company has recently decided to purchase an Agisoft Metashape license to construct models out of drone footage. Our current plan is to combine machine learning with Metashape in order to mark the locations of defects (such as concrete spalling, cracked bricks, etc.) in construction material on the model itself, so that our engineers have an easy way of locating critical defects. I just have a few questions about whether Metashape is capable of supporting our workflow.

1. Headless Metashape
We would like to run Metashape without having to open the GUI in order to streamline our workflow. From what I've gathered, it should be possible to run Metashape's python API from the command line. I even installed a python wheel file that seems to include the Metashape python library. However, upon attempting to "import Metashape," I still receive the "key not found" error, despite purchasing a license a few days ago. Is there something that I need to do in order to allow the python package to recognize the license? Also, I would like to know if the rest of my goals can be accomplished from the command line as well.

2. Photo Coordinates System
I currently have a machine learning model capable of detecting defects in construction materials. The model takes in an image and outputs the location of the defect(s) in YOLO format, which I can then redraw onto the input image by converting to OpenCV format. Is it possible to do something similar in Metashape (i.e. is it possible to take one of the images that the model was constructed out of, run inference on it to get the locations of the bounding boxes, convert those locations to a coordinate system that the Metashape software understands, and then draw the bounding box on the image so that is shows up at the correct location on the model)? I've looked into the Project() and Unproject() methods on the Camera object, but they do not seem to meet all of my needs.

3. More Bounding Boxes
I've noticed that if I draw a polygon on one side of the model (e.g. the southern face of a building), it's still possible to see the bounding box from the other side of the model (the northern face of the building). Is it possible to make it so that if I draw a poly on the southern face, and then I rotate the model more than 90 degrees horizontally or vertically, then that polygon disappears? In addition, I would like to fill in the polygons that I draw with color (so that eventually we'll be able to use color to indicate the location of the defects). Is that possible in Metashape? I looked into creating masks, but it seems that masks are either "on" or "off." I would like it to be the case that if multiple images indicate a defect at the same location, then that location should be shaded darker than the surrounding areas.

Thanks for your help!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14840
    • View Profile
Re: Questions about the capabilities and limitations of Metashape
« Reply #1 on: October 05, 2021, 08:48:05 PM »
Hello siweisun,

1. When stand-alone Metashape Python module is used, it is recommended to set up agisoft_LICENSE environment variable as a path to the license file containing directory (as mentioned in the related Knowledge base article: https://agisoft.freshdesk.com/support/solutions/articles/31000148930-how-to-install-metashape-stand-alone-python-module).

2. If you have the 3D coordinates of the points of interest in scene (in the same coordinate system as the results of the camera alignment), then you would be able to get the coordinates of those points projected on the images. Some examples for the similar tasks can be found in the following recent threads:
https://www.agisoft.com/forum/index.php?topic=13659.msg60358#msg60358
https://www.agisoft.com/forum/index.php?topic=13575.msg60037#msg60037

3. I'm not quite sure about the description of the problem from the first part of the related paragraph, can you give a few screenshots demonstrating the problem or an additional description?
As for the shapes, you can create several shape layers and put the shapes related to the defects to those layers, depending on the number of cameras, observing the defects, if it is the same shape that appear on multiple images.
Or just put each shape to individual layer with the own style properties (color, fill, transparency) and in the Photo view they would appear as on the screenshot below:
Best regards,
Alexey Pasumansky,
Agisoft LLC

siweisun

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Questions about the capabilities and limitations of Metashape
« Reply #2 on: October 06, 2021, 10:23:16 AM »
Thank you so much for your response! I'll try out some of your suggestions.
Here is an example of what I mean with my third question (included in attachments). As you can see, face1 and face2 are different sides of the same building. I drew the polygon on face1, but the polygon is still visible when viewed from face2. Is there a way to make the polygon not visible when viewed from face2?
Thanks again for your assistance!