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.


Topics - pts_and_clouds

Pages: [1]
1
Python and Java API / Parallelizing large scale computations
« on: December 08, 2022, 10:54:45 AM »
Hi everyone, I have an application that I am trying to make more computationally efficient.

I would like to project ALL dense cloud points to ALL cameras in my project to see which 3D points have valid projections.  So, I loop over all cameras and run a camera.project on all the 3D points.

The loop over all cameras is a simple for loop, but I have been able to speed up the loop over all 3D points by using a map operation over camera.project.

For each camera, on my M1 Max Mac with 64 GB RAM and 10 cores, the projection of all 3D points for each camera takes about 5 seconds.  A typical project has ~10 million points and ~300 cameras, so this operation takes a few minutes, which is something I would like to improve.

Some of the things I do now:
1. Remove redundant 3D points written out in the dense cloud, cuts down up to a third of 3D points (I don't know why the redundant points get written in the first place).
2. Instead of looping over every 3D point, I use a map operation to execute camera.project over all the 3D points.

Question:
1. How can I parallelize the camera.project step over all 3D points?  I am assuming that it is currently running only on 1 core
2. How can I parallelize the loop over all the cameras?

Thanks in advance, any help is greatly appreciated.

2
Are these three commands supposed to produce the same output, i.e. the 2D projection of a 3D point on an image?

I am getting the same output for cam.calibration.project and cam.sensor.calibration.project, but cam.sensor returns empty for the same exact point.

In [25]: cam.project(temp_b[0])

In [26]: cam.calibration.project(temp_b[0])
Out[26]: 2022-11-30 12:53:57 Vector([226.91737982171833, 3066.876461424863])

In [27]: cam.sensor.calibration.project(temp_b[0])
Out[27]: 2022-11-30 12:54:04 Vector([226.91737982171833, 3066.876461424863])

Thanks in advance for your help.

3
I have a single image (actually a Metashape Orthophoto) which has some markers that I can run marker detection on.  All I want are the pixel coordinates of these markers, but I cannot use the markers.projections approach because there is no alignment to speak of here and projections returns None.

I tried to export the markers to an XML file (below) and sure enough, I can see the locations of two markers in pixel coordinates towards the end of the file.  How do I recover these using the Python API? 

Thank you.

---------------------
<?xml version="1.0" encoding="UTF-8"?>
<document version="1.5.0">
  <chunk label="Chunk 1" enabled="true">
    <sensors next_id="1">
      <sensor id="0" label="unknown" type="frame">
        <resolution width="3038" height="3561"/>
        <property name="layer_index" value="0"/>
        <bands>
          <band label="Red"/>
          <band label="Green"/>
          <band label="Blue"/>
        </bands>
        <data_type>uint16</data_type>
      </sensor>
    </sensors>
    <components next_id="0"/>
    <cameras next_id="1" next_group_id="0">
      <camera id="0" sensor_id="0" label="Austin_6_24_2_test_pib-bchudzsz"/>
    </cameras>
    <markers next_id="2" next_group_id="0">
      <marker id="0" label="target 116"/>
      <marker id="1" label="target 117"/>
    </markers>
    <reference>LOCAL_CS["Local Coordinates (m)",LOCAL_DATUM["Local Datum",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]</reference>
    <settings>
      <property name="accuracy_tiepoints" value="1"/>
      <property name="accuracy_cameras" value="10"/>
      <property name="accuracy_cameras_ypr" value="10"/>
      <property name="accuracy_markers" value="0.0050000000000000001"/>
      <property name="accuracy_scalebars" value="0.001"/>
      <property name="accuracy_projections" value="0.5"/>
    </settings>
    <frames next_id="1">
      <frame id="0">
        <markers>
          <marker marker_id="0">
            <location camera_id="0" pinned="true" x="2619.54663" y="1992.58142"/>
          </marker>
          <marker marker_id="1">
            <location camera_id="0" pinned="true" x="2820.41455" y="2001.7561"/>
          </marker>
        </markers>
      </frame>
    </frames>
  </chunk>
</document>

Pages: [1]