Forum

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

Pages: [1] 2
1
Python and Java API / Detected Marker has None Position
« on: June 04, 2020, 09:52:54 PM »
This chunk of code:
Code: [Select]
marker_positions = []

for marker in chunk.markers:
    print("{} position: {}".format(marker, marker.position))
    marker_positions.append(marker.position)

vectors = []
for position in marker_positions:
    vectors.append(array([position.x, position.y, position.z]))

Results in this console output:
Code: [Select]
<Marker 'target 11'> position: Vector([2.850384004018244, 1.0210633499586494, -6.354710883046436])
<Marker 'target 12'> position: Vector([0.1409655312925602, -1.873231255504267, -4.556384146429653])
<Marker 'target 13'> position: Vector([-3.1367483930697495, 0.2522316043279687, -6.05366511916446])
<Marker 'target 14'> position: Vector([-0.4853655511060345, 3.1416026085665454, -7.8536455698625565])
<Marker 'target 16'> position: None
<Marker 'target 17'> position: None
<Marker 'target 18'> position: None
<Marker 'target 19'> position: None
<Marker 'target 20'> position: Vector([0.34745671678010315, 1.4629262299823313, -5.828908686770713])
<Marker 'target 21'> position: Vector([1.0872473152349622, 0.8241725426644423, -5.389903594150859])
<Marker 'target 22'> position: Vector([0.3666418664748137, 0.6686374725083808, -4.418571191247626])
<Marker 'target 23'> position: Vector([-0.2897068854704151, 0.650584019576526, -5.326348232334733])
<Marker 'target 24'> position: Vector([-1.4136581747723513, 0.9682022687019506, -5.566239838233837])
<Marker 'target 25'> position: Vector([-0.7353815825573798, 1.9562010612076728, -5.309009445145799])

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/cron/ms_pipeline/sweepS3.py", line 84, in <module>
    main()
  File "/home/ubuntu/cron/ms_pipeline/sweepS3.py", line 77, in main
    runmetashape.main(project_name=runnable_project.name, project_suffix=runnable_project.suffix)
  File "/home/ubuntu/cron/ms_pipeline/ms_workflow/runmetashape.py", line 392, in main
    orientchunk.orient_markers_to_xy_plane(chunk)
  File "/home/ubuntu/cron/ms_pipeline/ms_workflow/bounding_box/orientchunk.py", line 26, in orient_markers_to_xy_plane
    vectors.append(array([position.x, position.y, position.z]))
AttributeError: 'NoneType' object has no attribute 'x'

Can someone explain to me how a marker can be detected but its position is unknown. Is it because there isn't enough data of that marker for Metashape to determine where it is in the 3D space?

2
Python and Java API / Standalone Module Use in a Docker Container
« on: June 03, 2020, 07:10:50 PM »
I'm looking to build my standalone scripting project into a docker image and I was wondering if anyone here has had any experience with that and if so what their Dockerfile looked like.

Related, I was wondering if there is documentation of all the libraries/drivers used by the standalone module so I don't need to go one by one in debugging while building a docker image for my project.

3
Python and Java API / Re: Headless mode import
« on: May 26, 2020, 04:47:53 PM »
I am using the standalone module. The error arises when my script attempts to "import Metashape".

4
Python and Java API / Headless mode import
« on: May 22, 2020, 11:32:34 PM »
I am looking to run my metashape script in a docker container and when I run it I receive this error:
Code: [Select]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/appuser/ms_pipeline/sweepS3.py", line 10, in <module>
    from ms_pipeline.ms_workflow import runmetashape
  File "/home/appuser/ms_pipeline/ms_workflow/runmetashape.py", line 7, in <module>
    import Metashape as Ms
  File "/usr/local/lib/python3.7/site-packages/Metashape/__init__.py", line 3, in <module>
    from .Metashape import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
From preliminary research it seems that this it related to the GUI. For my purposes the GUI is not necessary is there a way I can run the module in headless mode forgoing needs for the GUI? If not please let me know. Thanks.

5
OS: Ubuntu 18.04.4

Nvidia Version: 440.59

6
I want to add texturing to my pipeline but when I run the script I get the following output to the command line:

Code: [Select]
BuildTexture: texture size = 4096, texture type = Diffuse map, source data = Images, blending mode = Mosaic, fill holes = 1, ghosting filter = 1, enable_gpu = 1, relaxed_precision = 1
Found 1 GPUs in 0.000973 sec (CUDA: 0.000223 sec, OpenCL: 0.000736 sec)
Using device: Tesla T4, 40 compute units, free memory: 14989/15109 MB, compute capability 7.5
  driver/runtime CUDA: 10020/6050
  max work group size 1024
  max work item sizes [1024, 1024, 64]
Initializing context...
Cannot use GPU. Reason: VK Error : VkResult is "ERROR_INITIALIZATION_FAILED" at line 59
Performing blending on CPU...
calculating mesh connectivity... done in 0.426329 sec
detecting outliers... ******************************************* done in 37.4896 sec
estimating quality... ******************************************* done in 48.2925 sec
blending textures...  ******************************************* done in 53.0495 sec
postprocessing atlas... done in 0.849618 sec

The texture result seemed to be of lower quality, but if this error is normal I would like to know.

7
Python and Java API / Bounding Box and Coordinate System Conflict
« on: May 01, 2020, 05:43:57 AM »
This is hopefully my last post on my bounding box brigade. I was able to write two standalone scripts, one that orients the markers of the model downwards and another that minimizes the bounding box around the markers. It seems that the coordinate system to bounding box feature borrowed from another script functions for the model orientation but screws up the bounding box for the bounding box reduction. I figured this from the orthographic view and proceeding point data being seemingly skewed.  Both scripts work fine separately but they do not work together. My final product requires both features in succession. I have attached photos visually representing the issue.

This is the section of code I was referring to:
Code: [Select]
R = chunk.region.rot  # Bounding box rotation matrix
C = chunk.region.center  # Bounding box center vector

if chunk.transform.matrix:
    T = chunk.transform.matrix
    print(T)
    s = math.sqrt(T[0, 0] ** 2 + T[0, 1] ** 2 + T[0, 2] ** 2)  # scaling # T.scale()
    S = Metashape.Matrix().Diag([s, s, s, 1])                  # scale matrix
else:
    S = Metashape.Matrix().Diag([1, 1, 1, 1])

T = Metashape.Matrix([[R[0, 0], R[0, 1], R[0, 2], C[0]],
                      [R[1, 0], R[1, 1], R[1, 2], C[1]],
                      [R[2, 0], R[2, 1], R[2, 2], C[2]],
                      [      0,       0,       0,    1]])


Ideally there is a solution that allows the rotation of the object model without altering the coordinate system disabling me from utilizing it properly in the future.

P.S. I have two additional pictures that would aid in understanding the issue but I am limited to 4

8
Python and Java API / Re: Rotate chunk by the orientation of markers
« on: April 28, 2020, 01:01:05 AM »
I am bumping this post because an answer to the above question would answer one of my recent posts. I too only have floor markers and am looking for a solution that supports that.

9
Python and Java API / Re: Trimming Floor From Object
« on: April 24, 2020, 07:43:36 PM »
Do you have a sample script that shows the functionality of orienting the bottom of the bounding box and then raising the face to exclude the floor based on a given height value?

10
Python and Java API / Re: Removing low confidence dense cloud points
« on: April 24, 2020, 12:37:16 AM »
Perfect, thank you.

11
Python and Java API / Trimming Floor From Object
« on: April 24, 2020, 12:31:37 AM »
I have a random object centered among markers as seen in the attached image. In my model processing pipeline I would like to remove the floor before the object model is exported. I have two questions here:
  • At what point in the pipeline would be recommended to trim the floor? After sparse point cloud generation? After dense cloud generation? After Model generation?
  • Would it be better to trim the floor away by adjusting the bounding box to not include the floor or removing the points associated with the floor?
Thanks in advance.

12
Python and Java API / Removing low confidence dense cloud points
« on: April 23, 2020, 04:41:04 PM »
I have a script that sets the confidence filter of the dense cloud. I would like to select all of the points remaining from the filter (say 10 - 255 confidence) and cut them, removing all the other points (0 - 9 confidence). I didn't see any dense cloud point selection method. Do I need to apply the points to a class and then delete the class?

13
Yes it solves my problems and I believe works as it should. However, I was wondering if I could improve the functionality. I have attached the Pre and Post-Script results. The script reduces the bounding box but leave unnecessary data that is not near the cameras as indicated by the red triangles. The ideal result would be a bounding box footprint that matched that of the green rectangle. Is this possible without additional manual input or markers?

14
Bumping this because I am looking for a similar solution.

15
Python and Java API / reduceOverlap() Null model error
« on: April 17, 2020, 06:48:39 PM »
I am trying to add reduceOverlap() functionality to my script but I am getting this error:
Code: [Select]
ReduceOverlap: overlap = Medium, max_cameras = 5, use_selection = 0
Traceback (most recent call last):
  File "/home/ubuntu/A3M/cron_sweep_s3.py", line 89, in <module>
    main()
  File "/home/ubuntu/A3M/cron_sweep_s3.py", line 82, in main
    run_metashape.main(project_name=runnable_project.name, project_suffix=runnable_project.suffix)
  File "/home/ubuntu/A3M/run_metashape.py", line 286, in main
    chunk.reduceOverlap(overlap=reduce_overlap.overlap, max_cameras=reduce_overlap.max_cameras)
Exception: Null model
Does reduceOverlap() need to be run after buildModel()?

Pages: [1] 2